ReviewOS

also looking at this

home-lang/home

feat(audio): add verified AAC-LC encoding and reject invalid prototype output

#918
Merged chris wants to merge feat/aac-mp4-recording into main
10 files +318 -471
8 days ago

Home's two AAC prototypes produced non-AAC envelope or fixed-width spectral bytes. Add an opt-in, header-checked native AAC-LC encoder around the standalone FDK library and make the legacy entry points reject encoding explicitly. Export NativeAacEncoder from the audio package and fix partial-allocation cleanup in the older wrapper.

The new adapter accepts bounded S16LE PCM blocks, reports partial consumption, exposes raw AAC access units plus the actual AudioSpecificConfig/frame size/codec delay, and supports delayed drain with explicit ownership and poisoned error states. It uses fixed buffers and no subprocess, FFmpeg or Libav. FDK is an optional separately licensed dependency, following the existing native video codec adapter pattern; it is not presented as a pure Zig AAC implementation.

Validation: five legacy/configuration/allocation tests plus the native partial-input/drain/state test pass on Zig 0.15.2 and Home's development toolchain. Targeted pickier passes. Dedicated x86/ARM CI builds pinned standalone FDK 2.0.3 and checks the C boundary with -Wall -Wextra -Werror. Camera integration independently decodes with FAAD2 and tests PCM waveforms and MP4 priming/tail/offset/split timelines. No physical hardware performance claim is made. See packages/audio/NATIVE_AAC.md.

10 changed files on the files tab, with 0 review threads.

Sign in to comment on this pull request.