Repository navigation
Keep AAC frames that span more than two PES - #8210
Open
andretorresdg wants to merge 1 commit into
Open
andretorresdg wants to merge 1 commit into
andretorresdg wants to merge 1 commit into
Conversation
When an ADTS frame overflowed a PES, parseAACPES assumed the next PES held the rest of it. If the frame also spanned that PES (small PES repacked by broadcast muxers), the incomplete frame was pushed, the overflow state was dropped, and the following PES raised "AAC PES did not start with ADTS header" parsing errors. Keep the overflow pending until a PES completes the frame. Fixes video-dev#8197
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 an incomplete ADTS frame pending in
TSDemuxer.parseAACPESuntil a later PES completes it, instead of assuming the next PES always holds the rest of the frame.Why is this Pull Request needed?
When an ADTS frame overflows a PES,
parseAACPESstores it inaacOverFlowwith the number of missing bytes. On the next PES it copiesdata.subarray(0, missing)into the frame, pushes the sample and starts scanning atmissing. If the next PES is shorter thanmissing(the frame spans three or more PES, e.g. 320 kb/s AAC repacked into 720-byte PES as in #8197):AAC PES did not start with ADTS header, and the retries eventually end in a fatalfragParsingError.With this change, when the PES carries fewer bytes than the frame is missing, they are copied into the frame,
missingis reduced and the overflow is kept for the next PES. The existing path (frame completed by the next PES) is unchanged.Are there any points in the code the reviewer needs to double check?
parseAACPES(skipping PES without ADTS headers). This change is independent: it covers frames that are split across more than two PES, which are valid streams.Resolves issues:
Fixes #8197
Checklist
How I tested
tests/unit/demuxer/tsdemuxer.tsthat feeds a 2000-byte ADTS frame followed by a 100-byte frame toparseAACPESas three 720-byte PES. It checks that no error is emitted and that both samples have the full payload and contiguous PTS. It fails on master (AAC PES did not start with ADTS header/No ADTS header found in AAC PES) and passes with the fix.e2e/cmcdone, which times out in my sandbox without network): 1266 passing.eslintandprettier --checkon the changed files, andnpm run type-check.