[gst-cvs] gst-plugins-good: flacdec: fix possible hanging in pull mode seeking

Mark Nauwelaerts mnauw at kemper.freedesktop.org
Wed Dec 23 10:42:36 PST 2009


Module: gst-plugins-good
Branch: master
Commit: d6633d6edc7f7e3052772ac0f4d9f96e29985126
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=d6633d6edc7f7e3052772ac0f4d9f96e29985126

Author: Mark Nauwelaerts <mark.nauwelaerts at collabora.co.uk>
Date:   Wed Dec 23 17:03:32 2009 +0100

flacdec: fix possible hanging in pull mode seeking

A seek in multi-sink pipeline typically leads to several seek events in a row,
which could lead to sending several newsegments in a row without intermediate
flushing.  These would then accumulate, distort rendering times and as such
lead to 'hanging'.

---

 ext/flac/gstflacdec.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/ext/flac/gstflacdec.c b/ext/flac/gstflacdec.c
index f28df87..bfc8c95 100644
--- a/ext/flac/gstflacdec.c
+++ b/ext/flac/gstflacdec.c
@@ -1773,6 +1773,16 @@ gst_flac_dec_handle_seek_event (GstFlacDec * flacdec, GstEvent * event)
    * downstream in PAUSED, for example */
   GST_PAD_STREAM_LOCK (flacdec->sinkpad);
 
+  /* start seek with clear state to avoid seeking thread pushing segments/data.
+   * Note current state may have some pending,
+   * e.g. multi-sink seek leads to immediate subsequent seek events */
+  if (flacdec->start_segment) {
+    gst_event_unref (flacdec->start_segment);
+    flacdec->start_segment = NULL;
+  }
+  gst_buffer_replace (&flacdec->pending, NULL);
+  flacdec->pending_samples = 0;
+
   /* save a segment copy until we know the seek worked. The idea is that
    * when the seek fails, we want to restore with what we were doing. */
   segment = flacdec->segment;





More information about the Gstreamer-commits mailing list