Repository navigation
fix(mux): preserve Opus timing in fMP4 exports (backport #7118) - #7273
Conversation
Hang places every decoded Opus sample one pre-skip before its packet timestamp, but the fMP4 exporter dropped every edit list, so an MP4 reader presented Opus one pre-skip late. Rebuild the Opus priming edit when the init is assembled, after the output timescales are settled. Adapted to release's exporter, which has no edit-list import. 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. |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: 598f29e42261449dbaf4f1b8857e2ed908bbf0ed against the release base ffa2ff0edaf16d22504bc81c878abfc8c9d18049.
No actionable bugs found. The production change matches the Opus edit-generation portion of #7118: it converts pre-skip using the output media timescale at final init assembly, after either synthesized or extracted tracks are available. Source edits remain stripped, zero pre-skip produces no edit, and non-Opus behavior is unchanged. The widened arithmetic safely accommodates the input field ranges.
Direction: a narrow exporter-only backport is preferable to pulling the newer importer/edit machinery into this release. The tests inspect the emitted edit directly and cover both init paths, zero/max pre-skip, two timescales and a non-Opus control.
Verification limits: GitHub-only static review with an independent pass. I did not run tests, FFmpeg/player playback or wire-compat measurements; author-reported passes were not reproduced. This review does not establish that every released-reader compatibility cell now passes.
|
Landing as a merge commit into (Written by Claude Opus 5.5) |
Problem
The released
moq export fmp4presents Opus one pre-skip late (6.5 ms at the usual 312 samples) in any MP4 reader. Hang places every decoded Opus sample one pre-skip before its packet timestamp, but the exporter drops every edit list anddOpsalone does not express that presentation shift. moq-dev/moq#7118 fixed this onmain. Onreleaseit also fails the 12 stable wire-compat cells where a current publisher feeds a released Rust reader (moq-dev/moq#7061).Approach
Port the
encode_inithalf of moq-dev/moq#7118. When the init is assembled, after track timescales settle, an Opus track with nonzero pre-skip gets one edit:media_timeis the pre-skip in the output media timescale, and the zero segment duration follows the live convention. This covers both synthesized and source CMAF tracks.extract_initstill drops source edits.It does not cherry-pick:
releasehas no edit-list import (container/fmp4/edit.rs), and its exporter is older. So the comments are rewritten forrelease, and the test asserts the emittedelstdirectly instead of round-tripping throughmain'sEdit. The test covers zero and maximum pre-skip, 48 kHz and microsecond scales, synthesized and source CMAF inits (with the source edit replaced), and a non-Opus track that keeps no edit.release's importer ignores source edits, so areleaseround trip of an FFmpeg Opus MP4 now writes back the same edit it read.Impact
pub(crate)encode_initchanges.moq-muxand its dependents, includingmoq-cli, in its release PR.Alternatives
Waiting for the next cut from
mainwould leave the released exporter wrong and the wire-compat pins stale until then.Validation
cargo test -p moq-mux --lib: 1009 passed, including the two new tests.just ci check origin/releaseandjust ci test origin/release(Nix dev shell): passed.Follow-ups
After this publishes in a patch
moq-cli, moq-dev/moq#7061 reruns the full wire-compat remeasurement. No new quests.(Written by Claude Opus 5.5)
🤖 Generated with Claude Code