Skip to content

fix(watch): a hold keeps the pace the audio stretch owes - #9549

Merged
kixelated merged 2 commits into
mainfrom
fix/stretch-hold-keeps-pace
Nov 24, 2026
Merged

kixelated merged 2 commits into
mainfrom
fix/stretch-hold-keeps-pace

Conversation

@kixelated

@kixelated kixelated commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Nightly 45242597151 failed chromium-aac-44100-mild: av_lag_ms_p50 5.1 > 5, repeating the aac step 5.1 the 2026-11-19 triage dropped. It is a real controller defect, not measurement quantization:

  • Instrumenting the worklet's own lag next to the probe's (local run, HEAD) put the probe within 0.01 ms of the ring at p50 (p5/p95 -0.1/+3 ms, the tails being transients sampled a report apart). The probe measures what the ring sees.
  • In that run near-zero rested 5.01 to 5.19 ms behind for 15.5 s while the ring's owed climbed and fell back to ~10 frames over and over: each hop whose jittery lag dipped to ≤ 220 frames (4.99 ms) decided HOLD, and Stretch.next reset owed on any change of sign, HOLD included. A lag hovering at the edge never accumulates the hop of pace a splice needs.
  • The nightly's mild row did the same for 47 s (lag 5.0 to 5.3 ms, accelerated flat from 6.8 s to the end).

Approach

A hold returns no splice and keeps owed; only a reversal of direction resets it. Changed together in js/watch Stretch.next, moq-audio Stretch::next, the reference (doc/concept/audio-jitter/stretch/reference.ts), and the spec paragraph in doc/concept/audio-jitter.md. New corpus case flickers (pace and hold alternating) splices once its pace adds up; the old JS fails it. Every existing corpus case is byte-identical.

The 5 ms ceiling stays: it is the half hop the rule leaves alone, and the measurement resolves it.

Validation

  • bun test (js/watch audio, corpus) and cargo test -p moq-audio pass; just ci passes.
  • Longest span any browser row's lag sat 4.8 to 10 ms off the clock: nightly 45242597151 mild 47.4 s; local HEAD near-zero 15.5 s; local with the fix, all 14 chromium rows, at most 2.3 s (opus step), AAC mild 1.3 s. Every browser row's A/V lag p50 sat within ±4.2 ms except AAC fixed-250, which rests 40 ms behind on this host with and without the fix (0.8 ms on the nightly runner).
  • Replays re-measured; only the Opus rows moved, within the half hop (budgets updated, note extended): relay-mic p50 0.2 → 2.3, p95 7.7 → 9.3; relay-mic-stall p50 2.3 → 3.2; relay-mic-rtt40 p50 0.6 → 0.3, p95 9.7 → 8.6, player underruns 0.3 → 1/min. The rtt40 underruns are two recorded outages (30.5 s, 111.8 s) catching audio resting a couple of ms differently, a count the budget rule re-measures in.

Impact

  • No public API or wire change. Behavior: browser and native audio now correct a lag just past half a hop instead of resting on it.

Alternatives

  • Raise the 5 ms ceiling: hides drift the rule exists to correct.
  • Leak owed during a hold, or add hysteresis to the half-hop test: more state for the same result.
  • Smooth the clock offset's jitter: narrows the flicker, but a lag on the edge still flickers.

Caused by

  • moq-dev/moq#8722 - reset the stretch's owed pace on a hold, so a lag at the half hop never splices (found by check: nightly Audio quality)

Decisions

  • Decided 2026-11-24 (maintainer, /quest-plan): ✅ drop the local AAC fixed-250 lag (~40 ms behind, 36 underruns/min on one developer host, before and after this change) as host-specific, since the nightly runner measures 0.8 ms (rejected: an m4 quest). Re-check if Nightly shows it.

Models

Size: S
Implementer: Claude Code, claude-opus-5-5, unknown effort

🤖 Generated with Claude Code

(Written by Claude Opus 5.5)

Review

Rewritten by quest review after each round.

  • Head: 115bd96

  • Base: origin/main at 3136f81

  • Risk: medium, The change is a bug fix in shipped code (js/watch/src/audio/stretch.ts and rs/moq-audio/src/stretch.rs) that changes how a hold keeps audio pace, so playback timing for watch users and Rust consumers of moq-audio shifts, but no public API or wire format changes and a revert fully undoes it; the rest is docs, corpus, and test budgets (low).

  • Classified: medium by Claude Code, claude-haiku-5-5, low effort, session 856c8a72-92df-4c59-8c65-ff21ca5eedc2

  • Reviewer: Codex, gpt-6.1-sol, medium effort

  • Session: 01a20eb3-d063-79d1-9dc1-1d9c9a10a5f7, round 1

  • Score: 9/10, The hold behavior is updated consistently across implementations, documentation, and conformance vectors with no findings or incompatible dependents identified, though builds and tests were not run as instructed.

  • Rounds: 1; first round 0; findings 0: fixed 0, refuted 0, open 0

  • Findings: none

  • Reviewer: Codex, gpt-6.1-sol, high effort, shadow

  • Session: 01a20eb3-d063-7991-983c-9678d03e6ddb, round 1

  • Score: 9/10, The change coherently preserves splice debt and direction across holds with no actionable defects found by inspection, but runtime validation remains unverified.

  • Rounds: 1; first round 0; findings 0: fixed 0, refuted 0, open 0

  • Findings: none

The stretch reset its owed pace on every hop that held, so a lag
flickering across half a hop as clock readings jitter never added up to a
splice, and audio rested just past the half hop for most of a minute.
A hold now keeps owed; only a reversal resets it. Same change in
moq-audio, the reference, and the spec, with a new corpus case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review November 24, 2026 17:57
@pullfrog

pullfrog Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

No configured credential can serve this run. Your Claude subscription has hit its usage limit, which resets at 2026-11-25 06:00 UTC. Re-trigger after it resets, or add an API key for this provider, which Pullfrog falls back to automatically.

The providers' responses
CLAUDE_CODE_OAUTH_TOKEN: 429: This request would exceed your account's rate limit. Please try again later.

Pick another model →

Pullfrog  | Rerun failed job ➔ | View workflow run | via Pullfrog | Using claude-opus-5-5

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

The change updates the documented, reference, JavaScript, and Rust stretch-pacing behavior so zero-pace holds preserve the current direction and owed pace. It adds a corpus case for alternating behind-the-clock decisions and holds. It also updates replay measurements and budgets for several Opus scenarios.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a hold keeps the owed pace in the audio stretch controller, which matches the changes in js/watch and moq-audio Stretch::next, the reference, the spec, and the corpus.…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description states the problem (nightly failure on chromium-aac-44100-mild, av_lag_ms_p50 5.1 > 5), the root cause (Stretch.next resetting owed on a hold), the approach (hold keeps owed, only dire…
Full details: Title check

Explanation

The title names the main change: a hold keeps the owed pace in the audio stretch controller, which matches the changes in js/watch and moq-audio Stretch::next, the reference, the spec, and the corpus. It is specific, single-sentence, and has no file lists or vague terms.

Full details: Description check

Explanation

The description states the problem (nightly failure on chromium-aac-44100-mild, av_lag_ms_p50 5.1 > 5), the root cause (Stretch.next resetting owed on a hold), the approach (hold keeps owed, only direction reversal resets it, applied in js/watch, moq-audio, the reference and the spec), the new flickers corpus case, validation results, and alternatives. It is specific and clearly related to the changeset, so it passes the lenient check.

Finishing Touches

Simplify code

  • Commit to this branch
  • Create a new PR
Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 02f07438-6f1a-4557-88fd-dc1efe934431
Commits

Reviewing files that changed from the base of the PR and between 3136f81 and 115bd96.

Files selected for processing: 7

  • doc/concept/audio-jitter.md
  • doc/concept/audio-jitter/stretch/corpus.json
  • doc/concept/audio-jitter/stretch/corpus.ts
  • doc/concept/audio-jitter/stretch/reference.ts
  • js/watch/src/audio/stretch.ts
  • rs/moq-audio/src/stretch.rs
  • test/audio-quality/budgets.json

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

A new head drops the failed check Pullfrog's quota left on the old one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated added this pull request to the merge queue Nov 24, 2026
Merged via the queue into main with commit 75e2156 Nov 24, 2026
4 checks passed
@kixelated
kixelated deleted the fix/stretch-hold-keeps-pace branch November 24, 2026 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant