Skip to content

demux: mkv: shift the timestamps based on the biggest CodecDelay

Steve Lhomme requested to merge robUx4/vlc:mkv-opus-start into master

The CodecDelay needs to be substracted from the PTS of all frames of that track. That may result in negative DTS, PTS and PCR which is not well handled. So we just shift all timestamps based on the biggest CodecDelay so all timestamps are always positive.

This is in line with how libavformat reports the timestamps on frames from a track with a CodecDelay.

This is done per segment as other segments may use a different CodecDelay per track.

Only Opus tracks have CodecDelay, so most of the time no shifting will happen.

Successive remuxing will result in added PCR shift (but the muxer can remove the offset). As long as VLC_TICK_INVALID is 0 we can't really handle negative timestamps correctly.

Ref. #25129 (closed)

Merge request reports

Loading