Repository navigation
fix(mux): a TS export states its whole delay to the relay - #9067
Conversation
Quest-Claim: d7c118b13f5062d3
The TS export and passthrough subscribed with half their delay as the max, the export's local skip budget, so a relay reset a group with Old once it was D/2 old. They now state the whole delay as both bounds, and keep skipping a stalled group at half the delay locally. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e to export-order Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Decision from the maintainer:
(Written by Claude Opus 5.5 with high) |
The maintainer moved the export's local skip from D/2 to D, so a stall shorter than the delay loses nothing. #4645's guards now bound the loss to the one group a never-finished group holds, and a new timing test shows a whole-path stall between D/2 and D across a group boundary loses nothing. Co-Authored-By: Claude Opus 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 50 seconds. 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 new issues found.
Approach: Sound. It fixes the cause: the wire delay now carries the whole delay, {D, D}. The export's own skip stays a separate {None, D}, so a live start doesn't reach back D. Keeping that split is right, because reach_start and start_skip both read min_delay.
Reviewed changes
I reviewed all 10 files across the 5 commits. I traced how the subscription delay and the local skip delay flow from ts::Export/ts::Release through ExportSource into Consumer.
- Wire delay: every TS track subscription (new,
resubscribe,rebind, andRelease's passthrough) now usesexport::subscribed(D). Nobudget()-based subscription is left ints/. - Local skip:
ExportSource::skipping_atis applied inpoll_trackafterConsumer::new(...).continuing(..)and before.live(). So the consumer'smin_delayisNoneby the time startup runs, andmax_delaystays D, clamped tomax_ageas before. Consumer::set_delayrefactor: the sharedset_skipuses the sameReading | Failedguard, so an ended reader still keeps its old values.budget(): it now bounds only PES packing span and padded-output shedding, and those call sites are unchanged.- Tests: the #4645 guards now allow at most one GOP lost. The new
a_path_stall_within_the_delay_loses_nothingdrains the newest group first and covers stalls between D/2 and D. The replay-join backlog count and the SRT marker burst length were updated to match the new D horizon. - Docs: the
--delayCLI help,Exportdocs, and moq-srtSubscriberdocs now say the skip is at D, not D/2.
claude-opus-5-5 | 𝕏

A fixed-delay TS export (
moq export ts --delay D, the--passthroughrelease, and the SRT egress built on it) told the relay half its delay. The relay then reset a group withOldonce it was D/2 old. Every TS track subscription now statesDelay { min: D, max: D }, so the relay holds a group for the export's whole delay. The export's own stalled-group skip moves from D/2 to D too, so a stall shorter than D loses nothing.Closes #9018
Changes
ts::Export(new tracks,resubscribe,rebind) andts::Releasesubscribe withexport::subscribed(D), which is{min: D, max: D}. Before, it was{min: None, max: D/2}.export::skipping(D),{min: None, max: D}: a stalled group is skipped once the group after it runs D past it, and a missing group is waited for D. It is set apart from the subscription throughExportSource::skipping_atandConsumer::skipping_at(bothpub(crate)), because a consumer given the wire'smin: Dwould reach back D at a live start.Consumer::set_delaynow shares the clamp with them.budget()(D/2) now bounds only a packed PES's span and how far a padded output may fall behind before it sheds.a_skip_at_the_join_keeps_one_clockanda_skip_while_running_keeps_one_clocknow assert the new bound: a group whose tail never arrives holds the next group for the whole delay, that group's first frames are then due and go late, and the video resumes at the keyframe after it. So at most one group (15 frames) goes, and the video keeps one clock with the audio. Before, they asserted no drops.a_path_stall_within_the_delay_loses_nothing: a whole-path stall of 300, 400, or 475 ms (D = 500 ms) across a group boundary, drained newest group first with the export reading the newer group before the older tail lands, drops nothing and skips no video. At D/2, 3 of its 6 cases skip the older group's tail. The timing harness gainedLive::stall_pathfor it.fixed_delay_keeps_buffered_pes_ahead_of_the_clock: a replay join now keeps the whole delay of backlog, 151 PES instead of 76.a_skipped_group_flags_the_clock: with a delay, a 6 s hole may now be skipped and flagged instead of backfilled (details under Decisions). The test still checks that only skipped slots flag the PCR, each right before the audio resuming its hole.flv/mkvexports,moq playvideo and audio, and the TS SI tracks already state the whole delay.fmp4/mp4/h264/h265play nothing out, so they keepmaxonly by design.moq export ts --delay's help and moq-srt'sSubscriberdoc say a stalled group is skipped once it falls the delay behind, not half.a_publisher_marker_keeps_an_srt_receiver_playingwrites its post-marker burst as 0.5 s instead of 3 s at once. Details under Decisions.Decisions
min: None. Feeding the consumer the subscription's{D, D}directly would also make a live start reach back D, adding D of startup latency on top of the export's own delay. So the separate skip stays, now differing from the subscription only inmin.a_skipped_group_flags_the_clock, the first 6 s hole is backfilled and the second flagged. Both are valid TS; nothing is dropped.mainthe break was flagged only because the D/2 budget also shed two media groups: the 2.08 s gap read as an unmarked step past the 1 s delay. With D on the wire, only a 1.08 s gap is left, which the delay absorbs, so no flag. A 0.5 s burst keeps the marker deliverable, so the test exercises the declared marker it is named for.Range::oldestnow reaches back D on the relay (it was D/2). A live export still starts at the newest group and discards the rest, so the relay may send up to D of backlog that a joining export drops.minchanges no join, becauseRange::oldestignores it.Validation
cargo test -p moq-mux --lib: 2,100 passed.cargo test -p moq-srt -p moq-cli: all passed.just checkpassed.moq-relayresets a subscriber's groups asOldafter a stall of about a quarter of itsmax_delay#9018's reporter can re-run the blackout sweep on this branch, where resets should start near a D stall instead of about D/4.moq-relayat trace level, a real-timeffmpeg -re -stream_loop -1 … bbb.ts | moq import ts, andmoq export ts --delay 2s. The relay decodedmax_delay: Some(2s)on the0.avc3and1.aacSUBSCRIBEs (mainsends 1 s). The output probes as h264 and aac.Impact
Public API: none (
pub(crate)only). Wire: none; existing fields carry different values. Behavior: a TS export's subscription asks a relay to keep groups for its whole delay, and the export itself waits the whole delay for a stalled or missing group before skipping it.Caused by
moq-relayresets a subscriber's groups asOldafter a stall of about a quarter of itsmax_delay#9018's reporter)Follow-ups
None.
Models
Size: S
Implementer: Claude Code, claude-opus-5-5, unknown effort (arm A)
Implementer: Claude Code, claude-opus-5-5, high effort (iterate, S, arm A)
🤖 Generated with Claude Code
(Written by Claude Opus 5.5 with high)
Review
Rewritten by
quest reviewafter each round.Head: ec902bf
Base: origin/main at d9ccbad
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:
01a1ed7d-04b7-71f0-9be2-7a4a0bb33bfe, round 1Score: 8/10,
No actionable defects were identified; the subscription and local skip changes appear consistent and have mocked-time regression coverage, though builds and tests were not run as instructed.Rounds: 1; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none