diff options
author | Thibault Saunier <thibault.saunier@osg.samsung.com> | 2016-09-06 16:05:53 -0300 |
---|---|---|
committer | Thibault Saunier <thibault.saunier@osg.samsung.com> | 2016-09-06 16:30:28 -0300 |
commit | 533ee7be95aedb93bff1f08f62288b13bf1d844b (patch) | |
tree | 949d8b70b64eb96349680da40f59ca77f629e97f | |
parent | f15a3e3657e19c64ae9c377e3c7b11f0428976e4 (diff) |
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.
-rw-r--r-- | gst-libs/gst/base/gstaggregator.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/gst-libs/gst/base/gstaggregator.c b/gst-libs/gst/base/gstaggregator.c index d458e975db..7e8c5be443 100644 --- a/gst-libs/gst/base/gstaggregator.c +++ b/gst-libs/gst/base/gstaggregator.c @@ -2310,10 +2310,11 @@ flushing: return FALSE; } -static gboolean +static GstFlowReturn gst_aggregator_pad_event_func (GstPad * pad, GstObject * parent, GstEvent * event) { + GstFlowReturn ret = GST_FLOW_OK; GstAggregator *self = GST_AGGREGATOR (parent); GstAggregatorPad *aggpad = GST_AGGREGATOR_PAD (pad); GstAggregatorClass *klass = GST_AGGREGATOR_GET_CLASS (parent); @@ -2324,8 +2325,10 @@ gst_aggregator_pad_event_func (GstPad * pad, GstObject * parent, PAD_LOCK (aggpad); 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; + } if (GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT) { GST_OBJECT_LOCK (aggpad); @@ -2347,10 +2350,22 @@ gst_aggregator_pad_event_func (GstPad * pad, GstObject * parent, SRC_UNLOCK (self); } - if (event) - return klass->sink_event (self, aggpad, event); - else - return TRUE; + if (event) { + if (!klass->sink_event (self, aggpad, event)) { + /* Copied from GstPad to convert boolean to a GstFlowReturn in + * 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: GST_DEBUG_OBJECT (aggpad, "Pad is %s, dropping event", @@ -2360,7 +2375,8 @@ flushing: if (GST_EVENT_IS_STICKY (event)) gst_pad_store_sticky_event (pad, event); gst_event_unref (event); - return FALSE; + + return ret; } static gboolean @@ -2397,8 +2413,9 @@ gst_aggregator_pad_constructed (GObject * object) gst_pad_set_chain_function (pad, GST_DEBUG_FUNCPTR (gst_aggregator_pad_chain)); - gst_pad_set_event_function (pad, - GST_DEBUG_FUNCPTR (gst_aggregator_pad_event_func)); + gst_pad_set_event_full_function_full (pad, + GST_DEBUG_FUNCPTR (gst_aggregator_pad_event_func), + NULL, NULL); gst_pad_set_query_function (pad, GST_DEBUG_FUNCPTR (gst_aggregator_pad_query_func)); gst_pad_set_activatemode_function (pad, |