Skip to content

fix(watch): a resumed rendition continues its arrival estimate - #9141

Merged
kixelated merged 4 commits into
mainfrom
quest/m0/interop-green/media-resume-delay
Nov 19, 2026
Merged

kixelated merged 4 commits into
mainfrom
quest/m0/interop-green/media-resume-delay

Conversation

@kixelated

@kixelated kixelated commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Finishes quest/m0/interop-green/media-resume-delay.md.

Problem

The interop media step has failed audio tone: after resume in the scheduled Interop run (Chromium) and Nightly's Media (firefox player) job since 2026-11-12. Two causes, both reproduced locally under load:

  1. The target jumps after a resume (Firefox 11-17, 11-18). A pause or a hidden tab releases the rendition, and the resume subscribed again with a fresh arrival estimate (the cold-start prior). The first outage after the resume then took FRESH_MAX, a tenth of the histogram, so one late burst set the 95th percentile alone: the target went from about 160 ms to 840 to 1120 ms, and the snap rule froze audio and video for about 0.6 s. A codec rename already continued the estimate (fix(watch,publish): keep the delay across a rename and close frames read during teardown; cover renames in media QA #5635, fix(watch): keep the audio arrival estimate across a rename #5824); a pause did not. The doc already said a receiver back from a pause is not cold.
  2. The window opens on a declared silence (Chromium 11-17). The fixture's audio encodes on demand. During the 3 s pause its retained history expires, so on resume the encoder ends the epoch (a declared end) and then encodes its retained and live audio, which arrives 0.4 to 0.7 s later. The player correctly reports a declared silence as not stalled, so measurePlayback's "playback starts" wait passed while the ring held nothing (audio timestamp 0) and graded that silence. This answers the plan's step 3.

The burst itself is real lateness, not a join artifact (plan step 1). Per-frame logs at the publisher and player show the Chromium publisher's video and audio encoders stalling 300 to 530 ms about 1.3 s after the resubscribe, and transport adding another 250 to 500 ms, under the CPU spike the resume causes on a shared host. Those frames were captured well after the subscription began, so the join rule rightly measures them.

Approach

  • js/watch video and audio decoders keep the consumer of the rendition they release. A rendition resumed on the same path forks its estimate, as a rename does. The stop says nothing about the path, like a declared silence, so the paused time folds no idle intervals. With the pre-pause evidence, one outage takes 1 - FORGET (0.017), below the 5% tail.
  • doc/concept/audio-jitter.md states the rule beside the rename one, and the "coming back from a pause" sentence now says it means arrivals that stop within a subscription.
  • The interop harness gets one audioPlays(sample) helper: the graph runs, the ring isn't refilling, and a frame has anchored it (timestamp, which reads 0 until then). measurePlayback, reachesLive, ToneCheck, and the driver's wrong-tone diagnostic use it instead of running && !stalled.

Plan step 2 (what a large rise does) was already decided by the audio playout epic on 2026-11-13: every clock move past 200 ms snaps. Nothing changes there.

Impact

  • Public API: none. Wire: none.
  • Behavior: a <moq-watch> resumed after a pause, a hidden tab, or a disable continues its arrival estimate for the same path instead of starting at the cold-start prior. A resume onto a path with real lateness starts at that path's target instead of 100 ms and climbing.
  • Native moq play has no viewer pause, so the Rust estimator and the conformance corpus are unchanged.

Validation

  • Reproduced on main with just media --media-cases rename,pause --media-engines firefox pinned with taskset -c 0-3 on a host at load 25 to 35: 3 of 6 instrumented runs failed after resume, all with the video estimate restarting at 100 and climbing to 1000 to 1120 ms. One unloaded main run failed in the second mode (audio timestamp 0 for 0.7 s).
  • Offline replay of the recorded arrivals of two failing runs through Jitter: the resumed track cold reaches 1120 and 1000 ms (matching the freezes); forked from the pre-pause track it reaches 160 and 320 ms (the 180 ms rise is under the snap threshold).
  • New decoder tests, video and audio: warm on an on-time path, pause, resume, then one outage after the join. Without the fix the delay goes to 1560 ms (video) and 810 ms (audio); with it, it stays within 100 ms of the warm delay.
  • New reachesLive case for a declared silence with nothing anchored.
  • bun test watch/src passes; just check passes.
  • Loaded runs with both fixes, same setup, no instrumentation: Firefox 8 of 8 and Chromium 7 of 8 passed rename,pause. The Chromium failure was neither mode: audio/video sync: after resume: 69/80 with the delay steady at 160 to 220 ms and audio playing, while video fell 300 to 450 ms behind as the host's idle reached 0% (other sessions' rustc and moq_net test binaries in the window's top list).

Decisions

Taken while the maintainer is away; each is reversible in review.

  • Fix the decoders, not the estimator. The estimator does what the doc says for a cold start. The divergence was the player discarding evidence on a pause. Alternatives: treat the first seconds after any subscribe as join (an arbitrary window), or cap a lone observation's weight lower (changes the normative cold start for every receiver).
  • The paused time folds no idle intervals. Following the idle rule literally (one prior fold per 500 ms paused) would regain 13% prior over the test's 4 s pause, enough to let one outage move the quantile again. I treated the viewer's stop like a declared silence, which keeps the estimate whatever its length.
  • Mode B is a harness fix. The declared end is genuine (the on-demand encoder ended its epoch when its retained history expired), so the player's report is right. The harness had read "not stalled" as "playing".
  • audioTimestamp > 0 as "anchored". The probe has no other view of the ring's anchor; the field is documented to read 0 until a frame anchors the ring.

Caused by

No single PR: a resume has started its estimate cold since the estimator landed. moq-dev/moq#5635 and moq-dev/moq#5824 added continuity for renames only. moq-dev/moq#8507 made the resulting rise freeze playback (found by check).

Follow-ups

None.

Models

Size: L
Implementer: Claude Code, claude-opus-5-5, high effort

Review

Rewritten by quest review after each round.

  • Head: 9582607

  • Base: origin/main at d778edc

  • Risk: medium, the base has no RISK.md to name what is always high or customer-facing, so every change is medium

  • Classified: medium by default

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

  • Session: 01a1f1a2-0194-7042-b349-7a527ab105d1, round 1

  • Score: 9/10, The change preserves estimator continuity across resumes without an identified behavioral regression; builds and tests were not run, as instructed.

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

  • Findings: none

🤖 Generated with Claude Code

(Written by Claude Opus 5.5 with high)

kixelated and others added 4 commits November 18, 2026 16:59
A pause or a hidden tab releases the rendition, and the resume subscribed
again from the cold-start prior. The first outage after it then took a
tenth of the histogram, so one late keyframe group held the shared delay
near a second and froze audio and video.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A resume onto the fixture's on-demand audio first reads the epoch its
encoder ended while unwatched, which the player reports as a declared
silence rather than a stall. measurePlayback opened its window there and
graded the silence until the retained audio arrived.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title A viewer's resume doesn't freeze playback on a late video burst fix(watch): a resumed rendition continues its arrival estimate Nov 19, 2026
@kixelated
kixelated marked this pull request as ready for review November 19, 2026 02:37
@coderabbitai

coderabbitai Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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 2 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

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: 4573a43f-ab29-428f-b474-d1b48948bcfb
Commits

Reviewing files that changed from the base of the PR and between a245f60 and 9582607.

Files selected for processing: 13

  • doc/concept/audio-jitter.md
  • js/watch/src/audio/decoder.test.ts
  • js/watch/src/audio/decoder.ts
  • js/watch/src/video/decoder.test.ts
  • js/watch/src/video/decoder.ts
  • quest/m0/interop-green/media-resume-delay.md
  • quest/m0/nightly/README.md
  • test/interop/clients/js/driver.ts
  • test/interop/clients/js/media.ts
  • test/interop/clients/js/src/contract.test.ts
  • test/interop/clients/js/src/contract.ts
  • test/interop/clients/js/tone.test.ts
  • test/interop/clients/js/tone.ts
  • 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

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Approach: Sound. The player threw away its evidence on a pause, and this fixes that in the decoders. It reuses the rename path's existing Jitter.fork() continuity instead of changing the normative cold start.

Reviewed changes

I reviewed the full diff across the watch decoders, the jitter doc, and the interop harness.

  • Audio decoder keeps the consumer on stop: Phase stopped now carries the last Consumed. #retire() drops it only on failure, and #consume still checks the path before forking.
  • Video decoder remembers the retired consumer: #retired is recorded when #runActive releases a rendition. #runDecoder falls back to it when nothing is active, and the path check is unchanged.
  • Harness audioPlays(): it requires an anchored ring (audioTimestamp > 0). Ring reset() zeroes readIndex, so a resume reads 0 until a frame anchors it. That makes the check a real "playing" signal.
  • Doc: audio-jitter.md states the pause rule beside the rename rule.

I checked that the new decoder tests catch the regression. With main's decoder.ts, the video test fails at 1560 ms and the audio test at 810 ms. With the PR, both pass. The contract and tone tests pass too.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@kixelated

Copy link
Copy Markdown
Collaborator Author

Merge pick (maintainer away, granted the coordinator merges it confidently recommends): ✅ /quest-merge, accepting the choices listed in the PR body.

(Written by Claude Opus 5.5 with high)

@kixelated
kixelated added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit b2372ad Nov 19, 2026
14 checks passed
@kixelated
kixelated deleted the quest/m0/interop-green/media-resume-delay branch November 19, 2026 03:00
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