aggregator: code cleanup for event and query func

Only look up klass for non serialized events/queries. For events remove
superfluous assignment for the return value in the flushing case.
This commit is contained in:
Stefan Sauer 2017-10-15 20:46:09 +02:00 committed by Tim-Philipp Müller
parent 8776900cf7
commit fb3c9f3808

View file

@ -2602,7 +2602,6 @@ gst_aggregator_pad_query_func (GstPad * pad, GstObject * parent,
{ {
GstAggregator *self = GST_AGGREGATOR (parent); GstAggregator *self = GST_AGGREGATOR (parent);
GstAggregatorPad *aggpad = GST_AGGREGATOR_PAD (pad); GstAggregatorPad *aggpad = GST_AGGREGATOR_PAD (pad);
GstAggregatorClass *klass = GST_AGGREGATOR_GET_CLASS (parent);
if (GST_QUERY_IS_SERIALIZED (query)) { if (GST_QUERY_IS_SERIALIZED (query)) {
GstStructure *s; GstStructure *s;
@ -2638,9 +2637,11 @@ gst_aggregator_pad_query_func (GstPad * pad, GstObject * parent,
PAD_UNLOCK (aggpad); PAD_UNLOCK (aggpad);
return ret; return ret;
} } else {
GstAggregatorClass *klass = GST_AGGREGATOR_GET_CLASS (parent);
return klass->sink_query (self, aggpad, query); return klass->sink_query (self, aggpad, query);
}
flushing: flushing:
GST_DEBUG_OBJECT (aggpad, "Pad is %s, dropping query", GST_DEBUG_OBJECT (aggpad, "Pad is %s, dropping query",
@ -2661,17 +2662,14 @@ gst_aggregator_pad_event_func (GstPad * pad, GstObject * parent,
GstFlowReturn ret = GST_FLOW_OK; GstFlowReturn ret = GST_FLOW_OK;
GstAggregator *self = GST_AGGREGATOR (parent); GstAggregator *self = GST_AGGREGATOR (parent);
GstAggregatorPad *aggpad = GST_AGGREGATOR_PAD (pad); GstAggregatorPad *aggpad = GST_AGGREGATOR_PAD (pad);
GstAggregatorClass *klass = GST_AGGREGATOR_GET_CLASS (parent);
if (GST_EVENT_IS_SERIALIZED (event) if (GST_EVENT_IS_SERIALIZED (event)
&& GST_EVENT_TYPE (event) != GST_EVENT_FLUSH_STOP) { && GST_EVENT_TYPE (event) != GST_EVENT_FLUSH_STOP) {
SRC_LOCK (self); SRC_LOCK (self);
PAD_LOCK (aggpad); PAD_LOCK (aggpad);
if (aggpad->priv->flow_return != GST_FLOW_OK) { if (aggpad->priv->flow_return != GST_FLOW_OK)
ret = aggpad->priv->flow_return;
goto flushing; goto flushing;
}
if (GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT) { if (GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT) {
GST_OBJECT_LOCK (aggpad); GST_OBJECT_LOCK (aggpad);
@ -2687,6 +2685,8 @@ gst_aggregator_pad_event_func (GstPad * pad, GstObject * parent,
PAD_UNLOCK (aggpad); PAD_UNLOCK (aggpad);
SRC_UNLOCK (self); SRC_UNLOCK (self);
} else { } else {
GstAggregatorClass *klass = GST_AGGREGATOR_GET_CLASS (parent);
if (!klass->sink_event (self, aggpad, event)) { if (!klass->sink_event (self, aggpad, event)) {
/* Copied from GstPad to convert boolean to a GstFlowReturn in /* Copied from GstPad to convert boolean to a GstFlowReturn in
* the event handling func */ * the event handling func */
@ -2705,7 +2705,7 @@ flushing:
gst_pad_store_sticky_event (pad, event); gst_pad_store_sticky_event (pad, event);
gst_event_unref (event); gst_event_unref (event);
return ret; return aggpad->priv->flow_return;
} }
static gboolean static gboolean