Skip to content

mpegpsdemux: Rework the mpeg ps demux seek system.

Copied from https://gitlab.freedesktop.org//gstreamer/gst-plugins-bad/-/merge_requests/2163

In a first attempt, I introduced a way to seek into the stream to search for a video keyframe which could help to avoid glitches and missing frames. Indeed the search is now performed to the first keyframe before the search TS. Then I reworked the way we were searching for the first TS closed to the seek position.

Indeed the SCR was used to determine the position to jump into. But the SCR is a clock reference and does not reflect the stream position for the given time position we'd like to find.

That's why I changed the behavior to search for the DTS instead of SCR. DTS is safer to search as its linear (B-Frames friendly) and reflect more or less the right position we'd like to jump to, modulo the first DTS which is never 0.

Then we setup the new segment according to the first PTS plus de the seek position to tell what should be decoded or not.

So now the SCR is used to know if the clock skews and if we should adapt a little bit the PTS/DTS found into the stream.

Merge request reports