mpegpsdemux: take into account SCR offset when seeking

Since the seeking byte offset is chosen by linear interpolation
from SCR values, we need to take that first SCR into account
to end up near the correct offset. Otherwise, as the code does
a linear search after that first seek, it will take a LOOOOOONG
time to get there for streams which don't start at zero.

https://bugzilla.gnome.org/show_bug.cgi?id=659485
This commit is contained in:
Vincent Penquerc'h 2011-09-21 14:53:01 +01:00 committed by Tim-Philipp Müller
parent 49d1121101
commit 46dd7941f3

View file

@ -1042,8 +1042,9 @@ gst_flups_demux_do_seek (GstFluPSDemux * demux, GstSegment * seeksegment)
GST_INFO_OBJECT (demux, "sink segment configured %" GST_SEGMENT_FORMAT
", trying to go at SCR: %" G_GUINT64_FORMAT, &demux->sink_segment, scr);
offset = MIN (gst_util_uint64_scale (scr, scr_rate_n, scr_rate_d),
demux->sink_segment.stop);
offset =
MIN (gst_util_uint64_scale (scr - demux->first_scr, scr_rate_n,
scr_rate_d), demux->sink_segment.stop);
found = gst_flups_demux_scan_forward_ts (demux, &offset, SCAN_SCR, &fscr);
if (!found) {