Repository navigation
Conversation
This branch has not been deployed
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...
Keep collecting the bytes of an AAC (ADTS) frame when it continues through a PES that is too short to finish it, instead of pushing the half-filled frame and dropping the rest.
Why is this Pull Request needed?
When an ADTS frame is cut off at the end of a PES,
parseAACPESstores the partly filled sample inaacOverFlowand fills in the missing bytes from the next PES. It assumes the next PES holds all of them. If the next PES is shorter thanaacOverFlow.missing(audio repacked into small PES, as in the report),data.subarray(0, missing)is shorter than expected. The sample is pushed with a zero-filled tail,startOffsetends up past the end of the data, the overflow is cleared, and the PES after that no longer starts at an ADTS header. That givesAAC PES did not start with ADTS header,offset:Nand, after the retries, a fatalfragParsingError.Now, when the PES is shorter than the missing byte count, all of its bytes are copied into the pending sample,
missingis reduced by that amount, and parsing continues with the next PES.Are there any points in the code the reviewer needs to double check?
Only the early return in the
elsebranch ofparseAACPES. The case where the PES is exactly as long asmissingstill takes the old path.Resolves issues:
Resolves #8197
I did not run the attached repro stream in a browser. The new unit test builds a TS segment with the same shape (a frame that starts in one PES, fills a second PES and ends in a third).
Verified locally:
npm run test:unit(Chrome headless): 1284 passed. With thesrcchange reverted, the new test fails with afragParsingError; with it, it passes.npm run type-check,eslintandprettier --checkon the two changed files: clean.npm run build,npm run docs,npm run test:func.I used an AI assistant (Claude Code) while working on this; I reviewed and tested the change.
Checklist