forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits

mp4alac.report.md3.2 KiBHistoryRawDownload

Lane mp4alac: ec-mp4 mux sample entries (av01, ac-3, Opus, alac)

Base: 654717d7 (main), branch lane/mp4alac, worktree ~/.cache/wt/mp4alac.

Goal

DONE.md ec-mp4 criterion: the mux writes sample entries av01, ac-3, Opus (with dOps) and alac, and each one is proven by ffprobe and ffmpeg. The gateaudit found mux_entries.rs but did not confirm the alac entry.

Findings

Code paths (crates/ec-mp4/src/mux.rs):

Entry Config box Where written Evidence
av01 av1C video_entry (l.731) and config_box (l.742), sample entry at l.748 mux_entries.rs case av01
ac-3 dac3 audio_entry (l.930) and audio_config_box (l.949) case ac3
Opus dOps dops() (l.959) converts OpusHead to dOps; audio_config_box (l.953) case opus, plus opus_pre_skip_is_written_without_a_caller_asking
alac alac box holding the cookie l.867-870: a cookie that already has its alac header is written as-is, a bare cookie is wrapped case alac, plus alac_bare_cookie_is_written_inside_an_alac_box

No code change was needed. mux_entries.rs (555 lines, pre-existing on main) already has one case per entry. Each case muxes an ffmpeg-made source and checks three things:

  1. ffprobe reads our file with empty stderr, and its codec name, channels, sample rate and duration match the source's.
  2. ffmpeg decodes our file to the same MD5 of samples as the source. The packets are identical, so this shows our file decodes in ffmpeg.
  3. Our demuxer reads back the same stream count, packet count, pts, dts, duration, keyframe flags and bytes.

Demux side (point 3 of the brief): crates/ec-mp4/src/demux.rs:1245-1252 maps alac to the ALAC codec and hands the cookie over as extradata. The test alac_bare_cookie_is_written_inside_an_alac_box asserts extradata[4..8] == b"alac", so the cookie comes back with its box header. It then checks that a round trip through the muxer keeps the same extradata, and that ffprobe reports alac with empty stderr.

Verify

Run on host c (scripts/remote-run.sh mp4alac --host auto). ffmpeg from /usr/bin with encoders libaom-av1, aac, ac3, alac, libopus present, so no case skipped.

cargo test --release -p ec-mp4 --test mux_entries -- --test-threads=4
  10 passed; 0 failed   (avc1, hvc1, av01, mp4a, ac3, ec3, alac, opus, plus the two extra alac/opus tests)

cargo test --release -p ec-mp4
  all binaries ok: 26, 2, 2, 1, 16 (1 ignored: mp4.rs:805 "reads the real library end to end"), 10, 3, 0 passed; 0 failed

cargo clippy -p ec-mp4 --all-targets -- -D warnings
  exit 0

Source size: the largest ec-mp4 file is src/demux.rs at 1,769 lines, under the 5,000 limit.

Fixtures are generated by ffmpeg at test time (lavfi sine and testsrc2), so no media was downloaded and no external vectors were used.

Verdict

  • av01 (with av1C): MET
  • ac-3 (with dac3): MET
  • Opus (with dOps): MET
  • alac (with the alac cookie box): MET

Demux of an ffmpeg-made alac m4a returning the cookie as codec private data: MET (alac_bare_cookie_is_written_inside_an_alac_box).

Left

Nothing for this criterion. The ignored real-library test in mp4.rs:805 is outside this lane's scope.