fix: set HEVC sync samples from IRAP VCL NALs - #7861
Merged
Conversation
robwalch
approved these changes
May 20, 2026
Collaborator
|
cc @devoldemar |
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.
This PR will...
Fix a HEVC fMP4 sync sample regression introduced by #7854, where parameter-set NALs could mark samples as keyframes.
A HEVC sample is now marked as sync only when its access unit contains an IRAP VCL picture, such as BLA, IDR, or CRA.
Test stream:
Why is this Pull Request needed?
Some HEVC TS streams place parameter sets before regular non-IRAP pictures:
This issue was introduced by #7854. After access-unit boundary handling groups those prefix NALs with the following picture, the old SPS path could still mark the sample as key:
That can produce an invalid fMP4 sync sample:
TRAILis not a random access picture. On Chrome/macOS, VideoToolbox may fail decoding when such a sample is incorrectly marked as sync:Real IRAP pictures remain sync samples:
Are there any points in the code the reviewer needs to double check?
Please check the HEVC sync-sample rule:
Also note that
VideoSample.key = trueis still needed in IRAP branches because a sample may already have been opened by prefix NALs before the IRAP VCL NAL is parsed.Resolves issues:
N/A
Checklist
Validation performed:
npm run build:debugnpx prettier --check src/demux/video/hevc-video-parser.tsgit diff --check