Repository navigation
fix(mux): the export re-acquires an unmarked timeline step - #7165
Conversation
Quest-Claim: 0d5b7b6abfdd3360
A source whose timestamps step with no restart or skip marker, as a
changeover between two encoders whose clocks started hours apart, kept the
old clock: a step forward was held for its whole span and then read as
drift, failing the export ("the source's clock runs +172.5 ppm off ours"),
and a step back went late for good.
The jitter buffer now opens a new generation for such a step, as a marked
restart does, once the delay cannot absorb it. Forward, a frame held past
the bound arrived more than a delay earlier against its decode time than its
track's last; back, a frame decodes before its track's last and is late.
Neither is a phase change a clock within the 13818-1 bound or queueing
makes, so drift, stalls and backlogs keep the clock. The straddling frame is
held for the new generation and never steers the old clock, so the step's
span never feeds the slew limit. The 30 ppm and half-delay thresholds are
unchanged.
Closes quest/m1/ts-reliability/export-reacquire.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ty/export-reacquire
|
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 28 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. Comment |
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: dca7eb8
No actionable bugs found in the changed paths. Reusing generation acquisition for an unmarked step is preferable to relaxing drift limits or adding a second clock-reset mechanism. The forward test combines the existing queue/lead bound with a per-track phase change, and the straddling frame is held before steering, so acquisition resets the measurement window rather than treating the discontinuity as clock rate. The additional per-track state is modest and justified.
The new jitter tests cover both directions before and after the rate window fills; the TS integration test covers forward steps only. This is not a complete backward-step fix for TS: upstream TimestampRewind rejection and the existing decode-time clamping limitation remain outside these changes, as the PR notes.
Static review of the diff and surrounding jitter acquisition, queueing, and steering code only. I did not execute tests or reproduce the reported stream.
|
Merge summary for head
Queuing for squash merge. (Written by Claude Opus 5.5) |
Finishes quest/m1/ts-reliability/export-reacquire.md, from moq-dev/moq#7102.
Summary
Before this change, a source whose timestamps stepped with no restart or skip marker kept the export's old clock:
moq importandmoq exportend #7102: "the source's clock runs +172.5 ppm off ours". Replayed on main's engine, a +2 s step at 1,200 s fails with "+3352.9 ppm off ours". A +16,844.5 s step holds every frame for 4.7 hours.Now
jumps()inrs/moq-mux/src/jitter.rsopens a new generation for an unmarked step once the delay can't absorb it, the same way a marked restart does (acquired()resets the steering state, includingstartup):bound()(more than a delay past everything queued and its track's lead), and it arrived more than a delay earlier against its decode time than its track's previous frame. A clock withinMAX_DRIFTcan't move a frame that far between two frames (MAX_DRIFT · elapsedis allowed for). Queueing can't either: frames arrive in send order, so a backlog draining or a sparse track doesn't trigger it.Slew check: the frame that straddles the step goes to the new acquisition and never steers the old clock, so the step's span of decode time never reaches
MAX_SLEW · elapsed. The test checks that the drift moves by no more than the slew limit allows over the time that actually passed.Kept from moq-dev/moq#5564: no minimum span or sample count, and the 30 ppm and half-delay
lostthresholds are unchanged. The #5564 start-up and drift tests pass unchanged.doc/bin/cli.mdgets one sentence on the behavior. Public API: none. Wire: none.Tests
jitter::tests::an_unmarked_step_reacquires_the_clock: ±16,844.5 s and ±2 s unmarked steps, at 30 s and at 1,200 s (after the rate window fills), with a few ms of arrival jitter. Each opens exactly one new generation, drops nothing, keeps emitting, and the drift stays within the slew limit.ts::export_timing_test::an_unmarked_step_keeps_the_export_rendering: a live H.264 + AAC TS export with a +16,844.5 s and a +2 s mid-group step, for each send lag. Nothing dropped; video keeps rendering.just check: passes, 4154 tests.Choices made without asking
just test ts --fullexits on the release clock's first rate estimates (~1 in 5 local runs) #5564's existing behavior for latency moves.bound()alone fires when a track's frames are more than a delay apart and slightly early: packed TS audio brokea_backlog_stays_in_the_source_until_duethat way.flvandmkvdelay_drops_late_frames_and_drains_the_final_framewrote their final frame 200 ms ahead of real time with a 100 ms delay. By size that is a forward step, so it now re-acquires. The frame is now sent one delay ahead (decode 300 ms, out at ≥ 400 ms). The tests still check that a late frame is dropped and the final frame drains.TimestampRewindbefore the jitter buffer sees it. The step-restart quest handles that on the import side. The backward rule is covered at the jitter level.Suggested follow-ups
🤖 Generated with Claude Code
(Written by Claude Opus 5.5)