fix(moq-mux): strip edit lists from the CMAF init#2383
Conversation
The fMP4 exporter copied each source track's edit list (edts/elst) into the merged CMAF/HLS init. Edit lists are redundant in CMAF -- timing is carried by tfdt and per-sample composition offsets -- and browsers mishandle them: an empty-edit media_time gets applied as a real offset and shifts the track off the others, leaving the video source buffer empty (a black screen) while audio plays. Drop the edit list in extract_init so the init never carries one. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Sorry @kixelated, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughCMAF init extraction now removes each track’s 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
The fMP4 exporter copies each source track's edit list (
edts/elst) straight into the merged CMAF/HLS init (extract_init). Edit lists are redundant in CMAF -- timing is carried bytfdtand per-sample composition offsets -- and browsers apply them, so a source's initial empty edit (media_time = -1) becomes a real presentation offset.In practice this showed up as a black screen on VOD/HLS playback in the browser: the applied edit shifted the video track off the audio track's timeline (here by ~2 days, because the empty edit's
-1was being mis-encoded to+2^32-1upstream), so Media Source Extensions left the video source buffer empty at the playhead while audio played fine. Even with a correctly-encoded-1, an edit list in a fragmented CMAF init is an interop hazard best avoided.Fix
Drop the edit list in
extract_initso the CMAF/HLS init never carries one:This is the only place a source
edtsenters the output (the synthesized-trak paths don't add one).Test
extract_init_strips_edit_listsbuilds a source moov whose trak carries anedts/elst, runs it throughextract_init, and asserts the resulting trak has noedts. Fullmoq-muxsuite green.Note
Blanket-stripping also drops any non-empty trim edit (
media_time > 0, used to trim encoder-priming samples). For such sources the first few priming samples would play instead of being trimmed -- a minor start-of-clip artifact, never a black screen. If preserving real trims matters, this could be gated to empty edits only.🤖 Generated with Claude Code