tsdemux: fix buffer timestamp not being in stream time
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Wed, 6 May 2015 14:17:24 +0000 (15:17 +0100)
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Fri, 15 May 2015 13:50:35 +0000 (14:50 +0100)
Timestamps should start at the segment start, rather than 0, so
we need to not subtract the first timestamp. This makes the sink
correctly account for running time when switching PMTs where a
stream starts not quite at zero, causing timing offsets that can
become noticeable and causing dropped frames after a few times.

gst/mpegtsdemux/tsdemux.c

index 4f05672..52ed207 100644 (file)
@@ -2245,9 +2245,9 @@ 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) - stream->first_dts;
+    demux->segment.position = GST_BUFFER_DTS (buffer);
   else if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_PTS (buffer)))
-    demux->segment.position = GST_BUFFER_PTS (buffer) - stream->first_dts;
+    demux->segment.position = GST_BUFFER_PTS (buffer);
 
   res = gst_pad_push (stream->pad, buffer);
   /* Record that a buffer was pushed */