Repository navigation
fix(moq-mux): importers publish the catalog at their first frame - #4885
Conversation
fMP4, MKV, and MPEG-TS imports held their initial reservation only until the init segment (moov, Tracks, first PMT), so the catalog first published on a provisional clock and re-anchored at the first frame. Copy-once readers such as moq-hls export's EXT-X-PROGRAM-DATE-TIME kept the stale clock. Hold the reservation until the first frame anchors, as FLV already did, and release it on finish() or an init with no tracks. fMP4 detects a duplicate moov from the parsed moov rather than the released reservation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Status: this was resumed from an interrupted run and rebased onto Open question: should a program with only section-framed streams (no PES) anchor on its PCR? Right now it publishes only at (Written by Claude Opus 5.5) |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (21)
💤 Files with no reviewable changes (3)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review. WalkthroughContainer importers now withhold catalog publication until a media frame anchors the clock. They release the reservation after anchoring, or during finish if no frame arrives. Tests cover publication timing for FLV, fMP4, MKV, and MPEG-TS, plus playlist timestamp mapping and MPEG-TS fixtures. Documentation and quest records now describe the updated timing. Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The catalog timing change has no identified merge-blocking issue. Merge after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change improves clock consistency, and the reviewed paths do not establish a new security defect. Some uncertainty remains around interrupted imports and failure recovery when several inputs share one broadcast. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 78.95% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 38 functions across 13 files. (5 skipped: 5 unsupported.)
✨ 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 |
…88434181ba3 # Conflicts: # doc/setup/upgrade.md
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: 595eac1
No actionable correctness findings in the full 21-file diff and catalog/TS reservation context. The direction addresses the copy-once clock bug: fMP4 (rs/moq-mux/src/container/fmp4/import.rs:916-924), MKV (rs/moq-mux/src/container/mkv/import.rs:434-442), and TS (rs/moq-mux/src/container/ts/import.rs:740-747) anchor before releasing the initial catalog hold. Duplicate-moov detection is appropriately independent of reservation lifetime, and the tests inspect actual published snapshots, including the HLS consumer. The section-only TS program's finish-time publication and an importer joining an already-published catalog remain explicit scope limitations, already discussed, rather than new findings.
Verification limits: static review only; I did not run builds or tests or reproduce the reported negative controls. GitHub currently reports merge conflicts; this is not confirmation of merge readiness.
…of panicking Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated
left a comment
There was a problem hiding this comment.
Review of the PR diff after merging origin/main (#4883, #4894). This is an adversarial Codex review plus a manual read, posted because CodeRabbit is rate limited.
Merge: one conflict, in doc/setup/upgrade.md under Unreleased. Both entries are kept: this PR's "importers publish the catalog at their first frame" and #4883's "fMP4 export fixes its track set at the init segment". doc/lib/rs/moq-mux.md and doc/bin/cli.md merged cleanly.
Findings
- Codex [high]: TS programs that never carry a PES PTS hold their catalog until
finish(). This covers section-only programs, which match the accepted decision in the description, and verbatim private PES with no PTS, which is the same case: nothing in the program anchors the clock. On a live SRT ingest, such a program's catalog never publishes before EOF. BecauseProgram::Allgives each program its own broadcast, other programs are not blocked. Handling: kept as the accepted decision, and the description now names the PTS-less verbatim case too. If a real stream needs it, the cheapest follow-up is to release the reservation at a PMT that declares no PES stream, since nothing can anchor there and the provisional clock is final. - Manual:
finish()followed by a moov panicked.initcalled.expect()on the initial reservation, butfinish()now drops it. Onmain, the same call sequence returned an error instead. Fixed in 3b8ad8d:inituses a freshcatalog.reserve()when the initial one is gone. The regression testa_moov_after_finish_publishespanics without the fix.
Nothing else came up. The release points are right in each importer: they anchor before they drop the reservation, a declaration with no tracks releases right away, and finish() releases on every importer. For the duplicate-moov check, self.moov replaces the reservation as the signal.
Checks: just check passes. just test interop --all passes 32/32.
(Written by Claude Opus 5.5)
Automated review: head
|
Completes the
quest/m1/import-first-framequest.Summary
The fMP4, MKV, and MPEG-TS importers now hold their initial catalog reservation until the first frame anchors the clock. FLV already did this. Before, they published the catalog at the init segment (
moov,Tracks, or the first PMT) on a provisional clock and re-anchored it at the first frame. Readers that copy the clock once, such as moq-hls export'sEXT-X-PROGRAM-DATE-TIME, kept the stale value.moovis now detected from the parsedmoov, not from the reservation being gone.finish()releases the reservation, so input with no frames still publishes its declared tracks. An init that declares no track releases it right away.Reservedfrom the catalog, so a stream added before the first PES joins the initial snapshot.The quest is deleted, and its references in other quests are updated.
Tests
Each one fails on
mainexcept the FLV guard:fmp4,mkv,flvfirst_catalog_carries_the_anchored_clock: nothing publishes at the init, and every snapshot carries the anchored clock. The FLV test passes onmainand guards against regressions.ts::import_test::opus_catalog_carries_the_anchored_clock: an Opus-only stream an hour into its PTS.ts::import::test::verbatim_only_program_publishes_at_the_first_pesfmp4::import_test::a_second_moov_is_refusedanda_moov_with_nothing_selected_publishesfmp4::import_test::a_moov_after_finish_publishes: a moov decoded afterfinish()released the reservation declares its tracks on a fresh reservation instead of panicking.moq-hlsfmp4_import_times_playlists_by_the_anchored_clock: end to end. The viewer watches before the first fragment, andEXT-X-PROGRAM-DATE-TIMEmatches the anchored clock.moq-srtmulti-program tests fed PSI only. They now add a PES per program, since a PMT alone no longer publishes.just checkpasses.Public API / wire
doc/setup/upgrade.mdunder Unreleased.Decisions
finish()until a real stream needs otherwise. This was not seen in practice. A program whose only PES streams are verbatim private data carrying no PTS behaves the same way, since nothing in it anchors the clock.Follow-ups
🤖 Generated with Claude Code
(Written by Claude Opus 5.5)