fix(mux): parse the AAC program config element instead of guessing stereo - #4093
Conversation
…ereo A channelConfiguration of 0 now takes its count from the PCE, in the AudioSpecificConfig or leading the first ADTS raw data block; reserved configurations are refused and 11 to 14 map to their real counts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 696adeb995
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| #[error("reserved channelConfiguration: {0}")] | ||
| ReservedChannelConfig(u8), |
There was a problem hiding this comment.
Document the new public error variants
Add one-line rustdoc comments to all five new Error variants. The #[error(...)] attributes only implement Display and do not appear as API documentation, so these newly exported symbols violate the repository's public API documentation requirement.
AGENTS.md reference: AGENTS.md:L67-L67
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in the latest push: each new variant now has a one-line doc comment.
(Written by Claude Opus 5.5)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Pushed a quest-only commit to this branch as part of the spawn-quests follow-up planning (see #4105), so the follow-up rides with the PR that surfaced it. No code changes. (Written by Claude Opus 5.5) |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Landed. Before merging:
#4090 targets the same line and resolves the (Written by Claude Opus 5.5) |
Problem
An AAC
channelConfigurationof 0 means a program config element (PCE) describes the channels. Both the AudioSpecificConfig parser and the ADTS (MPEG-TS) importer inmoq-muxmapped 0, and every value from 8 to 15, to stereo with a warning. ffmpeg picks a PCE for any layout outside the standard table (quad, for example), so its 4-channel stream was advertised as stereo, and the synthesized description told decoders the same thing.Approach
aac::Config::parse: config 0 walks the GASpecificConfig into the PCE and counts front, side, and back elements (2 per channel pair element, 1 per single channel element) plus LFEs. Explicit SBR/PS configs (AOT 5/29) are followed through to their core type. A non-general-audio object type with config 0 (for example ALS) is refused.ff_mpeg4audio_channels). 8, 9, 10, and 15 are reserved and refused.aac::in_band_config. With config 0, it moves the PCE that leads the first raw data block into the AudioSpecificConfig, redoing the PCE's byte alignment, and then parses that config back withaac::config. The catalog count and the description therefore come from one parser. On the ffmpeg fixture, the result matches ffmpeg's own MP4 extradata byte for byte, apart from ffmpeg's trailing sync extension.aac_quad.ts, 2.6 KB) and ffmpeg's quad ASC report 4 channels (both reported 2 before this change). The tests also cover synthesized 5.1 and 3/2/2 PCEs, a PCE behind explicit SBR, empty and truncated PCEs, a non-GA AOT, an ADTS block without a leading PCE, and every config value from 1 to 15.Impact
moq_mux::codec::aac::ErrorgainsReservedChannelConfig,ProgramConfigUnsupported,ProgramConfigMissing,ProgramConfigTruncated, andProgramConfigEmpty. The enum is#[non_exhaustive], so this is additive.Config::parse, and every importer built on it (MKV, FLV, MSF,import::Track, TS), now reports a PCE's real count and refuses reserved configs instead of reporting stereo.Alternatives
pcefield to the publicaac::Configsoencode()can reproduce it. That breaks the published struct literal, and the crate-privatein_band_configcovers the only caller that needs it. Not done.Error::Unsupported. I used typed variants following the existingUnsupportedSampleRateIndex(u8)so callers can match on the reason. A singleUnsupported(String)is the alternative.Follow-ups
aac::Config::encode(andjs/hang'saudioSpecificConfig) still warn and write stereo for a count the table can't name. Making them fail needs a fallible signature, which is adevbreak.Layoutyet. That belongs to the Layout quest.he-aac-refusal.mdloses its Related link here, and chore(quest): abandon he-aac-refusal #4090 deletes that file. Whichever merges second resolves a trivial modify/delete conflict.🤖 Generated with Claude Code
(Written by Claude Opus 5.5)