demux_mkv: don't apply AVI b-frame delay compensation to VfW tracks#18091
Merged
Conversation
crazy_video_pts_stuff() shifts video PTS back by the codec delay to undo libavcodec returning frames paired with a later packet's DTS. This is only correct for genuine AVI, where DTS are decode-order frame indices. VfW-muxed Matroska looks similar but its block timestamps are real DTS, already offset by the reorder delay, so the libavcodec shift cancels the offset and no compensation is needed. Applying it anyway pushed video one frame ahead of audio (e.g. VC-1, whose Advanced Profile always reports has_b_frames=1). Split the `avi_dts` flag. Deep DTS routing for VfW mkv via a new `block_dts`, and reserve avi_dts for genuine AVI only. Note that demux_lavf for Matroska was already not affected, because `avi_dts` wouldn't be set for those. Fixes mpv-player#18089
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
crazy_video_pts_stuff() shifts video PTS back by the codec delay to undo libavcodec returning frames paired with a later packet's DTS. This is only correct for genuine AVI, where DTS are decode-order frame indices.
VfW-muxed Matroska looks similar but its block timestamps are real DTS, already offset by the reorder delay, so the libavcodec shift cancels the offset and no compensation is needed. Applying it anyway pushed video one frame ahead of audio (e.g. VC-1, whose Advanced Profile always reports has_b_frames=1).
Split the
avi_dtsflag. Deep DTS routing for VfW mkv via a newblock_dts, and reserve avi_dts for genuine AVI only.Note that demux_lavf for Matroska was already not affected, because
avi_dtswouldn't be set for those.Fixes #18089