From f6507af94616fd69ecb7ef2d4c3a60a9be76a499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= Date: Mon, 16 Mar 2015 17:06:46 -0400 Subject: [PATCH] audioaggregator: On timeout, resync pads with not enough data https://bugzilla.gnome.org/show_bug.cgi?id=745768 --- gst/audiomixer/gstaudioaggregator.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/gst/audiomixer/gstaudioaggregator.c b/gst/audiomixer/gstaudioaggregator.c index 351b1d70a4..ca06a66067 100644 --- a/gst/audiomixer/gstaudioaggregator.c +++ b/gst/audiomixer/gstaudioaggregator.c @@ -1271,6 +1271,20 @@ gst_audio_aggregator_aggregate (GstAggregator * agg, gboolean timeout) aagg->priv->offset = next_offset; agg->segment.position = next_timestamp; + /* If there was a timeout and there was a gap in data in out of the streams, + * then it's a very good time to for a resync with the timestamps. + */ + if (timeout) { + for (iter = element->sinkpads; iter; iter = iter->next) { + GstAudioAggregatorPad *pad = GST_AUDIO_AGGREGATOR_PAD (iter->data); + + GST_OBJECT_LOCK (pad); + if (pad->priv->output_offset < aagg->priv->offset) + pad->priv->output_offset = -1; + GST_OBJECT_UNLOCK (pad); + } + } + GST_OBJECT_UNLOCK (agg); /* send it out */