Repository navigation
fix(watch): keep the audio arrival estimate across a rename - #5824
Conversation
A renamed audio track now continues the outgoing consumer's estimate through ConsumerProps.predecessor when both read the same path, as video does. The outgoing estimate stays in the playout target until the replacement's consumer exists, and is cleared only when nothing replaces it. Opus states no constant frame duration, so the outgoing one also holds until the replacement's first packet instead of dropping out of the target. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Outcome: the quest is implemented as planned and opened ready for review. I made one choice beyond the written plan.
(Written by Claude Opus 5.5) |
|
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 37 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. 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d13a522da1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Opus states no constant, so the outgoing duration holds until the replacement's first packet. | ||
| const frame = frameDuration(config); | ||
| if (frame !== undefined) this.#frame.set(frame); |
There was a problem hiding this comment.
Reset the frame term for unrelated consumers
When playback moves from an AAC/MP3 rendition to an Opus or other variable-duration rendition after an absence or path change, frameDuration(config) returns undefined, so this branch retains the previous stream's frame duration. Once the new consumer publishes its cold estimate, target() therefore adds a frame term belonging to an unrelated codec until the first decodable packet arrives; if the advertised track is paused, this can hold the shared audio/video delay at the wrong value indefinitely. This also conflicts with the current-codec selection order documented in doc/concept/audio-jitter.md lines 235-249. Preserve the old term only for the intended same-path handoff, and otherwise clear #frame when the new config has no constant.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Agreed. Fixed in 6c3b126. The frame term now moves into #consume. It holds only when the replacement continues the outgoing consumer on the same path with the same codec. An absence clears #consumer, so a return starts from frameDuration(config), and that is undefined for Opus, per the doc's order. A path change or a codec change does the same.
(Written by Claude Opus 5.5)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Decision: the maintainer chose to keep the Opus frame-duration fix and merge once CI and reviews pass. After the Codex review it applies only to a same-path, same-codec hand-off. (Written by Claude Opus 5.5) |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6c3b126093
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (config.container.kind === "cmaf") { | ||
| this.#runCmafDecoder(run, sub, { config, failure }); | ||
| this.#runCmafDecoder(run, sub, props); | ||
| } else { | ||
| this.#runLegacyDecoder(run, sub, { config, failure }); | ||
| this.#runLegacyDecoder(run, sub, props); |
There was a problem hiding this comment.
Retire the old estimate when replacement setup throws
When switching from a warmed track to an Opus rendition with a malformed but base64-valid CMAF init segment, or a malformed Opus description, supported() can accept the config and then #runCmafDecoder or #runLegacyDecoder throws before #consume installs the replacement. Since this change removes the teardown cleanup and these calls have no failure path invoking #retire(), the departed consumer's #measured value remains registered indefinitely, holding the shared audio/video delay at a stale value despite there being no audio consumer. Reject these malformed configurations during probing or retire and report the setup failure here.
AGENTS.md reference: AGENTS.md:L17-L17
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Agreed. Fixed in a1a8312. A setup throw inside the subscription effect now goes to the same failure signal a decode error uses. That records #failed, surfaces it on out.error, and calls #retire(). Before this, the throw was only logged as an effect error. The regression test "reports a replacement that fails to set up and stops holding the delay" renames a warm track to an unparseable CMAF init segment. It fails without the catch.
(Written by Claude Opus 5.5)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Summary before merge:
Follow-up: native (Written by Claude Opus 5.5) |
…-target/audio-rename # Conflicts: # quest/m1/audio-jitter-target/README.md
|
The merge queue removed this PR for a merge conflict at 04:49Z. The upstream change reordered the epic's (Written by Claude Opus 5.5) |
Completes
quest/m1/audio-jitter-target/audio-rename.md.Summary
When
@moq/publishrenames an audio track,@moq/watchused to reset the audio arrival estimate:#runLegacyDecoder/#runCmafDecodercleared#measuredon teardown, so the audio target dropped out of the shared delay.Container.Consumerthen started from the cold 100 ms prior and climbed back up.The ring skipped on the drop and went silent on each rise. This is the failure #5635 fixed for video.
Changes in
js/watch/src/audio/decoder.ts:#consumehelper, shared by both container paths, passes the newest consumer asConsumerProps.predecessor, but only when both read the same broadcast path. This mirrors the video decoder.#measuredis no longer cleared on teardown.#retire()clears it only when nothing replaces the consumer: disabled, muted, instant, rendition removed, offline, failed, or the subscription closed.#runDecoderreset#frameto the catalog constant, and that constant isundefinedfor Opus. So the target lost its 10-20 ms frame term until the replacement's first packet.#framenow changes only when the config states a constant.doc/concept/audio-jitter.md("Across renditions") already requires this behavior, so it needs no update.Tests
js/watch/src/audio/decoder.test.ts, "Decoder across a rename". These read real tracks through real container consumers on a mocked clock:mainit fails withskipped: 20160samples (420 ms) andsilent: 4ticks.just checkpasses locally.Public API / wire
None.
Follow-ups
rs/moq-audiobuilds a freshTargetper decode consumer, so a native player that follows a rename still restarts cold. It needs its own quest if native playback follows renames. The quest already marks this out of scope.(Written by Claude Opus 5.5)
🤖 Generated with Claude Code