Repository navigation
quest(m1): plan the audio rename estimate and the update-after-finish race #5788
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # [S] An audio rename keeps the arrival estimate | ||
|
|
||
| ## Goal | ||
|
|
||
| When `@moq/publish` renames an audio track after a decoder identity change, | ||
| `@moq/watch` keeps playing audio without skipping or stalling: the replacement | ||
| audio consumer continues the outgoing track's arrival estimate, as video does. | ||
| A track read from another broadcast path still starts from the cold-start | ||
| prior, as `doc/concept/audio-jitter.md` ("Across renditions") requires. | ||
|
|
||
| ## Plan | ||
|
|
||
| #5635 added `ConsumerProps.predecessor` to `@moq/hang` and the video hand-off | ||
| this quest mirrors; this quest adds no API of its own. | ||
|
|
||
| Today the audio decoder's `#runLegacyDecoder` and `#runCmafDecoder` clear | ||
| `#measured` on teardown, before the replacement subscription opens, and the | ||
| new `Container.Consumer` starts from the prior. At a rename, the audio target | ||
| drops out of the shared delay, then returns at the cold 100 ms and climbs as | ||
| the new track relearns the path. The ring skips on the drop and parks on each | ||
| rise, the same failure #5635 fixed for video. | ||
|
|
||
| Decided 2026-10-16 (recommended options; the paper trail is in the plan PR): | ||
|
|
||
| - Hand the outgoing `Container.Consumer` to the replacement through | ||
| `ConsumerProps.predecessor`, only when both read the same broadcast path, | ||
| mirroring the video decoder. No new API. | ||
| - Keep the outgoing estimate in `#measured` until the replacement's consumer | ||
| exists. Clear it only when no replacement follows (disabled, muted, or the | ||
| rendition removed), so a departed track still stops holding the buffer open. | ||
| - Prove it with a unit test in `js/watch/src/audio/decoder.test.ts` on a | ||
| mocked clock: warm a bursty audio track, rename it, and assert the ring | ||
| neither skips nor goes silent and the delay never drops. A second case moves | ||
| the media to another path and asserts it does not inherit. No new | ||
| real-browser media case: the unit test reproduces the mechanism | ||
| deterministically, and the fixture would need a second audio codec | ||
| configuration to rename audio at all. | ||
|
|
||
| Out of scope: `rs/moq-audio` builds a fresh `Target` per decode consumer, so a | ||
| native player that follows a rename restarts cold too. That needs its own | ||
| quest if native playback follows renames. | ||
|
|
||
| Public API: none. Wire: none. | ||
|
|
||
| ## Related | ||
|
|
||
| - [Browser follows a renamed track](/quest/m1/browser-rename-check.md) - the browser check that found the video stall | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # [S] A subscribe update racing a finished track ends it cleanly | ||
|
|
||
| ## Goal | ||
|
|
||
| When a publisher finishes a track while the subscriber is writing | ||
| SUBSCRIBE_UPDATE on that track's subscribe stream, the subscriber's track ends | ||
| cleanly with the publisher's finish, in JS and Rust, instead of failing with the | ||
| write's stream error. A real reset of the subscribe stream still fails the | ||
| track with the reset's error. | ||
|
|
||
| ## Plan | ||
|
|
||
| Seen in the real-browser rename media case on #5635. `@moq/publish` finished | ||
| the old `video` track after a rename. The relay closed the subscribe stream | ||
| while the player wrote a SUBSCRIBE_UPDATE on it. The write threw "The stream | ||
| was aborted by the remote server". In `js/net/src/lite/subscriber.ts`, the | ||
| rejected `#runSubscriptionUpdates` won the `terminal` race, so the track closed | ||
| with that error. Watch logged a spawn error, and the media check failed on the | ||
| console error. It reproduced in one of five local runs on a loaded machine. | ||
|
|
||
| Decided 2026-10-16 (recommended options; the paper trail is in the plan PR): | ||
|
|
||
| - A failed update write defers to the subscribe stream's own outcome. If the | ||
| responses end cleanly, the track ends cleanly; if they reject, that error | ||
| wins. No retry and no timeout. | ||
| - Fix JS and Rust together. `rs/moq-net`'s `lite/subscriber.rs` serve loop | ||
| (`ServeMode::Select`) hands the track back with the flush error. Confirm | ||
| whether the same race fails a finished track there, and give it the same | ||
| rule. | ||
| - Regression tests in both languages: a publisher that finishes the track and | ||
| stops reading while an update is in flight. The subscriber's track ends | ||
| cleanly, and a reset still surfaces its error. Run | ||
| `just test interop --all`, since this is session behavior. | ||
|
|
||
| Public API: none. Wire: none. | ||
|
|
||
| ## Related | ||
|
|
||
| - [Browser follows a renamed track](/quest/m1/browser-rename-check.md) - the media check this race failed |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.