tsdemux: fix segment position tracking for the general case

Different streams can have different PTS/DTS bases, and some
streams may not even have DTS.

https://bugzilla.gnome.org/show_bug.cgi?id=745102
This commit is contained in:
Vincent Penquerc'h 2015-04-09 17:35:55 +01:00
parent 8ebc715fbf
commit cb0eaeadfd

View file

@ -2221,7 +2221,11 @@ gst_ts_demux_push_pending_data (GstTSDemux * demux, TSDemuxStream * stream)
stream->discont = FALSE;
if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DTS (buffer)))
demux->segment.position = GST_BUFFER_DTS (buffer);
demux->segment.position = GST_BUFFER_DTS (buffer) - stream->first_dts;
else if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_PTS (buffer)))
demux->segment.position = GST_BUFFER_PTS (buffer) - stream->first_dts;
if (demux->segment.position < 0)
demux->segment.position = 0;
res = gst_pad_push (stream->pad, buffer);
/* Record that a buffer was pushed */