From f0d6b841a24a09d88cb5473598feffe4ec277251 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Thu, 28 Jan 2010 18:58:08 +0100 Subject: [PATCH] matroskademux: improve stream synchronization In particular, do not make it send newsegment updates that sort-of contradict the indented playback segment (e.g. start time). --- gst/matroska/matroska-demux.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c index 4ed380a94e..9448b977c1 100644 --- a/gst/matroska/matroska-demux.c +++ b/gst/matroska/matroska-demux.c @@ -3526,9 +3526,12 @@ gst_matroska_demux_sync_streams (GstMatroskaDemux * demux) "Checking for resync on stream %d (%" GST_TIME_FORMAT ")", stream_nr, GST_TIME_ARGS (context->pos)); - /* does it lag? 0.5 seconds is a random threshold... */ - if (GST_CLOCK_TIME_IS_VALID (context->pos) - && context->pos + (GST_SECOND / 2) < demux->segment.last_stop) { + /* does it lag? 0.5 seconds is a random threshold... + * lag need only be considered if we have advanced into requested segment */ + if (GST_CLOCK_TIME_IS_VALID (context->pos) && + GST_CLOCK_TIME_IS_VALID (demux->segment.last_stop) && + demux->segment.last_stop > demux->segment.start && + context->pos + (GST_SECOND / 2) < demux->segment.last_stop) { GST_DEBUG_OBJECT (demux, "Synchronizing stream %d with others by advancing time " "from %" GST_TIME_FORMAT " to %" GST_TIME_FORMAT, stream_nr,