From b7693464d0fb1798c9d06b8f12ff708e11b9aefa Mon Sep 17 00:00:00 2001 From: =?utf8?q?Olivier=20Cr=C3=AAte?= Date: Tue, 9 May 2017 20:05:55 -0400 Subject: [PATCH] aggregator: Reset pad on init Factor out the pad reset code from the flushing and use it on init as well https://bugzilla.gnome.org/show_bug.cgi?id=781673 --- libs/gst/base/gstaggregator.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/libs/gst/base/gstaggregator.c b/libs/gst/base/gstaggregator.c index 21a81fe3..9a688dc 100644 --- a/libs/gst/base/gstaggregator.c +++ b/libs/gst/base/gstaggregator.c @@ -229,12 +229,10 @@ struct _GstAggregatorPadPrivate GMutex flush_lock; }; -static gboolean -gst_aggregator_pad_flush (GstAggregatorPad * aggpad, GstAggregator * agg) +/* Must be called with PAD_LOCK held */ +static void +gst_aggregator_pad_reset_unlocked (GstAggregatorPad * aggpad) { - GstAggregatorPadClass *klass = GST_AGGREGATOR_PAD_GET_CLASS (aggpad); - - PAD_LOCK (aggpad); aggpad->priv->pending_eos = FALSE; aggpad->priv->eos = FALSE; aggpad->priv->flow_return = GST_FLOW_OK; @@ -247,6 +245,15 @@ gst_aggregator_pad_flush (GstAggregatorPad * aggpad, GstAggregator * agg) aggpad->priv->head_time = GST_CLOCK_TIME_NONE; aggpad->priv->tail_time = GST_CLOCK_TIME_NONE; aggpad->priv->time_level = 0; +} + +static gboolean +gst_aggregator_pad_flush (GstAggregatorPad * aggpad, GstAggregator * agg) +{ + GstAggregatorPadClass *klass = GST_AGGREGATOR_PAD_GET_CLASS (aggpad); + + PAD_LOCK (aggpad); + gst_aggregator_pad_reset_unlocked (aggpad); PAD_UNLOCK (aggpad); if (klass->flush) @@ -2458,6 +2465,7 @@ gst_aggregator_pad_init (GstAggregatorPad * pad) g_mutex_init (&pad->priv->lock); pad->priv->first_buffer = TRUE; + gst_aggregator_pad_reset_unlocked (pad); } /** -- 2.7.4