From b7c4785a22b8e485e1301aa231856c8f22d04c07 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Thu, 20 Sep 2018 01:07:34 +1000 Subject: [PATCH] mpegtsdemux: Keep the position increasing. Don't keep the segment position jumping back and forth based on stream DTS/PTS, only increase the position if the new value is larger than the old. --- gst/mpegtsdemux/tsdemux.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gst/mpegtsdemux/tsdemux.c b/gst/mpegtsdemux/tsdemux.c index 2bc16c31ed..5b5f807bae 100644 --- a/gst/mpegtsdemux/tsdemux.c +++ b/gst/mpegtsdemux/tsdemux.c @@ -3051,10 +3051,13 @@ gst_ts_demux_push_pending_data (GstTSDemux * demux, TSDemuxStream * stream, GST_TIME_FORMAT, (buffer_list ? "list" : ""), GST_TIME_ARGS (stream->pts), GST_TIME_ARGS (stream->dts)); - if (GST_CLOCK_TIME_IS_VALID (stream->dts)) - base->out_segment.position = stream->dts; - else if (GST_CLOCK_TIME_IS_VALID (stream->pts)) - base->out_segment.position = stream->pts; + if (GST_CLOCK_TIME_IS_VALID (stream->dts)) { + if (stream->dts > base->out_segment.position) + base->out_segment.position = stream->dts; + } else if (GST_CLOCK_TIME_IS_VALID (stream->pts)) { + if (stream->pts > base->out_segment.position) + base->out_segment.position = stream->pts; + } if (buffer) { res = gst_pad_push (stream->pad, buffer);