From fc2460b33196020d034b72741ce04cddf6e3f1b9 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Mon, 9 Mar 2015 09:56:38 +0000 Subject: [PATCH] tsdemux: keep track of current position This allows seeking to correctly set the base on the segment. https://bugzilla.gnome.org/show_bug.cgi?id=745102 --- gst/mpegtsdemux/tsdemux.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gst/mpegtsdemux/tsdemux.c b/gst/mpegtsdemux/tsdemux.c index 9313cc5..b7bae7d 100644 --- a/gst/mpegtsdemux/tsdemux.c +++ b/gst/mpegtsdemux/tsdemux.c @@ -1957,12 +1957,14 @@ calculate_and_push_newsegment (GstTSDemux * demux, TSDemuxStream * stream) demux->segment = base->segment; } else { /* Start from the first ts/pts */ + GstClockTime base = demux->segment.base; gst_segment_init (&demux->segment, GST_FORMAT_TIME); demux->segment.start = firstts; demux->segment.stop = GST_CLOCK_TIME_NONE; demux->segment.position = firstts; demux->segment.time = firstts; demux->segment.rate = demux->rate; + demux->segment.base = base; } } else if (demux->segment.start < firstts) { /* Take into account the offset to the first buffer timestamp */ @@ -2200,6 +2202,9 @@ gst_ts_demux_push_pending_data (GstTSDemux * demux, TSDemuxStream * stream) GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT); stream->discont = FALSE; + if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DTS (buffer))) + demux->segment.position = GST_BUFFER_DTS (buffer); + res = gst_pad_push (stream->pad, buffer); /* Record that a buffer was pushed */ stream->nb_out_buffers += 1; -- 2.7.4