Skip to content

fix(mux): ADTS export refuses what it cannot label - #4283

Merged
kixelated merged 3 commits into
quest/m1/audio-codecs/READMEfrom
quest/m1/audio-codecs/adts-refusals
Sep 27, 2026
Merged

kixelated merged 3 commits into
quest/m1/audio-codecs/READMEfrom
quest/m1/audio-codecs/adts-refusals

Conversation

@kixelated

@kixelated kixelated commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator

Completes the ADTS refusals quest on the audio-codecs line (#4081).

Problem

TS export frames AAC as ADTS and could write a header that names the wrong stream:

  • An explicit HE-AAC (audioObjectType 5) or HE-AACv2 (29) description was masked to ADTS's two profile bits, so both went out labeled AAC Main.
  • A description-less track with a channel count no channelConfiguration names (7, 9+) was written as stereo.

Fix

  • codec::aac::in_band (was in_band_channels) now returns every ADTS header field from the AudioSpecificConfig: the core object type and core sample rate under explicit SBR or PS, plus the channel signaling. Export labels the LC core at its own rate and layout and leaves SBR and PS to implicit signaling, exactly what ffmpeg's ADTS muxer writes.
  • adts::write_header refuses object types outside 1 to 4 instead of masking them.
  • adts::channel_config_from_count refuses unnameable counts instead of defaulting to stereo.
  • The ASC reader is split into read_header / read_core / read_general_audio, so Config::parse keeps accepting a truncated SBR config it already accepted, while in_band needs the core.

One quiet behavior change: with a description, the ADTS sample rate now comes from the description rather than the catalog. They only differ for HE-AAC (catalog output rate vs core rate), where the description is the correct one.

Verification

Real fixtures: GStreamer 1.28 fdkaacenc HE-AAC and HE-AACv2 at 48 kHz stereo, remuxed to FLV by ffmpeg 9.0.1 (3 KB each). The new aac_explicit_sbr_exports_its_lc_core test imports them through the FLV importer (the RTMP path) and checks the first ADTS header: LC, 24 kHz, channelConfiguration 2 (v1) and 1 (v2). Before the fix it read object type 1 (Main).

By hand, on the exported TS:

  • ffprobe reports HE-AAC / HE-AACv2, 48000 Hz, stereo, with every frame present (15 and 16), matching the source.
  • ffmpeg -f null decodes both without errors.
  • ffmpeg -c copy -f adts of our TS is byte-identical to ffmpeg -c copy -f adts of the source FLV.

aac_export_refuses_what_adts_cannot_label covers the description-less refusals (7 channels, profile 5); before the fix both exported silently.

API and wire

  • Public API: none. in_band/InBand are pub(crate).
  • Wire: none. TS output changes only for inputs it mislabeled; those are now either labeled correctly or refused.

Follow-up quests

Added to the audio-codecs line at rank: HE-AAC catalog output (entries name 48 kHz stereo, not the LC core), AAC encode refusals (Config::encode refuses unnameable counts; a dev break), and AAC parse truncated SBR (requires the encode quest).

doc/bin/cli.md gains a paragraph on what TS export does with HE-AAC and unlabelable AAC.

(Written by Opus 5.5)

🤖 Generated with Claude Code

kixelated and others added 3 commits September 26, 2026 12:23
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Explicit HE-AAC and HE-AACv2 descriptions go out as their AAC-LC core at
the core rate and layout, leaving SBR and PS to implicit signaling, as
ffmpeg's ADTS muxer does, instead of being masked to AAC Main. Object
types ADTS has no profile for and channel counts no channelConfiguration
names are refused rather than mislabeled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review September 26, 2026 20:13
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-26T20:17:05.897691Z 5ad6aa1 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@kixelated

Copy link
Copy Markdown
Collaborator Author

Decisions

  • Keep all five decisions as proposed.
  • The three follow-up quests are accepted: HE-AAC catalog output, AAC encode refusals, and AAC parse truncated SBR.

(Written by Opus 5.5)

@kixelated

Copy link
Copy Markdown
Collaborator Author

The decisions kept, by name:

  • Stays on the audio-codecs line toward main, since nothing published changes.
  • The object-type refusal fires in write_header (first frame), next to the existing channel and rate checks.
  • HE-AAC with no description is refused rather than guessed.
  • Config::parse stays lenient for truncated SBR configs in this PR.
  • The fixtures live under container/ts/test_data.

(Written by Opus 5.5)

@kixelated

Copy link
Copy Markdown
Collaborator Author

Ready to land: CI green (Check, Test, Android), Codex review finished with no findings, and the five maintainer decisions above are applied. No changes pushed during landing.

(Written by Claude Opus 5.5)

@kixelated
kixelated merged commit 42582a8 into quest/m1/audio-codecs/README Sep 27, 2026
4 checks passed
@kixelated
kixelated deleted the quest/m1/audio-codecs/adts-refusals branch September 27, 2026 01:10
kixelated added a commit that referenced this pull request Sep 27, 2026
Align the line's Quests list with #4283 and drop the completed ADTS refusals link.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant