GNOME Bugzilla – Bug 763262
mpegtsdemux: accurate seeks are no more accurate (regression)
Last modified: 2016-04-14 17:42:40 UTC
Created attachment 323320 [details] test code doing seeks. Hi, I encountered problem that for any gstreamer version greater than 1.4.5 accurate seeks stopped to work with mpeg files, pipeline position after seek on them with GST_SEEK_FLAG_ACCURATE is always few seconds away from target position. On 1.4.5 and previous versions such seeks work perfectly. Problem exists from 1.5.1 version and still present on version 1.7.90 and master. I'm attaching simple code snippet which shows problem. Started with any mpg or mts file as parameter on version 1.5.1+: ./a.out ./sss.mpg ** Message: seek(0) to position(5 s), playbin position after seek:0:00:02.688088888 ** Message: seek(1) to position(10 s), playbin position after seek:0:00:07.701766667 ** Message: seek(2) to position(20 s), playbin position after seek:0:00:17.684744444 ** Message: seek(3) to position(15 s), playbin position after seek:0:00:12.757077777 on version 1.4.5: ** Message: seek(0) to position(5 s), playbin position after seek:0:00:05.000000000 ** Message: seek(1) to position(10 s), playbin position after seek:0:00:10.000000000 ** Message: seek(2) to position(20 s), playbin position after seek:0:00:20.000000000 ** Message: seek(3) to position(15 s), playbin position after seek:0:00:15.000000000 After checking commits between version 1.4.5 and 1.5.1, commit which introduces this regression is : >git show ade79a9ad24a72d1b02f2e35e7dbeaf3bd59bb6c >commit ade79a9ad24a72d1b02f2e35e7dbeaf3bd59bb6c >Author: Vincent Penquerc'h <vincent.penquerch@collabora.co.uk> >Date: Tue Mar 24 12:56:53 2015 +0000 > > tsdemux: send new segment when a stream is added > > This will happen when the PMT changes, replacing streams with > new ones. In that case, we need to accumulate the running time > from the previous chain in the segment base. > > https://bugzilla.gnome.org/show_bug.cgi?id=745102 > >diff --git a/gst/mpegtsdemux/tsdemux.c b/gst/mpegtsdemux/tsdemux.c >index b7bae7d..a9cf88b 100644 >--- a/gst/mpegtsdemux/tsdemux.c >+++ b/gst/mpegtsdemux/tsdemux.c >@@ -1399,6 +1399,7 @@ gst_ts_demux_stream_added (MpegTSBase * base, >MpegTSBaseStream * bstream, > stream->active = FALSE; > > stream->need_newsegment = TRUE; >+ demux->reset_segment = TRUE; > stream->needs_keyframe = FALSE; > stream->discont = TRUE; > stream->pts = GST_CLOCK_TIME_NONE; >@@ -1957,7 +1958,7 @@ calculate_and_push_newsegment (GstTSDemux * demux, >TSDemuxStream * stream) > demux->segment = base->segment; > } else { > /* Start from the first ts/pts */ >- GstClockTime base = demux->segment.base; >+ GstClockTime base = base = demux->segment.position - >demux->segment.start; > gst_segment_init (&demux->segment, GST_FORMAT_TIME); > demux->segment.start = firstts; > demux->segment.stop = GST_CLOCK_TIME_NONE;
Created attachment 323372 [details] [review] tsdemux: Don't reset/recalculate segments with accurate seeks When dealing with accurate seeks, we must send out a segment which is exactly what is requested.
commit 215c9eb71aa6afde477e0300c79102a2f4da2e0b Author: Edward Hervey <edward@centricular.com> Date: Tue Mar 8 11:41:49 2016 +0100 tsdemux: Don't reset/recalculate segments with accurate seeks When dealing with accurate seeks, we must send out a segment which is exactly what is requested. https://bugzilla.gnome.org/show_bug.cgi?id=763262
Thank you for such quick fix and I of course confirm that fix it works.