From d6633d6edc7f7e3052772ac0f4d9f96e29985126 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Wed, 23 Dec 2009 17:03:32 +0100 Subject: [PATCH] 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 file changed, 10 insertions(+) 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; -- 2.7.4