Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #5632, where missing AUD units for keyframes causes them to be merged with their preceding frame #5652

Conversation

Thulinma
Copy link
Contributor

This PR will...

Fix issue #5632, where missing AUD units for keyframes causes them to be merged with their preceding frame, rather than forcing two frames.

Are there any points in the code the reviewer needs to double check?

Logic, I guess..? It's a pretty complex case, but I think I covered all edge cases.

Resolves issues:

#5632

Checklist

  • changes have been done against master branch, and PR does not conflict
  • new unit / functional tests have been added (not sure if applicable in this case...?)
  • API or design changes are documented in API.md

src/demux/video/avc-video-parser.ts Outdated Show resolved Hide resolved
break;
// IDR
}
case 5:
push = true;
// handle PES not starting with AUD
// if we have frame data already, that cannot belong to the same frame, so force a push
if (VideoSample && VideoSample.frame) {
Copy link
Collaborator

@robwalch robwalch Jul 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the most part these changes look good. There are however TS streams that hit this case which show decode artifacts after this change. Checking that the frame is not a key frame fixes #5632, while not introducing artifacts into other TS streams (consecutive IDR NAL units) that enter this path.

Suggested change
if (VideoSample && VideoSample.frame) {
if (VideoSample?.frame && !VideoSample.key) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that actually makes sense in the NAL unit type 1 key frame case as well (or at least, shouldn't hurt anything to have), so added it there too.

@Thulinma Thulinma force-pushed the frame_detection_fix_for_occasional_missing_aud branch 2 times, most recently from eaf3c04 to 884c0b3 Compare July 14, 2023 01:35
@robwalch robwalch modified the milestones: 1.4.9, 1.5.0 Jul 14, 2023
@robwalch
Copy link
Collaborator

I have to set the milestone for this to v1.5.0 because it's made against changed in development recently merged with #5634.

If you would like to see this fix sooner in a v1.4.9 patch (comings days vs weeks), please make another PR with these changes against patch/v1.4.x branch.

@robwalch robwalch self-requested a review July 14, 2023 01:52
@robwalch
Copy link
Collaborator

Please run prettier for builds checks to pass

https://github.com/video-dev/hls.js/actions/runs/5549533386/jobs/10133880265?pr=5652

[warn] Code style issues found in the above file. Forgot to run Prettier?
Error: Process completed with exit code 1.

@Thulinma
Copy link
Contributor Author

I have to set the milestone for this to v1.5.0 because it's made against changed in development recently merged with #5634.

If you would like to see this fix sooner in a v1.4.9 patch (comings days vs weeks), please make another PR with these changes against patch/v1.4.x branch.

Done: #5660

(And also ran prettier on both this and that PR)

@robwalch robwalch merged commit fa0a96b into video-dev:master Jul 18, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants