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
This commit is contained in:
Vincent Penquerc'h 2015-03-09 09:56:38 +00:00
parent fe9a87d563
commit fc2460b331

View file

@ -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;