Repository navigation
quest: plan playout's move to positioned bus channels #118
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,20 @@ | ||
| # [XS] moq-audio's positioned bus channel is pinned | ||
|
|
||
| ## Goal | ||
|
|
||
| The `moq` submodule includes moq-audio's `Bus::positioned`, whose | ||
| `bus::Positioned::write(position, data)` plays a write at the bus position it | ||
| names, from [moq-dev/moq#8273](https://github.com/moq-dev/moq/pull/8273). That | ||
| PR also renamed `Bus::channel`/`bus::Channel` to `Bus::live`/`bus::Live`. | ||
|
|
||
| ## Plan | ||
|
|
||
| Planned 2026-11-08 (maintainer, moq's /quest-complete), a follow-up of | ||
| moq-dev/moq#8273, which has merged on moq's `main`. | ||
|
|
||
| Advance it with `just upgrade-moq` in its own PR, fixing whatever the new API | ||
| breaks here: at least the `Bus::live` rename at every `bus.channel(..)` call. | ||
| If [moq-dev/moq#8272](https://github.com/moq-dev/moq/pull/8272) has landed by | ||
| then, `moq_mux::timeline` is `moq_mux::sync`, and `playout.rs` follows that | ||
| PR's migration notes too. Move no audio onto positioned writes here; that is | ||
| [Playout writes land on positioned bus channels](/quest/m0/playout-positioned.md). |
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,54 @@ | ||
| # [M] Playout writes land on positioned bus channels | ||
|
|
||
| ## Goal | ||
|
|
||
| A broadcast, media, or replay source's sound plays at exactly the bus | ||
| position its pictures are timed for. `rs/moq-scene`'s playout writes it | ||
| through moq-audio's `Bus::positioned`, and its private copy of moq-audio's bus | ||
| latency (`BUS_LATENCY`) and of the live ring's pad rule are deleted. | ||
|
|
||
| Non-goals: the `Speaker`'s jitter targeting stays as it is, and live inputs | ||
| (microphones, capture, guests) stay on `Bus::live`. | ||
|
|
||
| ## Plan | ||
|
|
||
| Planned 2026-11-08 (maintainer, moq's /quest-complete), a follow-up of | ||
| [moq-dev/moq#8273](https://github.com/moq-dev/moq/pull/8273), which added | ||
| `Bus::positioned` for this consumer. | ||
|
|
||
| Today `playout::Writer` writes into a live `bus::Channel` and keeps track of | ||
| when what it wrote runs out, padding silence ahead of a frame so it sounds a | ||
| copied 50 ms `BUS_LATENCY` later, the way moq-audio's ring would. Each source | ||
| that plays timed audio (`source.rs`'s broadcast, media, and replay paths) | ||
| goes through it. | ||
|
|
||
| Decided with the maintainer: | ||
|
|
||
| - ✅ **Studio maps an instant to a bus position** (rejected: an upstream | ||
| moq-audio bus clock). `Program::run_audio` (`rs/moq-studio/src/engine.rs`) already advances the bus | ||
| sample-exact on the program clock from `start`, so the position a frame | ||
| sounds at is `(sounds - start) * rate`. The writer gets the program clock's | ||
| `start` and the bus rate through the sources' `Context`. moq-audio's bus | ||
| counts frames and has no wall clock, so a clock there would guess timing | ||
| only the app knows. | ||
| - ✅ **A late frame is trimmed, not dropped** (rejected: drop the whole | ||
| frame). `Positioned::write` fails a write any part of which is already | ||
| mixed, overlaps earlier audio, or lands past `bus::REACH`. The writer cuts | ||
| the frames whose position has passed and writes the rest at its position, | ||
| as today's writer does with a late part. | ||
|
|
||
| Recommendations, not settled: | ||
|
|
||
| - Keep consecutive writes contiguous: a frame that starts within the | ||
| existing one-millisecond `CONTIGUOUS` stamp rounding of where the last one | ||
| ended is written at that end, since a one-frame overlap from rounding fails | ||
| the write. | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
| - A frame the writer holds earlier than `REACH` ahead waits until it is in | ||
| reach rather than failing. | ||
| - Test on the scene's driver-stepped bus, as `a_write_sounds_when_placed` | ||
| does: frames written ahead, late, and across a stall sound at the expected | ||
| bus positions, sample-exact. | ||
|
|
||
| ## Required | ||
|
|
||
| - [moq-audio's positioned bus channel is pinned](/quest/m0/pin-bus-positioned.md) - `Bus::positioned`, which the writer writes through | ||
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.