From 3c6d7dfe59f7c8a6136e7e6371c3bef5720b5d31 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Thu, 1 Oct 2026 15:47:53 -0700 Subject: [PATCH 1/2] quest(tstd): plan send-ahead within the delay and mux-rate hold Co-Authored-By: Claude Opus 5.5 --- quest/m1/tstd/README.md | 2 ++ quest/m1/tstd/mux-rate-hold.md | 32 +++++++++++++++++++++++++++++++ quest/m1/tstd/send-ahead.md | 35 ++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 quest/m1/tstd/mux-rate-hold.md create mode 100644 quest/m1/tstd/send-ahead.md diff --git a/quest/m1/tstd/README.md b/quest/m1/tstd/README.md index f681316236a..2a8b366a2a6 100644 --- a/quest/m1/tstd/README.md +++ b/quest/m1/tstd/README.md @@ -30,3 +30,5 @@ nightly. - [Fixed-delay release](/quest/m1/tstd/delay.md) - frames go out at media time plus a fixed `--delay`, in one order under loss - [TS byte schedule](/quest/m1/tstd/byte-schedule.md) - PCRs sit on the byte grid the mux rate implies, paced against the fixed delay +- [Send-ahead within the delay](/quest/m1/tstd/send-ahead.md) - total lag is `--delay`, send-ahead included, with a 1 s default +- [Mux-rate hold](/quest/m1/tstd/mux-rate-hold.md) - import publishes its catalog once the mux rate is measured, so export is constant-rate from the start diff --git a/quest/m1/tstd/mux-rate-hold.md b/quest/m1/tstd/mux-rate-hold.md new file mode 100644 index 00000000000..58ed4e8ffd8 --- /dev/null +++ b/quest/m1/tstd/mux-rate-hold.md @@ -0,0 +1,32 @@ +# [S] TS import publishes its catalog once the mux rate is measured + +## Goal + +A TS→MoQ→TS export is constant-rate from its first packet. `moq import ts` +holds the catalog until its mux-rate meter settles, so `mpegts.muxRate` is +there from the start rather than appearing about 2 s in. A VBR source that +never settles is published without it once the window closes. + +## Plan + +Decided (2026-10-01). Found in [fixed-delay release](/quest/m1/tstd/delay.md) +(#4645): the importer's meter (`rs/moq-mux/src/container/ts/mux_rate.rs`) +publishes `mpegts.muxRate` only after a 2 s window agrees. So the export's +first ~2 s go out unpadded, and the harness skips them (`pcr-timing.py` +grades from the first null packet). + +- Hold the whole catalog until the meter settles or its window closes, + whichever is first: a one-time ~2 s start-up cost at ingest. Media written + in the meantime is still published. +- A source whose rate never settles (VBR) publishes after the window without + `muxRate`, and the export stays unpadded, as today. +- Remove the harness's "grade from the first null packet" skip, and the + export's grace for a rate that arrives mid-stream, if nothing else needs + them. +- Test: an imported CBR source's first catalog carries `muxRate`, and a VBR + source's catalog arrives after the window without it. A TS→TS export passes + `pcr-schedule` from its first PCR. + +## Required + +- [Fixed-delay release](/quest/m1/tstd/delay.md) - its export is what reads the rate from the start diff --git a/quest/m1/tstd/send-ahead.md b/quest/m1/tstd/send-ahead.md new file mode 100644 index 00000000000..d09cfaaaae8 --- /dev/null +++ b/quest/m1/tstd/send-ahead.md @@ -0,0 +1,35 @@ +# [M] TS export lag stays within the delay, send-ahead included + +## Goal + +`moq export ts` output trails the source by `--delay`, not twice it. The +send-ahead window that pre-loads the receiver's buffers comes out of the same +budget, capped at what the decoder buffer can hold. The default becomes 1 s, +so broadcast-sized CPBs fit out of the box. + +## Plan + +Decided (2026-10-01). Found in [fixed-delay release](/quest/m1/tstd/delay.md) +(#4645): frames are held until anchor + DTS + delay, and the schedule then +sends each unit up to another delay ahead of its DTS, so a mid-group joiner +trails the source by two delays. t0ms measured about 1.7 s at 500 ms. + +- One budget. A frame's release deadline is anchor + DTS + delay − its + send-ahead. The send-ahead is at most what the PID's decoder buffer can hold + ahead of its DTS (EB from the SPS HRD or the level, B per 13818-1); sending + further ahead only adds latency (0.93 s of reach on `hrd9m` against a 2 s + delay). +- The default `--delay` rises from 500 ms to 1 s. Broadcast CPBs need + 0.6-1 s of send-ahead (t0ms's CNN capture, `hrd9m`). A source that needs + more than the delay allows fails loud and names the `--delay` it needs. + Update `doc/bin/cli.md`, moq-srt egress (which passes its SRT latency as + the delay), and every example invocation. +- Test: a mid-group joiner's every slot goes out `delay` after the source sent + it (the existing `a_joiner_runs_at_the_delay_from_its_first_output`, tightened + from two delays to one). `hrd9m` passes strict `tstd` at the 1 s default, + and a delay below its buffer delay fails loud. +- Ask t0ms to re-grade the CNN capture: latency should drop by about a delay. + +## Required + +- [Fixed-delay release](/quest/m1/tstd/delay.md) - the hold and schedule this merges into one budget From 4ef90de0e84e89a51543497adff361c506cdef69 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Thu, 1 Oct 2026 16:13:27 -0700 Subject: [PATCH 2/2] quest(tstd): bound the mux-rate hold and release it at end of input Co-Authored-By: Claude Opus 5.5 --- quest/m1/tstd/mux-rate-hold.md | 21 ++++++++++++++------- quest/m1/tstd/send-ahead.md | 4 +++- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/quest/m1/tstd/mux-rate-hold.md b/quest/m1/tstd/mux-rate-hold.md index 58ed4e8ffd8..c9d1cb03ce9 100644 --- a/quest/m1/tstd/mux-rate-hold.md +++ b/quest/m1/tstd/mux-rate-hold.md @@ -15,16 +15,23 @@ publishes `mpegts.muxRate` only after a 2 s window agrees. So the export's first ~2 s go out unpadded, and the harness skips them (`pcr-timing.py` grades from the first null packet). -- Hold the whole catalog until the meter settles or its window closes, - whichever is first: a one-time ~2 s start-up cost at ingest. Media written - in the meantime is still published. -- A source whose rate never settles (VBR) publishes after the window without - `muxRate`, and the export stays unpadded, as today. +- Hold the whole catalog until the meter settles, or until one `WINDOW` of + PCR time has passed with no rate published, whichever is first: a + one-time ~2 s start-up cost at ingest. The meter itself keeps rolling and + never times out, so the hold needs that explicit bound. Media written in + the meantime is still published. +- A source whose rate never settles (VBR) publishes after that window + without `muxRate`, and the export stays unpadded, as today. +- End of input releases a held catalog without `muxRate` before + `catalog.finish` closes it: a TS shorter than one window never completes + a measurement, and finishing would otherwise close the catalog track with + the reservation unpublished, leaving media with no catalog. - Remove the harness's "grade from the first null packet" skip, and the export's grace for a rate that arrives mid-stream, if nothing else needs them. -- Test: an imported CBR source's first catalog carries `muxRate`, and a VBR - source's catalog arrives after the window without it. A TS→TS export passes +- Test: an imported CBR source's first catalog carries `muxRate`, a VBR + source's catalog arrives after the window without it, and a CBR import + shorter than 2 s still publishes its catalog. A TS→TS export passes `pcr-schedule` from its first PCR. ## Required diff --git a/quest/m1/tstd/send-ahead.md b/quest/m1/tstd/send-ahead.md index d09cfaaaae8..a77d4c5e574 100644 --- a/quest/m1/tstd/send-ahead.md +++ b/quest/m1/tstd/send-ahead.md @@ -12,7 +12,9 @@ so broadcast-sized CPBs fit out of the box. Decided (2026-10-01). Found in [fixed-delay release](/quest/m1/tstd/delay.md) (#4645): frames are held until anchor + DTS + delay, and the schedule then sends each unit up to another delay ahead of its DTS, so a mid-group joiner -trails the source by two delays. t0ms measured about 1.7 s at 500 ms. +trails the source by two delays. t0ms measured about 1.7 s of delivery at +500 ms: the two delays plus the join and the source's own send-ahead, so +carving alone should cut it by about one delay, not to 0.5 s. - One budget. A frame's release deadline is anchor + DTS + delay − its send-ahead. The send-ahead is at most what the PID's decoder buffer can hold