From 1bdd1a9f377d72c1b1784a907ad4b9aaf9cbe0ff Mon Sep 17 00:00:00 2001 From: Thomas Drapier Date: Sat, 10 Oct 2026 14:25:15 +0100 Subject: [PATCH 1/8] quest(m1): plan moqsink's first catalog and moqsrc A/V alignment Two follow-ups from #5181: a restarted moqsink lists every requested pad in its first catalog, and every moqsrc pad of a run shares one timestamp reference and segment base. Co-Authored-By: Claude Opus 5.5 Co-authored-by: Cursor --- quest/m1/README.md | 2 ++ quest/m1/gst-first-catalog.md | 65 +++++++++++++++++++++++++++++++++++ quest/m1/gst-src-av-sync.md | 50 +++++++++++++++++++++++++++ 3 files changed, 117 insertions(+) create mode 100644 quest/m1/gst-first-catalog.md create mode 100644 quest/m1/gst-src-av-sync.md diff --git a/quest/m1/README.md b/quest/m1/README.md index 4b442071057..09324025b60 100644 --- a/quest/m1/README.md +++ b/quest/m1/README.md @@ -172,6 +172,8 @@ ladders. - [Catalog warmup](/quest/m1/catalog-warmup.md) - `warmup` on video and audio renditions, in the catalog and the draft - [Audio warmup](/quest/m1/audio-warmup.md) - a viewer joining an Opus rendition mid-stream never hears the unconverged first 80 ms - [#3021](/quest/m1/3021-moq-gst-anchor-generated-media-timelines-to-wall-clock.md) - moq-gst picks the broadcast wall epoch; a restarted source is a new epoch, not a forward re-anchor +- [moqsink first catalog](/quest/m1/gst-first-catalog.md) - a restarted `moqsink` lists every requested pad in its first catalog, so `moqsrc` resumes each on its held pad +- [moqsrc A/V alignment](/quest/m1/gst-src-av-sync.md) - every `moqsrc` pad of a run shares one timestamp reference and segment base - [TS passthrough export](/quest/m1/ts-passthrough-export.md) - `export ts --passthrough` writes the `m2ts` track back byte-identical (less late drops) on a fixed delay - [FLV and MKV export delay](/quest/m1/export-delay.md) - FLV and MKV interleave through the shared jitter buffer on a fixed delay, breaking the CLI once - [MKV lacing](/quest/m1/mkv-lacing.md) - laced MKV blocks import as one timed frame each, refused without DefaultDuration diff --git a/quest/m1/gst-first-catalog.md b/quest/m1/gst-first-catalog.md new file mode 100644 index 00000000000..3913c5cd345 --- /dev/null +++ b/quest/m1/gst-first-catalog.md @@ -0,0 +1,65 @@ +# [S] moqsink's first catalog lists every requested pad + +## Goal + +When a `moqsink` run starts, its first catalog lists every pad requested so +far, not only the pads whose caps arrived first. A `moqsrc` following a +restarted `moqsink` then resumes each rendition on its held pad, instead of +ending a late-listed one with EOS and adding a new, unlinked pad for it. A +rendition the new run really drops still ends with EOS. + +Non-goals: other publishers, whose first catalog is already complete +(`@moq/publish` waits for its tracks to settle, and the CLI importers reserve +their track set up front). + +## Plan + +Decided 2026-10-10, planning the follow-ups of +[#5181](https://github.com/moq-dev/moq/pull/5181): + +- The fix lives in `moqsink`, and `moqsrc`'s rule stays: a rendition the new + run's first catalog does not list ends with EOS. Holding unlisted + renditions in `moqsrc` instead would let one that never returns stall a + downstream muxer, and every other publisher already sends a complete first + catalog. +- Each pad reserves its catalog slot (`moq_mux::catalog::Producer::reserve`) + when it is requested in `request_new_pad` (`rs/moq-gst/src/sink/imp.rs`), + instead of when its caps arrive (`catalog.reserve()` in + `rs/moq-gst/src/sink/pad.rs`), hands it to its importer once the caps + resolve the rendition, and drops it if the pad is released first. The + catalog withholds its first snapshot until every reservation resolves, so + that snapshot lists every pad. Each run re-reserves for the pads that exist + when it starts. + +Open, for the maintainer: + +- A pad requested but never fed holds back the whole catalog; opaque pads + never reserve for this reason (`an_opaque_pad_stays_out_of_the_catalog`). + Recommended: drop the reservation when the pad is released or reaches EOS + without caps, and document that a linked pad must negotiate before the + broadcast lists anything. Alternative: drop every reservation still without + caps once another pad's first frame is ready, so the catalog waits only for + pads negotiating together, at the cost of the race this quest removes. +- Milestone: m1 is the recommendation, since only a restart of a `moqsink` + whose pads negotiate at different times is affected. Alternative: m0 under + [Broadcast epochs](/quest/m0/broadcast-epoch/README.md), gating the release. +- Docs: the `moqsink` and `moqsrc` paragraphs of `doc/bin/gstreamer.md` + describe the rule. Whether anything beyond them is needed is open; + recommended no. + +Tests: a `moqsink` whose audio pad gets caps after its video pad's first +buffer publishes one first catalog listing both; and a `moqsrc` following +that `moqsink` across a restart keeps both pads without EOS. + +The comment above the catalog subscribe in `follow_catalog` +(`rs/moq-gst/src/source/imp.rs`) says the browser announces an empty catalog +before its encoder configures. Check it against `@moq/publish` and correct it +if stale. + +## Required + +- [moqsrc follows a restart](/quest/m0/broadcast-epoch/moqsrc.md) - the restart hold this protects, and the end-to-end test + +## Related + +- [#3115](/quest/m2/3115-moqsink-the-publication-has-no-generation-so-a-flush.md) - a new generation re-reserves for its pads too diff --git a/quest/m1/gst-src-av-sync.md b/quest/m1/gst-src-av-sync.md new file mode 100644 index 00000000000..d624f8067c2 --- /dev/null +++ b/quest/m1/gst-src-av-sync.md @@ -0,0 +1,50 @@ +# [M] moqsrc keeps audio and video aligned + +## Goal + +All of a `moqsrc` run's pads share one timestamp reference and one segment +base, so audio and video keep the relative timing the broadcast gives them, +at the first start and after every switch. Today each pump starts its PTS at +its own first frame (`reference_ts` in `rs/moq-gst/src/source/imp.rs`) and +bases its segment on the running time its own first buffer arrived +(`live_segment`), so two tracks line up only as well as their first frames' +arrivals happen to match their timestamps. A video track joining at a +keyframe and an audio track joining at its latest group start apart. + +Non-goals: aligning to wall time across hosts, which +[#3021](/quest/m1/3021-moq-gst-anchor-generated-media-timelines-to-wall-clock.md) +settles on the sink side; jitter buffering. + +## Plan + +Decided 2026-10-10, planning the follow-ups of +[#5181](https://github.com/moq-dev/moq/pull/5181): the tracks of one +broadcast share a microsecond timeline (`hang::container::TIMESCALE`, which +the catalog's one `clock` maps to wall time), so equal timestamps on +different tracks present together. `moqsink` already publishes them that +way (`two_pads_keep_av_aligned_through_real_segments`); only `moqsrc` loses +it. + +Open, for the maintainer: + +- The shared reference. Recommended: per run, the first frame any pump reads + fixes the run's reference timestamp and segment base, and every pad of the + run maps through both, so a frame stamped before the reference falls + before the segment and is clipped. Alternative: map timestamps through the + catalog's wall `clock` onto the pipeline clock, which also aligns across + hosts but assumes synchronized clocks and overlaps #3021. +- Milestone: m1 is the recommendation; m2 is the alternative. +- Docs: whether anything beyond the `moqsrc` paragraph of + `doc/bin/gstreamer.md` is needed is open; recommended no. + +Test: a broadcast whose audio and video first frames differ by a known +offset reaches `moqsrc`'s two pads with that offset between their running +times, at the first start and after a restart. + +## Required + +- [moqsrc follows a restart](/quest/m0/broadcast-epoch/moqsrc.md) - rewrites the pumps and segments this changes + +## Related + +- [#3021](/quest/m1/3021-moq-gst-anchor-generated-media-timelines-to-wall-clock.md) - the wall epoch on the sink side From 7b02baf1a52a33fcedf5491d16a1db3626f229b1 Mon Sep 17 00:00:00 2001 From: Thomas Drapier Date: Sat, 10 Oct 2026 15:10:12 +0100 Subject: [PATCH 2/8] quest(m1): address review on the moqsrc follow-ups Name the browser publishers whose first catalog can be partial as out of scope for the moqsink quest, and require the A/V quest to compare times on one scale and clip frames before the run's reference. Co-Authored-By: Claude Opus 5.5 Co-authored-by: Cursor --- quest/m1/gst-first-catalog.md | 18 ++++++++---------- quest/m1/gst-src-av-sync.md | 27 +++++++++++++++++++-------- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/quest/m1/gst-first-catalog.md b/quest/m1/gst-first-catalog.md index 3913c5cd345..301362564cf 100644 --- a/quest/m1/gst-first-catalog.md +++ b/quest/m1/gst-first-catalog.md @@ -8,9 +8,11 @@ restarted `moqsink` then resumes each rendition on its held pad, instead of ending a late-listed one with EOS and adding a new, unlinked pad for it. A rendition the new run really drops still ends with EOS. -Non-goals: other publishers, whose first catalog is already complete -(`@moq/publish` waits for its tracks to settle, and the CLI importers reserve -their track set up front). +Non-goals: other publishers. The CLI importers reserve their track set up +front, and ``'s default `source` mode waits for its enabled +tracks to settle before announcing. `@moq/publish` with `announce="always"`, +or its `Broadcast` class used directly, announces before its renditions +resolve and has the same gap, which is planned separately. ## Plan @@ -20,8 +22,9 @@ Decided 2026-10-10, planning the follow-ups of - The fix lives in `moqsink`, and `moqsrc`'s rule stays: a rendition the new run's first catalog does not list ends with EOS. Holding unlisted renditions in `moqsrc` instead would let one that never returns stall a - downstream muxer, and every other publisher already sends a complete first - catalog. + downstream muxer. +- A browser publisher that announces before its tracks settle stays out of + scope (decided in #5189's review), so this quest stays a `moqsink` change. - Each pad reserves its catalog slot (`moq_mux::catalog::Producer::reserve`) when it is requested in `request_new_pad` (`rs/moq-gst/src/sink/imp.rs`), instead of when its caps arrive (`catalog.reserve()` in @@ -51,11 +54,6 @@ Tests: a `moqsink` whose audio pad gets caps after its video pad's first buffer publishes one first catalog listing both; and a `moqsrc` following that `moqsink` across a restart keeps both pads without EOS. -The comment above the catalog subscribe in `follow_catalog` -(`rs/moq-gst/src/source/imp.rs`) says the browser announces an empty catalog -before its encoder configures. Check it against `@moq/publish` and correct it -if stale. - ## Required - [moqsrc follows a restart](/quest/m0/broadcast-epoch/moqsrc.md) - the restart hold this protects, and the end-to-end test diff --git a/quest/m1/gst-src-av-sync.md b/quest/m1/gst-src-av-sync.md index d624f8067c2..7d5a5814fbd 100644 --- a/quest/m1/gst-src-av-sync.md +++ b/quest/m1/gst-src-av-sync.md @@ -19,18 +19,28 @@ settles on the sink side; jitter buffering. Decided 2026-10-10, planning the follow-ups of [#5181](https://github.com/moq-dev/moq/pull/5181): the tracks of one -broadcast share a microsecond timeline (`hang::container::TIMESCALE`, which -the catalog's one `clock` maps to wall time), so equal timestamps on -different tracks present together. `moqsink` already publishes them that -way (`two_pads_keep_av_aligned_through_real_segments`); only `moqsrc` loses -it. +broadcast share one timeline, which the catalog's one `clock` maps to wall +time, so equal times on different tracks present together. They do not +share one scale: CMAF keeps each track's `mdhd` timescale, and LOC can carry +a per-frame one (`moq_mux::container::Frame::timestamp`). `moqsink` already +publishes aligned tracks (`two_pads_keep_av_aligned_through_real_segments`); +only `moqsrc` loses the alignment. + +Whatever the reference: + +- Compare times converted to one scale, such as nanoseconds: + `moq_net::Timestamp::checked_sub` refuses mismatched scales, and + `relative_pts` turns that refusal into zero. +- A frame before the run's reference must land before the segment start, + where the segment clips it. Today `relative_pts` clamps it to zero instead. + For example, use the converted time as the PTS and the reference as the + segment start. Open, for the maintainer: - The shared reference. Recommended: per run, the first frame any pump reads fixes the run's reference timestamp and segment base, and every pad of the - run maps through both, so a frame stamped before the reference falls - before the segment and is clipped. Alternative: map timestamps through the + run maps through both. Alternative: map timestamps through the catalog's wall `clock` onto the pipeline clock, which also aligns across hosts but assumes synchronized clocks and overlaps #3021. - Milestone: m1 is the recommendation; m2 is the alternative. @@ -39,7 +49,8 @@ Open, for the maintainer: Test: a broadcast whose audio and video first frames differ by a known offset reaches `moqsrc`'s two pads with that offset between their running -times, at the first start and after a restart. +times, at the first start and after a restart, whichever pump reads first. +One case is a CMAF broadcast whose tracks use different timescales. ## Required From a44ce199ab7a7974bacd71fd28d8b0d53066a1ea Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sun, 11 Oct 2026 08:16:22 -0700 Subject: [PATCH 3/8] quest: test A/V alignment on frames past the reference A first frame before the shared reference is clipped, so its original offset is not observable. Also drop a pad's reservation when its caps are opaque, and note that the catalog producer exists only during a run. Co-Authored-By: Claude Opus 5.5 --- quest/m1/gst-first-catalog.md | 10 ++++++---- quest/m1/gst-src-av-sync.md | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/quest/m1/gst-first-catalog.md b/quest/m1/gst-first-catalog.md index 0b5e1bf6fc6..c59c5309191 100644 --- a/quest/m1/gst-first-catalog.md +++ b/quest/m1/gst-first-catalog.md @@ -30,10 +30,12 @@ Decided 2026-10-10, planning the follow-ups of moqsrc's restart work when it is requested in `request_new_pad` (`rs/moq-gst/src/sink/imp.rs`), instead of when its caps arrive (`catalog.reserve()` in `rs/moq-gst/src/sink/pad.rs`), hands it to its importer once the caps - resolve the rendition, and drops it if the pad is released first. The - catalog withholds its first snapshot until every reservation resolves, so - that snapshot lists every pad. Each run re-reserves for the pads that exist - when it starts. + resolve the rendition, and drops it if the pad is released first or its + caps are opaque, which the catalog never lists. The catalog withholds its + first snapshot until every reservation resolves, so that snapshot lists + every pad. The catalog producer exists only during a run (`READY` to + `PAUSED`), so each run reserves for the pads that exist when it starts, and + a pad requested mid-run reserves at once. Open, for the maintainer: diff --git a/quest/m1/gst-src-av-sync.md b/quest/m1/gst-src-av-sync.md index b3553ae6072..a16e4be7f86 100644 --- a/quest/m1/gst-src-av-sync.md +++ b/quest/m1/gst-src-av-sync.md @@ -48,10 +48,12 @@ Open, for the maintainer: - Docs: whether anything beyond the `moqsrc` paragraph of `doc/bin/gstreamer.md` is needed is open; recommended no. -Test: a broadcast whose audio and video first frames differ by a known -offset reaches `moqsrc`'s two pads with that offset between their running -times, at the first start and after a restart, whichever pump reads first. -One case is a CMAF broadcast whose tracks use different timescales. +Test: an audio and a video frame with the same broadcast time reach +`moqsrc`'s two pads at the same running time, at the first start and after a +restart, whichever pump reads first and whichever track's first frame is +earlier. A frame before the run's reference reaches its pad with a PTS before +the segment start, for downstream to clip. One case is a CMAF broadcast whose +tracks use different timescales. ## Related From 76503ab88ace20203095eb558d6ef1a08322e37c Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sun, 11 Oct 2026 08:23:55 -0700 Subject: [PATCH 4/8] quest: record the maintainer's moqsink and moqsrc decisions Both quests stay in m1 after #3021. An unfed pad's reservation drops on release, EOS without caps, or opaque caps. moqsrc's first frame read fixes the run's shared reference and segment base. Docs stay inline. Co-Authored-By: Claude Opus 5.5 --- quest/m1/gst-first-catalog.md | 28 +++++++++++++--------------- quest/m1/gst-src-av-sync.md | 24 ++++++++++++------------ 2 files changed, 25 insertions(+), 27 deletions(-) diff --git a/quest/m1/gst-first-catalog.md b/quest/m1/gst-first-catalog.md index c59c5309191..ad88ff14460 100644 --- a/quest/m1/gst-first-catalog.md +++ b/quest/m1/gst-first-catalog.md @@ -37,21 +37,19 @@ Decided 2026-10-10, planning the follow-ups of moqsrc's restart work `PAUSED`), so each run reserves for the pads that exist when it starts, and a pad requested mid-run reserves at once. -Open, for the maintainer: - -- A pad requested but never fed holds back the whole catalog; opaque pads - never reserve for this reason (`an_opaque_pad_stays_out_of_the_catalog`). - Recommended: drop the reservation when the pad is released or reaches EOS - without caps, and document that a linked pad must negotiate before the - broadcast lists anything. Alternative: drop every reservation still without - caps once another pad's first frame is ready, so the catalog waits only for - pads negotiating together, at the cost of the race this quest removes. -- Milestone: m1 is the recommendation, since only a restart of a `moqsink` - whose pads negotiate at different times is affected. Alternative: m0 under - [Broadcast epochs](/quest/m0/broadcast-epoch/README.md), gating the release. -- Docs: the `moqsink` and `moqsrc` paragraphs of `doc/bin/gstreamer.md` - describe the rule. Whether anything beyond them is needed is open; - recommended no. +Decided 2026-10-11 by the maintainer, in #5189: + +- A pad requested but never fed holds back the run's first catalog, so its + reservation drops when the pad is released, reaches EOS without caps, or + gets opaque caps. Dropping reservations once another pad's first frame is + ready was rejected: it brings back the race this quest removes. The + initial gate only holds the first snapshot, so later catalogs never wait. +- m1, ranked after #3021: only a restart of a `moqsink` whose pads negotiate + at different times is affected, so it does not gate the release under + [Broadcast epochs](/quest/m0/broadcast-epoch/README.md). +- Docs stay inline: the implementing PR updates the `moqsink` and `moqsrc` + paragraphs of `doc/bin/gstreamer.md`, including that every linked pad must + negotiate before the broadcast lists anything. No separate docs quest. Tests: a `moqsink` whose audio pad gets caps after its video pad's first buffer publishes one first catalog listing both; and a `moqsrc` following diff --git a/quest/m1/gst-src-av-sync.md b/quest/m1/gst-src-av-sync.md index a16e4be7f86..a739984957a 100644 --- a/quest/m1/gst-src-av-sync.md +++ b/quest/m1/gst-src-av-sync.md @@ -27,8 +27,13 @@ a per-frame one (`moq_mux::container::Frame::timestamp`). `moqsink` already publishes aligned tracks (`two_pads_keep_av_aligned_through_real_segments`); only `moqsrc` loses the alignment. -Whatever the reference: +Decided 2026-10-11 by the maintainer, in #5189: +- Per run, the first frame any pump reads fixes the run's reference + timestamp and segment base, and every pad of the run maps through both. + Mapping through the catalog's wall `clock` was rejected: the clock is + optional, assumes synchronized hosts, and only means something for + `moqsink` once #3021 lands. - Compare times converted to one scale, such as nanoseconds: `moq_net::Timestamp::checked_sub` refuses mismatched scales, and `relative_pts` turns that refusal into zero. @@ -36,17 +41,12 @@ Whatever the reference: where the segment clips it. Today `relative_pts` clamps it to zero instead. For example, use the converted time as the PTS and the reference as the segment start. - -Open, for the maintainer: - -- The shared reference. Recommended: per run, the first frame any pump reads - fixes the run's reference timestamp and segment base, and every pad of the - run maps through both. Alternative: map timestamps through the - catalog's wall `clock` onto the pipeline clock, which also aligns across - hosts but assumes synchronized clocks and overlaps #3021. -- Milestone: m1 is the recommendation; m2 is the alternative. -- Docs: whether anything beyond the `moqsrc` paragraph of - `doc/bin/gstreamer.md` is needed is open; recommended no. +- With one base, a pump whose first frame arrives late in wall time but + early in media time reaches a clock-synced sink late. That is synced + playback working as intended, not something to compensate for here. +- m1, ranked after #3021. +- Docs stay inline: the implementing PR updates the `moqsrc` paragraph of + `doc/bin/gstreamer.md`. No separate docs quest. Test: an audio and a video frame with the same broadcast time reach `moqsrc`'s two pads at the same running time, at the first start and after a From e863e7695522dfe4d4a907fc1230b39196728f49 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sun, 11 Oct 2026 08:33:36 -0700 Subject: [PATCH 5/8] quest: drop a failed pad's reservation and reserve atomically at run start Co-Authored-By: Claude Opus 5.5 --- quest/m1/gst-first-catalog.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/quest/m1/gst-first-catalog.md b/quest/m1/gst-first-catalog.md index ad88ff14460..7ab1461c88d 100644 --- a/quest/m1/gst-first-catalog.md +++ b/quest/m1/gst-first-catalog.md @@ -34,14 +34,20 @@ Decided 2026-10-10, planning the follow-ups of moqsrc's restart work caps are opaque, which the catalog never lists. The catalog withholds its first snapshot until every reservation resolves, so that snapshot lists every pad. The catalog producer exists only during a run (`READY` to - `PAUSED`), so each run reserves for the pads that exist when it starts, and - a pad requested mid-run reserves at once. + `PAUSED`), so each run reserves for the pads that exist when it starts + (`start_session`), and a pad requested mid-run reserves at once. +- A pad admitted while a run starts must land in exactly one of those sets: + reserve in `confirm_admission`, under the control lock `start_session` + takes, rather than after `add_pad`, so a pad added after `start_session` + enumerated `sink_pads` still reserves before the first snapshot. Decided 2026-10-11 by the maintainer, in #5189: - A pad requested but never fed holds back the run's first catalog, so its reservation drops when the pad is released, reaches EOS without caps, or - gets opaque caps. Dropping reservations once another pad's first frame is + gets opaque caps. A pad whose caps fail (`CapsOutcome::Failed`, such as AAC + without `codec_data` or a duplicate track name) is terminal and drops it + too. Dropping reservations once another pad's first frame is ready was rejected: it brings back the race this quest removes. The initial gate only holds the first snapshot, so later catalogs never wait. - m1, ranked after #3021: only a restart of a `moqsink` whose pads negotiate @@ -52,8 +58,10 @@ Decided 2026-10-11 by the maintainer, in #5189: negotiate before the broadcast lists anything. No separate docs quest. Tests: a `moqsink` whose audio pad gets caps after its video pad's first -buffer publishes one first catalog listing both; and a `moqsrc` following -that `moqsink` across a restart keeps both pads without EOS. +buffer publishes one first catalog listing both; a pad that is released, +ends without caps, or fails its caps lets the first catalog publish; a pad +requested while the run starts is listed; and a `moqsrc` following that +`moqsink` across a restart keeps both pads without EOS. ## Related From 2191f37152c0add556fe9766d5b6ec50b58f829c Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sun, 11 Oct 2026 08:38:03 -0700 Subject: [PATCH 6/8] quest: reserve a slot per outstanding admission at run start Co-Authored-By: Claude Opus 5.5 --- quest/m1/gst-first-catalog.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/quest/m1/gst-first-catalog.md b/quest/m1/gst-first-catalog.md index 7ab1461c88d..17e860f962d 100644 --- a/quest/m1/gst-first-catalog.md +++ b/quest/m1/gst-first-catalog.md @@ -36,10 +36,14 @@ Decided 2026-10-10, planning the follow-ups of moqsrc's restart work every pad. The catalog producer exists only during a run (`READY` to `PAUSED`), so each run reserves for the pads that exist when it starts (`start_session`), and a pad requested mid-run reserves at once. -- A pad admitted while a run starts must land in exactly one of those sets: - reserve in `confirm_admission`, under the control lock `start_session` - takes, rather than after `add_pad`, so a pad added after `start_session` - enumerated `sink_pads` still reserves before the first snapshot. +- A pad admitted while a run starts must not miss the gate. `request_new_pad` + counts the admission under the control lock before `add_pad`, so + `start_session` can run in between and miss the pad in `sink_pads`, and a + sibling can publish the first snapshot before the pad confirms. So the + reservation follows the admission: `start_session` also reserves one slot + per outstanding admission (`control.admissions`), a mid-run request + reserves when it counts its admission, and `confirm_admission` hands that + slot to the pad while `cancel_admission` drops it. Decided 2026-10-11 by the maintainer, in #5189: @@ -60,7 +64,8 @@ Decided 2026-10-11 by the maintainer, in #5189: Tests: a `moqsink` whose audio pad gets caps after its video pad's first buffer publishes one first catalog listing both; a pad that is released, ends without caps, or fails its caps lets the first catalog publish; a pad -requested while the run starts is listed; and a `moqsrc` following that +requested while the run starts is listed even when a sibling resolves before +that pad confirms; and a `moqsrc` following that `moqsink` across a restart keeps both pads without EOS. ## Related From ad0454449fe2fc5af8618a4c2031617a6953d645 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sun, 11 Oct 2026 08:47:52 -0700 Subject: [PATCH 7/8] quest: drop a reservation on EOS before the rendition resolves Co-Authored-By: Claude Opus 5.5 --- quest/m1/gst-first-catalog.md | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/quest/m1/gst-first-catalog.md b/quest/m1/gst-first-catalog.md index 17e860f962d..eec777a2b24 100644 --- a/quest/m1/gst-first-catalog.md +++ b/quest/m1/gst-first-catalog.md @@ -49,11 +49,16 @@ Decided 2026-10-11 by the maintainer, in #5189: - A pad requested but never fed holds back the run's first catalog, so its reservation drops when the pad is released, reaches EOS without caps, or - gets opaque caps. A pad whose caps fail (`CapsOutcome::Failed`, such as AAC - without `codec_data` or a duplicate track name) is terminal and drops it - too. Dropping reservations once another pad's first frame is - ready was rejected: it brings back the race this quest removes. The - initial gate only holds the first snapshot, so later catalogs never wait. + gets opaque caps. Every other terminal path before the rendition resolves + drops it too: caps that fail (`CapsOutcome::Failed`, such as AAC without + `codec_data` or a duplicate track name), and EOS after caps but before the + importer resolved a config (H.264 byte-stream that ends before its SPS), + whose importer owns the reservation by then. Today `handle_event(Eos)` + only marks the pad ended, and producers finalize once every pad ends, so a + streaming sibling would keep the gate shut. Dropping reservations once + another pad's first frame is ready was rejected: it brings back the race + this quest removes. The initial gate only holds the first snapshot, so + later catalogs never wait. - m1, ranked after #3021: only a restart of a `moqsink` whose pads negotiate at different times is affected, so it does not gate the release under [Broadcast epochs](/quest/m0/broadcast-epoch/README.md). @@ -63,10 +68,11 @@ Decided 2026-10-11 by the maintainer, in #5189: Tests: a `moqsink` whose audio pad gets caps after its video pad's first buffer publishes one first catalog listing both; a pad that is released, -ends without caps, or fails its caps lets the first catalog publish; a pad -requested while the run starts is listed even when a sibling resolves before -that pad confirms; and a `moqsrc` following that -`moqsink` across a restart keeps both pads without EOS. +ends without caps, fails its caps, or ends after caps but before its config +lets the first catalog publish while a sibling streams; a pad requested while +the run starts is listed even when a sibling resolves before that pad +confirms; and a `moqsrc` following that `moqsink` across a restart keeps +both pads without EOS. ## Related From 12e7dc3ef592675af5ecf9e1c1e8bad654c9fd8d Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sun, 11 Oct 2026 08:58:24 -0700 Subject: [PATCH 8/8] quest: key a pad's catalog reservation by pad, not by admission count Co-Authored-By: Claude Opus 5.5 --- quest/m1/gst-first-catalog.md | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/quest/m1/gst-first-catalog.md b/quest/m1/gst-first-catalog.md index eec777a2b24..eceaecfb46e 100644 --- a/quest/m1/gst-first-catalog.md +++ b/quest/m1/gst-first-catalog.md @@ -39,11 +39,15 @@ Decided 2026-10-10, planning the follow-ups of moqsrc's restart work - A pad admitted while a run starts must not miss the gate. `request_new_pad` counts the admission under the control lock before `add_pad`, so `start_session` can run in between and miss the pad in `sink_pads`, and a - sibling can publish the first snapshot before the pad confirms. So the - reservation follows the admission: `start_session` also reserves one slot - per outstanding admission (`control.admissions`), a mid-run request - reserves when it counts its admission, and `confirm_admission` hands that - slot to the pad while `cancel_admission` drops it. + sibling can publish the first snapshot before the pad confirms. So key the + slot by pad, not by a count: each pad's lifecycle holds at most one + reservation, and filling it is idempotent. The control state tracks + admitted-but-unconfirmed pads instead of only `control.admissions`; + `start_session` fills the slot of every pad in `sink_pads` or that set, a + mid-run request fills it when it is admitted, and `cancel_admission` or + release drops it. A pad already visible in `sink_pads`, or whose CAPS + arrived through a reentrant `child_added` handler, is then never reserved + twice. Decided 2026-10-11 by the maintainer, in #5189: @@ -71,8 +75,9 @@ buffer publishes one first catalog listing both; a pad that is released, ends without caps, fails its caps, or ends after caps but before its config lets the first catalog publish while a sibling streams; a pad requested while the run starts is listed even when a sibling resolves before that pad -confirms; and a `moqsrc` following that `moqsink` across a restart keeps -both pads without EOS. +confirms, and reserved once even when it is already in `sink_pads`; and a +`moqsrc` following that `moqsink` across a restart keeps both pads without +EOS. ## Related