aggregator: Use the event_full function for GstAggregatorPads

Allowing us to tell GstPad why we are failing an event, which might
be because we are 'flushing' even if the sinkpad is not in flush state
at that point.
This commit is contained in:
Thibault Saunier 2016-09-06 16:05:53 -03:00 committed by Tim-Philipp Müller
parent 885c95c3ed
commit 5fefb1b866

View file

@ -2310,10 +2310,11 @@ flushing:
return FALSE; return FALSE;
} }
static gboolean static GstFlowReturn
gst_aggregator_pad_event_func (GstPad * pad, GstObject * parent, gst_aggregator_pad_event_func (GstPad * pad, GstObject * parent,
GstEvent * event) GstEvent * event)
{ {
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); GstAggregatorClass *klass = GST_AGGREGATOR_GET_CLASS (parent);
@ -2324,8 +2325,10 @@ gst_aggregator_pad_event_func (GstPad * pad, GstObject * parent,
PAD_LOCK (aggpad); PAD_LOCK (aggpad);
if (aggpad->priv->flow_return != GST_FLOW_OK if (aggpad->priv->flow_return != GST_FLOW_OK
&& GST_EVENT_TYPE (event) != GST_EVENT_FLUSH_STOP) && GST_EVENT_TYPE (event) != GST_EVENT_FLUSH_STOP) {
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);
@ -2347,10 +2350,22 @@ gst_aggregator_pad_event_func (GstPad * pad, GstObject * parent,
SRC_UNLOCK (self); SRC_UNLOCK (self);
} }
if (event) if (event) {
return klass->sink_event (self, aggpad, event); if (!klass->sink_event (self, aggpad, event)) {
else /* Copied from GstPad to convert boolean to a GstFlowReturn in
return TRUE; * the event handling func */
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_CAPS:
ret = GST_FLOW_NOT_NEGOTIATED;
break;
default:
ret = GST_FLOW_ERROR;
break;
}
}
}
return ret;
flushing: flushing:
GST_DEBUG_OBJECT (aggpad, "Pad is %s, dropping event", GST_DEBUG_OBJECT (aggpad, "Pad is %s, dropping event",
@ -2360,7 +2375,8 @@ flushing:
if (GST_EVENT_IS_STICKY (event)) if (GST_EVENT_IS_STICKY (event))
gst_pad_store_sticky_event (pad, event); gst_pad_store_sticky_event (pad, event);
gst_event_unref (event); gst_event_unref (event);
return FALSE;
return ret;
} }
static gboolean static gboolean
@ -2397,8 +2413,9 @@ gst_aggregator_pad_constructed (GObject * object)
gst_pad_set_chain_function (pad, gst_pad_set_chain_function (pad,
GST_DEBUG_FUNCPTR (gst_aggregator_pad_chain)); GST_DEBUG_FUNCPTR (gst_aggregator_pad_chain));
gst_pad_set_event_function (pad, gst_pad_set_event_full_function_full (pad,
GST_DEBUG_FUNCPTR (gst_aggregator_pad_event_func)); GST_DEBUG_FUNCPTR (gst_aggregator_pad_event_func),
NULL, NULL);
gst_pad_set_query_function (pad, gst_pad_set_query_function (pad,
GST_DEBUG_FUNCPTR (gst_aggregator_pad_query_func)); GST_DEBUG_FUNCPTR (gst_aggregator_pad_query_func));
gst_pad_set_activatemode_function (pad, gst_pad_set_activatemode_function (pad,