tsdemux: Handle "negative" timestamps
authorEdward Hervey <edward@centricular.com>
Sun, 5 Sep 2021 09:57:18 +0000 (11:57 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 18 Oct 2021 11:23:25 +0000 (11:23 +0000)
commit0ff569d408c13e4e9657ba62b6b6bd490129462e
tree31ec8db76dbeff5688e26778ab17918c8299e294
parent74e9d44db3b3f8be1730051eed39005c649055ee
tsdemux: Handle "negative" timestamps

This is only enabled in push time mode. Furthermore it's only enabled for now if
PCR is to be ignored.

The problem is dealing with streams where the initial PTS/DTS observation might
be greater than following ones (from other PID for example). Before this patch,
this would result in sending buffers without any timestamp which would cause a
wide variety of issues.

Instead, pad segment and buffer timestamps with an extra
value (packetizer->extra_shift, default to 2s), to ensure that we can get valid
timestamps on outgoing buffers (even if that means they are before the segment
start).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1179>
subprojects/gst-plugins-bad/gst/mpegtsdemux/mpegtspacketizer.c
subprojects/gst-plugins-bad/gst/mpegtsdemux/mpegtspacketizer.h
subprojects/gst-plugins-bad/gst/mpegtsdemux/tsdemux.c