From ad71d43f5221fedd4a8b2733a5e572ced93b3016 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 26 Feb 2010 18:10:32 +0100 Subject: [PATCH] matroskademux: Advance sparse streams only as much as required to keep the gap smaller than 500ms Changing it to the newest timestamp that was ever pushed will increase the segment start in 500ms jumps, which could be just after the next sparse stream buffer. E.g. Video at 1.0s, sparse stream at 0.5s would jump the sparse stream to 1.0s. Now a new sparse stream buffer could appear that has a timestamp of 0.9s and this would be dropped for no good reason because of bad luck. --- gst/matroska/matroska-demux.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c index 5f2d10b..de0fc43 100644 --- a/gst/matroska/matroska-demux.c +++ b/gst/matroska/matroska-demux.c @@ -3532,19 +3532,21 @@ gst_matroska_demux_sync_streams (GstMatroskaDemux * demux) 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) { + gint64 new_start; + + new_start = demux->segment.last_stop - (GST_SECOND / 2); GST_DEBUG_OBJECT (demux, "Synchronizing stream %d with others by advancing time " "from %" GST_TIME_FORMAT " to %" GST_TIME_FORMAT, stream_nr, - GST_TIME_ARGS (context->pos), - GST_TIME_ARGS (demux->segment.last_stop)); + GST_TIME_ARGS (context->pos), GST_TIME_ARGS (new_start)); - context->pos = demux->segment.last_stop; + context->pos = new_start; /* advance stream time */ gst_pad_push_event (context->pad, gst_event_new_new_segment (TRUE, demux->segment.rate, - demux->segment.format, demux->segment.last_stop, - demux->segment.stop, demux->segment.last_stop)); + demux->segment.format, new_start, + demux->segment.stop, new_start)); } } } -- 2.7.4