summaryrefslogtreecommitdiff
path: root/gst/mpegtsdemux/tsdemux.c
diff options
context:
space:
mode:
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>2015-04-09 17:35:55 +0100
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>2015-04-16 13:35:40 +0100
commitcb0eaeadfd4fd7eb78d6c482bd1e2f76060493d8 (patch)
tree27b8b0c0d23079f1ba97d1b1ef79692773961eec /gst/mpegtsdemux/tsdemux.c
parent8ebc715fbff484215cbb2d01c0440c2d6a9709b0 (diff)
downloadgstreamer-plugins-bad-cb0eaeadfd4fd7eb78d6c482bd1e2f76060493d8.tar.gz
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
Diffstat (limited to 'gst/mpegtsdemux/tsdemux.c')
-rw-r--r--gst/mpegtsdemux/tsdemux.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gst/mpegtsdemux/tsdemux.c b/gst/mpegtsdemux/tsdemux.c
index 72e9b4b28..ab9d700c5 100644
--- a/gst/mpegtsdemux/tsdemux.c
+++ b/gst/mpegtsdemux/tsdemux.c
@@ -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 */