Repository navigation
feat(moq-mux): only a padded TS export waits for the mux rate - #8829
Conversation
Quest-Claim: 7c7a1b9d77321959
…nd only an export that may pad waits for the mux rate Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 3 minutes. View limit details
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. |
There was a problem hiding this comment.
ℹ️ No blocking issues — one timer race worth closing inline.
Reviewed changes
Initial review of moving the two-second mux-rate wait from the TS import (which held the catalog from every subscriber) to the TS export (only exports that have no with_mux_rate override wait).
- Import publishes at once —
Importdrops the mux-rate reservation, the 4 s media bound, and the re-arm on a clock break.muxRatenow arrives as a catalog update once a PCR window measures a constant rate, andtimebase_breakroutes throughreset_mux_rate. - Export-side wait —
prepareholds the newest snapshot inheld_catalog.awaiting_rateholds backupdate_catalog, and so the track subscriptions, until the rate arrives ormux_rate::WAIT(2 s) runs out. The hold applies only when the program has no override, PSI, or tracks yet and the snapshot's non-emptympegtssection records no rate. Replacements inheritrate_wait. - Tests — three new sim-clock export tests via
Joined, withopen_tsopting out throughwithout_rate_wait. The import test now checks that the rate arrives as an update, five hold tests are removed, and the moq-srt SCTE-35 egress test gets the extra window. - Docs — the
doc/bin/ts.mdSemantic bullet, themoq-muxchangelog, and thets-republishquest text now describe the new behavior.
claude-opus-5-5 | 𝕏
An elapsed rate wait ends on the sleep's own result, so it never holds without a waker. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found. The fix for the timer race is correct.
Reviewed changes
This review covers the changes since the review of 7c3457b: a fix in export.rs and a merge of main.
- The rate wait can no longer stall —
awaiting_ratenow checks whatwaiter.poll_futurereturns for therate_timersleep. If the sleep is alreadyReady, it clears the timer and ends the wait. Before, an elapsed deadline could leave the export with no waker. Thenow() >= untilcheck stays as a cheap early exit. - Merged
main—mainchanged the same lines as this PR's edits to thets-republishquest and theRepublish::instancedoc comment, so those edits are no longer part of the diff. The onlypublish.rschange left is the comment wording ina_clock_step_republishes_under_a_new_instance.
claude-opus-5-5 | 𝕏
…he mux-rate hold Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the delta since f5b27e8.
- Test comments corrected —
a_switch_before_the_first_catalog_republishesinrepublish.rsno longer cites the removed mux-rate hold. Its comments now describe a step in the same chunk as the first media. No code behavior changed.
claude-sonnet-5-5 | 𝕏

Finishes quest/m1/ts-mux-rate-hold.md (deleted here).
Summary
mpegts.muxRatefollows as a catalog update once a 2 s PCR window measures it. A variable-rate source never records one. Removed fromImport: the mux-rate reservation, the 4 s media bound, the re-arm on a clock break, andMeter::ready; theUNMEASUREDconstant becomes the export'sWAIT.with_mux_rateoverride waits up to one window (2 s,mux_rate::WAIT) for the rate when its first catalog snapshot comes from a TS import (non-emptympegtssection) and records none. It holds that snapshot and subscribes the tracks only when the rate arrives or the window runs out, so it joins the media as it is then, not on frames that went stale during the wait. A rate that arrives after the wait still takes over from the next slot, as before.doc/bin/ts.md), themoq-muxchangelog follow.Public API and wire
Public API: none. Behavior: a TS import's first catalog no longer carries
muxRatefor a source that has not measured one; an export joining in that first window waits up to 2 s for it. Wire:muxRatemay arrive in a later catalog update than the first, which the draft already allows (it is optional and "present only while the source holds a constant rate").Choices a review can undo
WAITis 2 s from the export's first snapshot. An export joining at the very start can race the update, and then starts unpadded and pads from the next slot once the rate arrives (the schedule already takes a mid-stream rate). Recommendation: keep; a slack would cost every variable-rate export more.mpegtssection, nomuxRate, and no override". The catalog cannot say whether a source is variable-rate or still measuring, so a variable-rate TS source costs every export that joins it one wait, including late joiners. The quest's "only an export joining in the first window pays" holds for constant-rate sources only. Recommendation: accept; a "measured, none" marker would be a wire change, so it is not here. Say if you want it as a follow-up quest.Export::without_rate_waitused byopen_ts, so ~45 existing export/recovery/revision tests (which export TS-imported catalogs with no rate on a simulated clock) keep their timelines. Three new tests cover the wait itself.publisher_preserves_scte35_cues: its egress now waits one window on a source that records no rate, so the test's latency goes 3 s to 5 s and its read timeout 5 s to 10 s.first_ts_catalog_gains_the_mux_rate_as_an_updateandprivate_pes_only_program_publishes_its_pes_clock_with_the_first_mediareplace the first catalog tests.Validation
just checkpasses (5987 Rust tests among them).export_waits_for_the_rate_a_window_is_measuring(a join 0.4 s into a 400 kb/s CBR source starts output at 2.2 s and pads; with an override the same join starts at 185 ms),export_stops_waiting_for_a_rate_that_never_comes(a VBR source: first output at 3.3 s, unpadded),export_with_a_rate_override_does_not_wait, andfirst_ts_catalog_gains_the_mux_rate_as_an_updateon the import side.moq-cliintegration tests (moq import tsagainst a test relay), which pass.Caused by
Follow-ups
None.
Models
Size: S
Implementer: Claude Code, claude-sonnet-5-5, high effort (iterate, S, arm B)
Review
Rewritten by
quest reviewafter each round.Head: c40404b
Base: origin/main at 5b4c01b
Risk: medium,
the base has no RISK.md to name what is always high or customer-facing, so every change is mediumClassified: medium by default
Reviewer: Codex, gpt-6.1-sol, medium effort
Session:
01a1dfab-2e10-7aa2-b969-8a2501d91138, round 3Score: 10/10,
The incremental diff only corrects test comments to describe the current behavior and introduces no actionable defects; builds and tests were not run as instructed.Rounds: 3; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none