Repository navigation
quest: plan the #5288 follow-ups #5425
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
5 commits
Select commit
Hold shift + click to select a range
34b973f
quest: plan the #5288 follow-ups
kixelated c322fc6
quest: keep fMP4 group ends and JS startup media in the #5288 follow-ups
kixelated d331a1a
quest: flush held pictures at the play resume boundary; audio policy …
kixelated 13b3ac5
quest: keep trailing frame ends for fMP4 in the ExportSource plan
kixelated 6248b8c
quest: leave the no-floor startup case open for the maintainer in the…
kixelated 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,30 @@ | ||
| # [XS] ExportSource reads gaps and ends as Read items | ||
|
|
||
| ## Goal | ||
|
|
||
| `moq_mux::container::ExportSource` (`rs/moq-mux/src/container/source.rs`) | ||
| consumes the container read's `Read::{Frame, Gap, End}` items instead of | ||
| polling the consumer's crate-private `discontinuity()` and `markers()` | ||
| counters, and those counters are deleted. | ||
|
|
||
| ## Plan | ||
|
|
||
| #5288 made gaps and declared ends items in the read stream but left | ||
| `ExportSource` on the old counters, so the exporters (fMP4, TS, MKV, FLV, and | ||
| the raw H.264/H.265 exports) still learn of a gap after the fact. | ||
|
|
||
| - Map `Gap` to the exporter's discontinuity handling and `End` to its | ||
| declared-end handling, in delivery order. | ||
| - Keep the events `Read` filters reaching the exporters. fMP4 cuts a fragment | ||
| on `Event::GroupEnd` while the track stays live, and sizes a durationless | ||
| final sample from a trailing `Event::FrameEnd { opens: false }`; losing | ||
| either stalls fMP4 or writes the wrong duration. Keep a crate-private path | ||
| for both alongside the Read items. Tests: a live fMP4 export still emits a | ||
| fragment at each group end, and | ||
| `zero_fragment_duration_waits_for_the_exact_video_endpoint` passes. | ||
| - Delete `Consumer::discontinuity()` and `Consumer::markers()` once nothing | ||
| reads them, along with `ExportSource::markers()` if it only forwards. | ||
| - Existing exporter tests must pass unchanged; add one where a gap and an end | ||
| arrive back to back to pin the order. | ||
|
|
||
| Public API: none (crate-private). Wire: none. | ||
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,37 @@ | ||
| # [S] Rust and JS container reads drop groups below the cursor | ||
|
|
||
| ## Goal | ||
|
|
||
| The Rust and JS container consumers agree on groups that arrive below the read | ||
| cursor: neither delivers them. The read stays `Frame | Gap | End` in delivery | ||
| order past the cursor, and what lies below is already covered by the `Gap` | ||
| that moved the cursor. | ||
|
|
||
| ## Plan | ||
|
|
||
| Found while landing #5288: JS (`js/hang/src/container/consumer.ts`) still | ||
| delivers a group that arrives below the cursor as a late backfill; Rust | ||
| (`rs/moq-mux/src/container/consumer.rs`) never does. | ||
|
|
||
| - ✅ Decided 2026-10-13: both drop, matching Rust. Not chosen: both deliver, | ||
| flagged so readers can skip; leave it open. | ||
| - Match Rust's startup first. Groups are served newest-first, so the head of a | ||
| retained window can arrive after the live edge; JS sets its cursor from the | ||
| first arrival, so dropping alone would lose valid startup media | ||
| (`consumer.outoforder.test.ts` covers that order). Rust keeps it by waiting | ||
| for an explicit start floor under the max-delay budget | ||
| (`startup_keeps_late_arriving_head_group_within_max_delay`); give JS the same | ||
| startup so the window head is never below the cursor. | ||
| - Open: a subscription with only a max delay and no start (as in | ||
| `consumer.outoforder.test.ts`) has no floor to wait for, so the window head | ||
| can still land below the cursor, in Rust too. Options include requiring a | ||
| start floor for retained windows or settling the floor before the first | ||
| delivery. Ask the maintainer before dropping groups in that case; do not | ||
| ship a drop that loses startup media. | ||
| - Then change the JS consumer to discard groups below the cursor, and add a | ||
| test mirroring Rust's: a reordered group older than the cursor is never | ||
| yielded and no extra `Gap` appears. | ||
| - Check JS readers that relied on backfill (watch's audio/video decoders, | ||
| `Sync`, the arrivals handle from #5311 if it has landed) and adjust them. | ||
|
|
||
| Public API: no type change; JS read behavior changes. Wire: none. |
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,31 @@ | ||
| # [M] moq-cli play plays out pictures before a quick resume | ||
|
|
||
| ## Goal | ||
|
|
||
| When new media arrives before the pictures buffered ahead of a declared end | ||
| have played (a source switch, say), `moq-cli play` plays the old timeline out | ||
| first instead of dropping it. | ||
|
|
||
| ## Plan | ||
|
|
||
| #5288 fixed `rs/moq-cli/src/play/video.rs` so `Read::End` no longer discards | ||
| the buffered pictures, with the restart waiting for the first frame of a later | ||
| group. A resume that arrives before those pictures play still drops them, as | ||
| it did before #5288. | ||
|
|
||
| Playing them out needs a sequential timeline in `play`: queue the new group's | ||
| frames behind the remaining pre-end pictures, then rebase the clock at the | ||
| boundary. Queueing encoded frames is not enough when the decoder reorders: the | ||
| declared end has to reach the decode loop so it flushes the pictures it still | ||
| holds before decoding the resumed group, which today happens only when the | ||
| track ends. | ||
|
|
||
| Open: whether audio follows the same queue or snaps to the new timeline. Audio | ||
| owns the presentation anchor, so this sets the latency and sync policy; ask | ||
| the maintainer before implementing. | ||
|
|
||
| Test with a declared end followed immediately by a new group, using a decoder | ||
| that holds pictures (depth above zero): every pre-end picture is shown before | ||
| the first new one. | ||
|
|
||
| Public API: none. Wire: none. |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switching
ExportSourcefromConsumer::poll_eventto theReadstream removes the privateEvent::GroupEndsignal becauseReadintentionally contains only frames, gaps, and declared ends.fmp4::Export::poll_next_chunkcurrently relies on that signal to setgroup_finishedand emit a completed fragment while the track remains live, so implementing this goal literally can stall live fMP4 output until the track closes. The quest should explicitly preserve group boundaries through an internal event API or provide an equivalent fragmentation trigger and regression test.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. c322fc6 adds a plan step: keep a crate-private group-boundary signal next to the Read items so live fMP4 still cuts a fragment at each group end, with a regression test.
(Written by Claude Opus 5.5)