diff --git a/doc/concept/audio-jitter.md b/doc/concept/audio-jitter.md index 443e0877bc0..2adfcb58351 100644 --- a/doc/concept/audio-jitter.md +++ b/doc/concept/audio-jitter.md @@ -42,7 +42,11 @@ age budget. Natively that holds only as far as the caller lets it. The container consumer reads groups in sequence order and applies its age budget inside `read()`, so a group skipped for age is never observed, and a frame queued behind a stalled -group is observed when the stall clears. A caller that estimates keeps the budget +group is observed when the stall clears. A missing group, one that has delivered +no frame, is waited for only the playout delay plus any lookahead, since past that +it would play late: a reordered backlog's holes waited out to the whole budget +would delay the frames behind them, which the estimator would measure as +jitter. A caller that estimates keeps the budget at least as long as the estimate's ceiling, which is why `moq play` waits 2 s on a stalled group under `--delay auto`. The observation is also only as honest as the caller is prompt: `read()` is timed when it resolves, so a player drains it diff --git a/js/hang/api/container.api.md b/js/hang/api/container.api.md index d6d944fe695..69cafe41f27 100644 --- a/js/hang/api/container.api.md +++ b/js/hang/api/container.api.md @@ -26,6 +26,7 @@ export interface ConsumerProps { delay?: Signals.GetterInit; format: Format; predecessor?: Consumer; + wait?: Signals.GetterInit; warmup?: Net.Clock.Duration; } diff --git a/js/hang/src/container/consumer.holes.test.ts b/js/hang/src/container/consumer.holes.test.ts index b6d76bccba1..bb7843873bb 100644 --- a/js/hang/src/container/consumer.holes.test.ts +++ b/js/hang/src/container/consumer.holes.test.ts @@ -394,3 +394,67 @@ test("a newest-first flush past a hole delivers the groups landing behind its ne } } }); + +// A player waits on a hole for its playout delay, while groups that did arrive play until the max. +test("a hole is waited for the wait while an arrived group plays up to the max delay", async () => { + const clock = new Manual(); + const installed = clock.install(); + const track = new Track.Producer("audio"); + const consumer = new Consumer(track.subscribe({ delay: { max: Duration.millis(30_000) } }), { + format: new Format("audio"), + delay: { max: Duration.millis(1000) }, + wait: Duration.millis(100), + }); + const results: Read[] = []; + const reading = (async () => { + for (;;) { + const read = await consumer.next(); + if (!read) return; + results.push(read); + } + })(); + const write = (sequence: bigint, ms: number, finish = true) => { + const group = track.createGroup(sequence); + group.writeFrame({ + payload: encodeFrame(new Uint8Array([1]), Duration.millis(ms)), + timestamp: Time.Timestamp.fromMicros(ms * 1000), + }); + if (finish) group.finish(); + return group; + }; + const reads = () => results.map((read) => (read.kind === "frame" ? read.frame.timestamp.asMillis() : read.kind)); + try { + // A stalled group 500 ms behind the newest content is still within the max delay. + const stalled = write(0n, 0, false); + write(1n, 500); + await flush(); + await clock.advance(Duration.millis(500)); + expect(reads()).toEqual([0]); + stalled.finish(); + await flush(); + expect(reads()).toEqual([0, 500]); + + // A missing group expires the wait after the first group past it arrived. + write(3n, 520); + await flush(); + await clock.advance(Duration.millis(99)); + expect(reads()).toEqual([0, 500]); + await clock.advance(Duration.millis(1)); + expect(reads()).toEqual([0, 500, "gap", 520]); + + // Or at once, when the newest content is already the wait past where the group after it begins. + write(5n, 700); + write(6n, 800); + await flush(); + expect(reads()).toEqual([0, 500, "gap", 520, "gap", 700, 800]); + } finally { + consumer.close(); + track.finish(); + track.close(); + try { + await reading; + } finally { + installed.close(); + } + } +}); diff --git a/js/hang/src/container/consumer.ts b/js/hang/src/container/consumer.ts index 245273eff7a..a3427ca3ddf 100644 --- a/js/hang/src/container/consumer.ts +++ b/js/hang/src/container/consumer.ts @@ -16,8 +16,7 @@ export interface ConsumerProps { * for it when the newest group arrives first; an unstated (`null`) `min` reads as zero. A `min` * past `max` starts at `max`, since the publisher serves nothing older. `max` is measured as * the span from the oldest buffered frame to the newest, so it bounds how long a late group is - * waited for. A missing sequence also expires this much monotonic time after the first group - * past it arrived, even when the next group is a marker on a paused track. It is the local + * waited for, and a missing one unless {@link ConsumerProps.wait} is shorter. It is the local * half of the subscription's `delay.max`; both measure the same budget, one on the wire and one * as frames are read. It bounds a join's lateness too: a backlog that landed before the first * read starts at the first group whose first frame is within it, plus any warmup, of the @@ -26,6 +25,16 @@ export interface ConsumerProps { */ // Read-only: a Getter (e.g. another component's output) is accepted directly. delay?: GetterInit; + /** + * How long a missing group is waited for before the consumer skips past it, at most `delay.max` + * (default: `delay.max`). It expires once where the first group past it begins falls this far + * behind the newest content, or this much monotonic time after that group arrived, even when + * it is a marker on a paused track. Groups that did arrive still play until they age past + * `delay.max`, so a player can wait on holes for its playout delay alone while still receiving + * the late media it catches up on. + */ + // Read-only: a Getter (e.g. another component's output) is accepted directly. + wait?: GetterInit; /** * Cap the bytes of decoded frames held ahead of the reader, counting the whole wire payload they * share and each frame's and group's own overhead (default: one group at the transport's size @@ -173,6 +182,7 @@ export class Consumer { #track: Moq.Track.Subscriber; #format: Format; #delay: Getter; + #wait: Getter; #maxBuffer: number; // How much further than the min delay the start reaches, and the age skip tolerates while warming. #warmup: Duration; @@ -247,6 +257,7 @@ export class Consumer { this.#track = track; this.#format = props.format; this.#delay = getter(props.delay ?? {}); + this.#wait = getter(props.wait); this.#maxBuffer = props.maxBuffer ?? DEFAULT_MAX_BUFFER; this.#warmup = props.warmup ?? Duration.ZERO; this.#jitter = props.predecessor ? props.predecessor.#jitter.fork() : new Jitter(); @@ -838,8 +849,8 @@ export class Consumer { // Otherwise promote #active when the first buffered group continues the timeline we left off at, // when a completed empty group can be walked (empty groups mean nothing), or when the hole // is proven: everything a missing group could still present ends where the first group past - // it begins, so once that start falls a whole max delay behind the newest content, all of it - // would arrive too old to play. Mirrors Rust's `aged`. Where presentation left off proves only + // it begins, so once that start falls the whole wait behind the newest content, all of it + // would arrive too late to play. Mirrors Rust's `aged`. Where presentation left off proves only // the oldest of it stale, and groups go out newest first, so a flush's newest group lands just // ahead of the groups behind it, which would then arrive below the cursor and never play. // Proving it here matters: #checkMaxDelay would instead drop the head, the very group to play @@ -857,11 +868,11 @@ export class Consumer { const startup = this.#start === undefined && !this.#floored; const contiguous = ptsContiguous(this.#presentedEnd, head.frames.at(0)?.timestamp.asMicros()); const empty = head.empty && head.consumer.done; - const maxDelay = maxMicros(this.#delay.peek()); + const wait = this.#holeWait(this.#delay.peek(), this.#wait.peek()); const bound = this.#groups.find((group) => group.start !== undefined)?.start; const edge = this.#liveEdge(); - const aged = bound !== undefined && edge !== undefined && edge - bound >= maxDelay; - const elapsed = now().since(this.#hole).asMicros() >= maxDelay; + const aged = bound !== undefined && edge !== undefined && edge - bound >= wait; + const elapsed = now().since(this.#hole).asMicros() >= wait; // The ranges ask for nothing in between, so nothing there is owed. const next = this.#track.nextInRange(this.#active); const excluded = next === undefined || next >= head.consumer.sequence; @@ -977,8 +988,9 @@ export class Consumer { timer = new Effect(); timer.run((effect) => { const delay = effect.get(this.#delay); - // The start waits out its reach, and a hole the max delay, which an unlimited one never does. - const budget = starting === undefined ? maxMicros(delay) : this.#reach(delay); + // The start waits out its reach, and a hole the wait, which an unlimited one never does. + const budget = + starting === undefined ? this.#holeWait(delay, effect.get(this.#wait)) : this.#reach(delay); if (!Number.isFinite(budget)) return; effect.timer(() => this.#notify?.(), Duration.micros(budget).saturatingSub(now().since(since))); }); @@ -999,6 +1011,12 @@ export class Consumer { } } + // How long a missing group is waited for, in microseconds: the wait, at most the max delay. + #holeWait(delay: Moq.Track.Delay, wait: Duration | undefined): number { + const max = maxMicros(delay); + return wait === undefined ? max : Math.min(wait.asMicros(), max); + } + // How far behind the live edge the start reaches, in microseconds: the min delay plus the warmup. // The publisher serves nothing older than the max delay, so a min delay past it reaches no further. #reach(delay: Moq.Track.Delay): number { diff --git a/js/watch/src/audio/decoder.ts b/js/watch/src/audio/decoder.ts index 1b9b6c276be..9b7be37d721 100644 --- a/js/watch/src/audio/decoder.ts +++ b/js/watch/src/audio/decoder.ts @@ -322,9 +322,11 @@ export class Decoder { } // A group the relay expires is never observed, so a subscription cut to the target would cap the - // estimate at the target it already holds. The container consumer skips at the same max delay, - // since it observes each frame before applying it, so audio the ring could still catch up on is - // delivered, and carves out the warmup the subscription adds once it has warmed, as Rust's does. + // estimate at the target it already holds. The container consumer drops aged media at the same max + // delay, since it observes each frame before applying it, so audio the ring could still catch up on + // is delivered, and carves out the warmup the subscription adds once it has warmed, as Rust's does. + // It waits on a missing group only for the delay plus the lookahead: past that the group would play + // late, and a reordered backlog's holes waited out to the max would read as jitter to the estimator. // See doc/concept/audio-jitter.md. #runSubscribeMaxDelay(effect: Effect): void { const delay = effect.get(this.sync.out.delay); @@ -852,6 +854,7 @@ export class Decoder { const consumer = new Container.Consumer(sub, { format, delay: this.#delay, + wait: this.sync.out.maxDelay, warmup: Duration.millis(config.warmup ?? 0), predecessor: continues ? outgoing.consumer : undefined, }); diff --git a/js/watch/src/audio/replay.ts b/js/watch/src/audio/replay.ts index 3ff4f73f19a..463010d8190 100644 --- a/js/watch/src/audio/replay.ts +++ b/js/watch/src/audio/replay.ts @@ -2,8 +2,8 @@ * Replay a recorded arrival trace through the player's consumer and ring on a simulated clock. * * Every frame is written into its group at the instant the trace says it arrived, and the player's - * real `Container.Consumer` decides what to deliver, wait for, and skip, at the max delay the delay - * sets. Delivered frames go into the real ring, which carries on through a gap the way the decoder's + * real `Container.Consumer` decides what to deliver, wait for, and skip, at the hole wait and max delay + * the decoder sets. Delivered frames go into the real ring, which carries on through a gap the way the decoder's * does: a gap restarts only the codec. One render quantum is read every quantum's worth of that same * clock, which is what the AudioWorklet does. A real {@link Sync} resolves the delay from the playout target the decoder * registers, measured by that same consumer from the recorded catalog config, and the ring and the @@ -145,13 +145,14 @@ export async function* replay(trace: Arrival[], options: Options): AsyncGenerato const buffered = !lookahead.isZero(); const sync = new Sync({ delay: options.delay, lookahead }); const track = new Track.Producer("audio"); - // The subscription's max delay, as the decoder sets it, which the consumer skips at too. + // The subscription's max delay, as the decoder sets it, which the consumer drops aged media at too. const maxDelay = new Derived([sync.out.maxDelay], (max) => options.delay === "auto" ? max.max(AUTO_MAX_DELAY) : max, ); const consumer = new Container.Consumer(track.subscribe({ delay: { max: WIRE_MAX_DELAY } }), { format: new Container.Legacy.Format("audio"), delay: new Derived([sync.out.delay, maxDelay], (min, max) => ({ min, max })), + wait: sync.out.maxDelay, }); // Match the decoder: a codec constant until a delivered packet states its own duration. diff --git a/quest/m1/audio-jitter-target/hole-wait.md b/quest/m1/audio-jitter-target/hole-wait.md deleted file mode 100644 index d214765ccc0..00000000000 --- a/quest/m1/audio-jitter-target/hole-wait.md +++ /dev/null @@ -1,29 +0,0 @@ -# [M] Split the consumer's hole wait from its age limit - -## Goal - -The container consumer waits on a missing group for `delay + lookahead` but -keeps delivering aged media up to the subscription's max delay, in `js/hang` -and Rust alike, so a reordered join backlog no longer raises the jitter -target while a stall's late audio is still delivered for the stretch to -catch up on. - -## Plan - -Decided 2026-11-11 (maintainer, /quest-merge pick of -[moq-dev/moq#8507](https://github.com/moq-dev/moq/pull/8507)): keep. - -#8507 set the browser consumer's single limit to the subscription's max -delay, as native had, because at `delay + lookahead` the age skip dropped -what the stretch would catch up on (1651.8 tap underruns a minute on -relay-bbb, 2123.6 on relay-mic-stall). The cost: relay-mic-rtt40's consumer -waits up to the max on its reordered join backlog's holes, which the -estimator counts as jitter, raising its target p95 from 320 to 780 ms. - -Recommendations: - -- Two limits: skip a hole after `delay + lookahead`, drop media only once it - is older than the max. -- Change both consumers in one PR and keep their tests mirrored. -- Pass when relay-mic-rtt40's target p95 returns near 320 ms and the stall - rows keep #8507's underruns and trims. diff --git a/rs/moq-audio/src/decode/consumer.rs b/rs/moq-audio/src/decode/consumer.rs index 352c3aba245..fd28c5366f1 100644 --- a/rs/moq-audio/src/decode/consumer.rs +++ b/rs/moq-audio/src/decode/consumer.rs @@ -572,6 +572,11 @@ impl Consumer { /// that arrives meanwhile, or `None` once the track ends. async fn next(&mut self) -> Result, Error> { loop { + // A missing group is waited for only the playout delay, since past it the group + // would play late, and a reordered backlog's holes waited out to the max delay + // would read as jitter. Late groups that did arrive still play up to the max. + // Refreshed before every poll, since each arrival and each decoded frame can move it. + self.track.set_wait(self.delay()); // Read before judging the head, so any update after that wakes the wait. let seen = self.gate.as_ref().map_or(0, |gate| gate.read().version); let deadline = match self.pending.front() { diff --git a/rs/moq-mux/src/container/consumer.rs b/rs/moq-mux/src/container/consumer.rs index e69c749c1c7..52918cdabad 100644 --- a/rs/moq-mux/src/container/consumer.rs +++ b/rs/moq-mux/src/container/consumer.rs @@ -66,11 +66,11 @@ pub(crate) enum Item { /// [`Delay::max`] measures. With the default max delay of zero, /// the consumer skips aggressively: any group that has a newer alternative is dropped. /// With a non-zero max delay, slow groups are tolerated up to that budget before being -/// skipped. A missing sequence gets the same tolerance: there is no way to tell a stream -/// that lost the delivery race from one the cache evicted. -/// Its budget also expires that much monotonic time after the first group past it arrived, so -/// a marker behind a hole is delivered even when the track is paused, and the holes a stalled -/// source left behind expire together rather than one budget each. +/// skipped. A missing sequence gets the same tolerance, or the shorter +/// [`set_wait`](Self::set_wait): there is no way to tell a stream that lost the delivery race +/// from one the cache evicted. Its wait also expires that much monotonic time after the first +/// group past it arrived, so a marker behind a hole is delivered even when the track is paused, +/// and the holes a stalled source left behind expire together rather than one wait each. /// /// Delivery starts at the floor the /// [`Subscription::ranges`](moq_net::track::Subscription::ranges) name, raised to where the @@ -170,6 +170,9 @@ pub struct Consumer { // How far we may drift from the live edge before skipping a group. max_delay: std::time::Duration, + // How long a missing group is waited for, capped at the max delay; `None` waits the max delay. + wait: Option, + // Wakes the reader once the hole at the cursor, or the start's wait, expires. hole_timer: Option>>, @@ -393,6 +396,7 @@ impl Consumer { target: None, warmed: None, max_delay, + wait: None, hole_timer: None, edge: None, start: None, @@ -735,8 +739,9 @@ impl Consumer { // stops moving, a backlog with every other group missing would otherwise drain one // budget per hole, which reads downstream as a source far slower than real time. let since = front.late; - let elapsed = since.elapsed() >= self.max_delay; - let aged = next_group.is_some_and(|(_, start)| max_timestamp.saturating_sub(start) >= self.max_delay); + let wait = self.wait.map_or(self.max_delay, |wait| wait.min(self.max_delay)); + let elapsed = since.elapsed() >= wait; + let aged = next_group.is_some_and(|(_, start)| max_timestamp.saturating_sub(start) >= wait); let excluded = match &self.reader { Reader::Reading(track) | Reader::Failed(track, _) => { track.next_in_range(self.current).is_none_or(|next| next >= sequence) @@ -760,7 +765,7 @@ impl Consumer { self.note_group_edge(); continue; } - if let Some(wake) = since.checked_add(self.max_delay) { + if let Some(wake) = since.checked_add(wait) { let timer = self .hole_timer .get_or_insert_with(|| Box::pin(kio::clock::sleep_until(wake))); @@ -1196,6 +1201,15 @@ impl Consumer { } } + /// Wait at most `wait` for a missing group before skipping past it (default: the max delay). + /// + /// It never exceeds [`Delay::max`]. Groups that did arrive still play until they age past the + /// max delay, so a player can wait on holes for its playout delay alone while still receiving + /// the late media it catches up on. + pub fn set_wait(&mut self, wait: std::time::Duration) { + self.wait = Some(wait); + } + /// Cap the bytes of decoded frames held ahead of the reader, counting the wire payload they share /// and each frame's and group's own overhead (default [`DEFAULT_MAX_BUFFER`]). Past it the consumer stops decoding ahead /// and pulling new groups; see the type docs. @@ -1965,6 +1979,59 @@ mod tests { assert_eq!(read, ["gap", "frame 2", "gap", "frame 4"]); } + /// A player waits on a hole for its playout delay, while groups that did arrive play until the + /// max delay. + #[tokio::test(start_paused = true)] + async fn a_hole_is_waited_for_the_wait_while_an_arrived_group_plays_up_to_the_max_delay() { + let mut track = track_producer("data", hang::container::track_info(hang::catalog::PRIORITY.audio)); + let subscriber = track.subscribe( + moq_net::track::Subscription::default().with_delay(Delay::default().with_max(Duration::from_secs(1))), + ); + let mut reader = Consumer::new(subscriber, Container::Legacy(crate::container::Kind::Data)); + reader.set_wait(Duration::from_millis(100)); + let drain = |reader: &mut Consumer| { + let mut read = Vec::new(); + while let Poll::Ready(Ok(Some(item))) = reader.poll_read(&kio::Waiter::noop()) { + read.push(match item { + Read::Frame { group, .. } => format!("frame {group}"), + Read::Gap { .. } => "gap".to_string(), + Read::End { .. } => "end".to_string(), + }); + } + read + }; + + // A stalled group 500 ms behind the newest content is still within the max delay. + let mut stalled = track.create_group(moq_net::group::Info { sequence: 0 }).unwrap(); + let frame = Frame { + timestamp: ts(0), + payload: Bytes::from_static(&[0xDE, 0xAD]), + keyframe: false, + duration: None, + }; + Container::Legacy(crate::container::Kind::Data) + .write(&mut stalled, &[frame]) + .unwrap(); + write_group(&mut track, 1, &[ts(500_000)]); + tokio::time::advance(Duration::from_millis(500)).await; + assert_eq!(drain(&mut reader), ["frame 0"]); + stalled.finish().unwrap(); + assert_eq!(drain(&mut reader), ["frame 1"]); + + // A missing group expires the wait after the first group past it arrived. + write_group(&mut track, 3, &[ts(520_000)]); + tokio::time::advance(Duration::from_millis(99)).await; + assert!(drain(&mut reader).is_empty()); + tokio::time::advance(Duration::from_millis(1)).await; + assert_eq!(drain(&mut reader), ["gap", "frame 3"]); + + // Or at once, when the newest content is already the wait past where the group after it + // begins. + write_group(&mut track, 5, &[ts(700_000)]); + write_group(&mut track, 6, &[ts(800_000)]); + assert_eq!(drain(&mut reader), ["gap", "frame 5", "frame 6"]); + } + /// A malformed data marker group found while looking ahead fails the reader, rather than /// reading as a gap when a latency skip passes over it. #[tokio::test(start_paused = true)] diff --git a/test/audio-quality/budgets.json b/test/audio-quality/budgets.json index d80f8797bf1..288fa612ff0 100644 --- a/test/audio-quality/budgets.json +++ b/test/audio-quality/budgets.json @@ -1,5 +1,5 @@ { - "note": "The browser rows are measured on the nightly runner (ubuntu-24.04-arm, headless Chromium, seed 7, 60 s a row), from the audio-quality-run artifacts of the seven scheduled Nightly runs on main from 2026-10-29 to 2026-11-04 (40885347517, 41065371094, 41204380716, 41313466339, 41483654426, 41656613559, 41852517544), the first after a fresh subscriber stopped receiving the relay's cached history. The six AAC rows other than congestion are measured the same way from the seven runs from 2026-11-05 to 2026-11-11 (42050683248, 42236107954, 42377867523, 42487375545, 42659882487, 42842827718, 43041909115), the first after the TS importer published each PES as one group; the first four predate the browser's time stretch, and the six rows keep the four provisional ceilings set below from 2026-11-09 and 2026-11-10. Each ceiling is the worst of its seven nights times 1.25, plus one runner hiccup, rounded up to two significant figures. The hiccup is sized from the single gaps the 2026-10-08 night put on otherwise clean rows, the fixed-250 control among them: 250 underruns/min, 700 gap ms/min, 3.3 skips/min, 280 dropped ms/min (both sized on the playhead's skip-ahead inference, and now applied to player_skips_per_min and trimmed_ms_per_min), 0.01 stalled, 0.015 silence, and one 20 ms bucket of target. Budgeted this way, every night passes when it is held out of its row's measurement except one, and that row's own ceiling includes it: the 2026-11-03 Opus bursty row raised its target to 300 ms 2.6 s in and held it for one 20 s half-life before settling at 180. Such startup holds, Opus near-zero's 100 ms on 2026-10-30 and 10-31 among them, are budgeted as measured. These ceilings record today's player as the runner hears it, not target audio quality. To re-measure, download the same artifact from the latest scheduled nightlies (`gh run download -n audio-quality-run`), which keep every run, and apply the same rule. On 2026-11-10 the inferred skip_aheads and discarded_ms keys were dropped, since they read a time stretch's catch-up as dropped audio, and every browser row gained player_skips_per_min, trimmed_ms_per_min, and av_lag_ms p50 and p95, by the same rule from the only two scheduled nights on main with today's browser player and its trim counter, 2026-11-09 and 2026-11-10 (42659882487, 42842827718). A lag is signed, so its ceiling is the worst night plus a quarter of its size plus one 20 ms bucket. These four keys are provisional until seven nights with the stretch model re-measure every row. The grade follows the model: audio rests on the shared clock, trails it through a stall, and catches up after. When a change moves a row, a steady-state lag (av_lag_ms p50) that rises, or audio the player trimmed, is a regression to fix rather than budget; a p95 lag that rises through a stall, or an underrun count that moves, is re-measured in. No ceiling is fixed at zero underruns or zero stalls; a replay row's is exactly what it measured. The replay rows are deterministic, so their ceilings are exactly what they measured, through the end of each recording, with no headroom: any regression fails them, and an improvement should be tightened in. They were last re-measured on 2026-10-22 using version 3 traces with encoded frame durations: AAC-LC uses its fixed 1024 samples, and relay-mic retains Opus packet TOC durations. relay-mic was re-recorded on 2026-11-03 from a real microphone, Chrome 156 on a MacBook Air publishing its built-in microphone through the public relay, recorded by headless Chromium on a Linux host (35 s, minimum RTT 2 ms), which raised its target ceiling from 60 to 80 ms and its silence from 0 to 0.001 as measured. The recording path itself has no added RTT. relay-mic-rtt40 is the 2026-11-03 Chrome row at 40 ms of added RTT on that laptop (180 s, minimum RTT 47 ms), kept as the baseline time stretch improves on; like every replay row, its player_underruns_per_min ceiling is what it measures, not a fixed zero. player_underruns_per_min, the player's own counter that its stats panel shows, is budgeted on the replay rows only; it counts the run-dry re-stalls the tap files as stalled time. On 2026-11-07, after the ordered read stopped delivering groups below its cursor (#8071) and took Rust's hole and age bounds (#8218), relay-bbb was re-measured at 16.1 player underruns/min, 0.025 stalled and 0.02 silence, and relay-mic-rtt40 at 8.2, its discarded audio at 70.9 ms/min and its target p95 at 320 ms rather than 780, since the stale backlog it never played no longer reaches the estimator; neither row lost audio the previous player heard. On 2026-11-08 the player began time-stretching live playback with NetEq's accelerate, deciding on the ring's depth right after each arrival and never expanding, and every replay row was re-measured with it, the browser rows left to the nightly runner. Each row's av_lag_ms, how far the playhead trails the shared clock video plays from, is what it measured: the ring rests one frame ahead of the newest arrival's playout, as the trim it replaces left it, so audio leads the clock by 19 to 23 ms at p50. Against the trim, the A/V lag p50 fell from 0.7, -17.5, -21.5, -18.2 and -15.6 ms to -22.4 on bursty-aac, -22.2 on local-aac, -22.7 on relay-bbb, -19 on relay-mic and -20.1 on relay-mic-rtt40, and its p95 fell on every row, most on relay-bbb (10.5 to -4.2) and relay-mic-rtt40 (-0.9 to -13.4). Underruns stayed where the trim had them, as the latency they would cost is not spent: player_underruns_per_min held at 4.4, 12.1, 16.1 and 6.1 and rose from 8.2 to 10.6 on relay-mic-rtt40, and relay-mic's tap now files 2 short quanta a minute, 2 ms of missing audio, where it filed none. What the stretch buys is the audio the trim dropped: discarded_ms_per_min fell from 87.8 to 0 on relay-bbb and from 127.5 to 100.6 on local-aac, whose remainder drops nothing: two receive stalls 14 and 15.3 s in leave audio 159 and 132 ms behind the clock, and the fast accelerate brings it back within half a second. player_skips_per_min and trimmed_ms_per_min, the ring's own count of re-anchors that dropped buffered audio and the media they dropped, are budgeted beside it, at 0 on every recorded row. relay-mic-stall, added 2026-11-10, is relay-mic with nothing arriving from 15 s to 16.5 s and the held frames then trickling in at twice real time until 18 s; today's player trims 2152.5 ms/min of it and its target p95 rises to 1540 ms. Once durations became whole nanoseconds, relay-bbb's delay, 200 ms plus one 1024-sample AAC frame, rounds up by a fraction of a sample, so its ring holds one more sample (23 µs) and its A/V lag p50 measures -22.6 rather than -22.7. Neither replay calibration changed the browser or native ceilings. bursty-aac is the 2026-10-18 AAC bursty isolated capture, recorded with the observer subscribed at the decoder's 2 s budget, so it holds every group the player saw. The native rows are provisional: measured on a loaded developer host (x86_64 Linux, the private PulseAudio null sink, seed 7, 60 s a row) on 2026-10-17, three runs of every row from the debug build nightly uses plus three more of the AAC rows from a release build, which played alike. Each ceiling is the worst clean run times 1.25, plus one native hiccup sized from the unimpaired Opus row's worst run (20 underruns/min, 50 gap ms/min, 2.2 skips/min, 110 discarded ms/min, 0.01 stalled, 0.005 silence, one 20 ms bucket of target), rounded up to two significant figures. On 2026-11-10, after native playback began reporting its A/V lag (#8361), the native rows' player_skips_per_min, trimmed_ms_per_min, and av_lag_ms p50 and p95, and every key of the native and browser congestion rows, were measured by the same rules from three runs of each on a loaded developer host (x86_64 Linux, the debug build, seed 7, 60 s a row), with no void; native audio rests 9 to 95 ms behind its clock at p50. These are provisional until the stretch model's nightly re-measure, which also moves the browser congestion rows onto the runner. On the 2026-10-17 host the null sink's clock ran about 150 ppm slow against the monotonic clock, read within 5 ms at p95 per sample, and its output latency sat between 14 and 28 ms. Five of the 36 AAC rows (none of the 18 Opus rows) voided on the clock: the device stopped pulling for about two seconds mid-row, sometimes after a backend error and a stream restart, which is a native playback defect rather than noise, and the ceilings exclude those runs. Re-measure from the nightly runner's artifacts once it has a week of native rows. On 2026-11-11 every player began following one stretch rule on the shared clock: it slows down below its target, speeds up above it, and skips only past its bound, which in the browser is the subscription's max delay. Every replay row was re-measured with it, the browser and native rows left to the nightly runner. Audio now rests on the clock rather than one frame ahead of it, so the A/V lag p50 rose from about -20 ms to 0.4 ms on relay-bbb, 1.1 on relay-mic, 1.2 on relay-mic-rtt40 and 1.8 on local-aac. Its p95 rose on every row, since audio that falls behind is now caught up by speeding up rather than trimmed: the shared clock steps forward as its reference converges through a tune-in backlog, and again when a target falls, and audio follows at the accelerate's pace, which on the replay's constant tone is one 2.5 ms period a window, slower than on speech. bursty-aac rests 5 ms behind its clock, so its p50 of 10.4 ms is mostly its catch-ups, and relay-mic-stall's p50 of 66.1 ms is the catch-up after its target falls from 1540 to 80 ms, which outlasts half the row. In exchange nothing is trimmed: relay-mic-stall's trimmed_ms_per_min fell from 2152.5 to 0, its skips from 6.1 to 0, and its underruns from 24.2 to 0 a minute, and player_underruns_per_min fell from 12.1 to 4 on local-aac, 16.1 to 0 on relay-bbb, 6.1 to 0 on relay-mic, 10.6 to 2.7 on relay-mic-rtt40 and 6.1 to 4 on relay-mic-stall, holding at 4.4 on bursty-aac. The tap now files 3.3 to 6.1 short quanta a minute on the AAC rows, under 0.3 ms of missing audio, where it filed none. To deliver the audio a stall delays, the container consumer now waits and skips at the subscription's max delay, as native already does, rather than at the delay plus lookahead. relay-mic-rtt40's join backlog arrives reordered, so the consumer now waits on its holes and the estimator observes the frames that fill them, up to 775 ms late, and its target p95 returns from 320 to 780 ms, held for one half-life after the join. Later on 2026-11-11 audio began skipping as far as the shared clock's reference moves earlier, once those moves add up to one stretch window and only as far as it holds audio past its target, rather than speeding through them, and every replay row was re-measured. The tune-in backlog's jumps now land before the graded window, so the A/V lag p95 fell from 453.1 to 2.1 ms on relay-bbb (its p50 from 0.4 to -1.3), 743.7 to 1.9 on relay-mic-rtt40, whose p50 fell from 1.2 to 0.4 and its tap's missing audio rose from 0.6 to 0.9 ms a minute, since a jump past what is decoded skips the rest once it lands,, 335.5 to 39.2 on local-aac and 88.6 to 0.3 on relay-mic, and the p50 from 66.1 to 25.3 on relay-mic-stall, with nothing trimmed in any graded window. The tap's underruns fell from 6.1 to 2 a minute on local-aac and 6.1 to 0 on relay-bbb; local-aac's silence rose from 0.001 to 0.002.", + "note": "The browser rows are measured on the nightly runner (ubuntu-24.04-arm, headless Chromium, seed 7, 60 s a row), from the audio-quality-run artifacts of the seven scheduled Nightly runs on main from 2026-10-29 to 2026-11-04 (40885347517, 41065371094, 41204380716, 41313466339, 41483654426, 41656613559, 41852517544), the first after a fresh subscriber stopped receiving the relay's cached history. The six AAC rows other than congestion are measured the same way from the seven runs from 2026-11-05 to 2026-11-11 (42050683248, 42236107954, 42377867523, 42487375545, 42659882487, 42842827718, 43041909115), the first after the TS importer published each PES as one group; the first four predate the browser's time stretch, and the six rows keep the four provisional ceilings set below from 2026-11-09 and 2026-11-10. Each ceiling is the worst of its seven nights times 1.25, plus one runner hiccup, rounded up to two significant figures. The hiccup is sized from the single gaps the 2026-10-08 night put on otherwise clean rows, the fixed-250 control among them: 250 underruns/min, 700 gap ms/min, 3.3 skips/min, 280 dropped ms/min (both sized on the playhead's skip-ahead inference, and now applied to player_skips_per_min and trimmed_ms_per_min), 0.01 stalled, 0.015 silence, and one 20 ms bucket of target. Budgeted this way, every night passes when it is held out of its row's measurement except one, and that row's own ceiling includes it: the 2026-11-03 Opus bursty row raised its target to 300 ms 2.6 s in and held it for one 20 s half-life before settling at 180. Such startup holds, Opus near-zero's 100 ms on 2026-10-30 and 10-31 among them, are budgeted as measured. These ceilings record today's player as the runner hears it, not target audio quality. To re-measure, download the same artifact from the latest scheduled nightlies (`gh run download -n audio-quality-run`), which keep every run, and apply the same rule. On 2026-11-10 the inferred skip_aheads and discarded_ms keys were dropped, since they read a time stretch's catch-up as dropped audio, and every browser row gained player_skips_per_min, trimmed_ms_per_min, and av_lag_ms p50 and p95, by the same rule from the only two scheduled nights on main with today's browser player and its trim counter, 2026-11-09 and 2026-11-10 (42659882487, 42842827718). A lag is signed, so its ceiling is the worst night plus a quarter of its size plus one 20 ms bucket. These four keys are provisional until seven nights with the stretch model re-measure every row. The grade follows the model: audio rests on the shared clock, trails it through a stall, and catches up after. When a change moves a row, a steady-state lag (av_lag_ms p50) that rises, or audio the player trimmed, is a regression to fix rather than budget; a p95 lag that rises through a stall, or an underrun count that moves, is re-measured in. No ceiling is fixed at zero underruns or zero stalls; a replay row's is exactly what it measured. The replay rows are deterministic, so their ceilings are exactly what they measured, through the end of each recording, with no headroom: any regression fails them, and an improvement should be tightened in. They were last re-measured on 2026-10-22 using version 3 traces with encoded frame durations: AAC-LC uses its fixed 1024 samples, and relay-mic retains Opus packet TOC durations. relay-mic was re-recorded on 2026-11-03 from a real microphone, Chrome 156 on a MacBook Air publishing its built-in microphone through the public relay, recorded by headless Chromium on a Linux host (35 s, minimum RTT 2 ms), which raised its target ceiling from 60 to 80 ms and its silence from 0 to 0.001 as measured. The recording path itself has no added RTT. relay-mic-rtt40 is the 2026-11-03 Chrome row at 40 ms of added RTT on that laptop (180 s, minimum RTT 47 ms), kept as the baseline time stretch improves on; like every replay row, its player_underruns_per_min ceiling is what it measures, not a fixed zero. player_underruns_per_min, the player's own counter that its stats panel shows, is budgeted on the replay rows only; it counts the run-dry re-stalls the tap files as stalled time. On 2026-11-07, after the ordered read stopped delivering groups below its cursor (#8071) and took Rust's hole and age bounds (#8218), relay-bbb was re-measured at 16.1 player underruns/min, 0.025 stalled and 0.02 silence, and relay-mic-rtt40 at 8.2, its discarded audio at 70.9 ms/min and its target p95 at 320 ms rather than 780, since the stale backlog it never played no longer reaches the estimator; neither row lost audio the previous player heard. On 2026-11-08 the player began time-stretching live playback with NetEq's accelerate, deciding on the ring's depth right after each arrival and never expanding, and every replay row was re-measured with it, the browser rows left to the nightly runner. Each row's av_lag_ms, how far the playhead trails the shared clock video plays from, is what it measured: the ring rests one frame ahead of the newest arrival's playout, as the trim it replaces left it, so audio leads the clock by 19 to 23 ms at p50. Against the trim, the A/V lag p50 fell from 0.7, -17.5, -21.5, -18.2 and -15.6 ms to -22.4 on bursty-aac, -22.2 on local-aac, -22.7 on relay-bbb, -19 on relay-mic and -20.1 on relay-mic-rtt40, and its p95 fell on every row, most on relay-bbb (10.5 to -4.2) and relay-mic-rtt40 (-0.9 to -13.4). Underruns stayed where the trim had them, as the latency they would cost is not spent: player_underruns_per_min held at 4.4, 12.1, 16.1 and 6.1 and rose from 8.2 to 10.6 on relay-mic-rtt40, and relay-mic's tap now files 2 short quanta a minute, 2 ms of missing audio, where it filed none. What the stretch buys is the audio the trim dropped: discarded_ms_per_min fell from 87.8 to 0 on relay-bbb and from 127.5 to 100.6 on local-aac, whose remainder drops nothing: two receive stalls 14 and 15.3 s in leave audio 159 and 132 ms behind the clock, and the fast accelerate brings it back within half a second. player_skips_per_min and trimmed_ms_per_min, the ring's own count of re-anchors that dropped buffered audio and the media they dropped, are budgeted beside it, at 0 on every recorded row. relay-mic-stall, added 2026-11-10, is relay-mic with nothing arriving from 15 s to 16.5 s and the held frames then trickling in at twice real time until 18 s; today's player trims 2152.5 ms/min of it and its target p95 rises to 1540 ms. Once durations became whole nanoseconds, relay-bbb's delay, 200 ms plus one 1024-sample AAC frame, rounds up by a fraction of a sample, so its ring holds one more sample (23 µs) and its A/V lag p50 measures -22.6 rather than -22.7. Neither replay calibration changed the browser or native ceilings. bursty-aac is the 2026-10-18 AAC bursty isolated capture, recorded with the observer subscribed at the decoder's 2 s budget, so it holds every group the player saw. The native rows are provisional: measured on a loaded developer host (x86_64 Linux, the private PulseAudio null sink, seed 7, 60 s a row) on 2026-10-17, three runs of every row from the debug build nightly uses plus three more of the AAC rows from a release build, which played alike. Each ceiling is the worst clean run times 1.25, plus one native hiccup sized from the unimpaired Opus row's worst run (20 underruns/min, 50 gap ms/min, 2.2 skips/min, 110 discarded ms/min, 0.01 stalled, 0.005 silence, one 20 ms bucket of target), rounded up to two significant figures. On 2026-11-10, after native playback began reporting its A/V lag (#8361), the native rows' player_skips_per_min, trimmed_ms_per_min, and av_lag_ms p50 and p95, and every key of the native and browser congestion rows, were measured by the same rules from three runs of each on a loaded developer host (x86_64 Linux, the debug build, seed 7, 60 s a row), with no void; native audio rests 9 to 95 ms behind its clock at p50. These are provisional until the stretch model's nightly re-measure, which also moves the browser congestion rows onto the runner. On the 2026-10-17 host the null sink's clock ran about 150 ppm slow against the monotonic clock, read within 5 ms at p95 per sample, and its output latency sat between 14 and 28 ms. Five of the 36 AAC rows (none of the 18 Opus rows) voided on the clock: the device stopped pulling for about two seconds mid-row, sometimes after a backend error and a stream restart, which is a native playback defect rather than noise, and the ceilings exclude those runs. Re-measure from the nightly runner's artifacts once it has a week of native rows. On 2026-11-11 every player began following one stretch rule on the shared clock: it slows down below its target, speeds up above it, and skips only past its bound, which in the browser is the subscription's max delay. Every replay row was re-measured with it, the browser and native rows left to the nightly runner. Audio now rests on the clock rather than one frame ahead of it, so the A/V lag p50 rose from about -20 ms to 0.4 ms on relay-bbb, 1.1 on relay-mic, 1.2 on relay-mic-rtt40 and 1.8 on local-aac. Its p95 rose on every row, since audio that falls behind is now caught up by speeding up rather than trimmed: the shared clock steps forward as its reference converges through a tune-in backlog, and again when a target falls, and audio follows at the accelerate's pace, which on the replay's constant tone is one 2.5 ms period a window, slower than on speech. bursty-aac rests 5 ms behind its clock, so its p50 of 10.4 ms is mostly its catch-ups, and relay-mic-stall's p50 of 66.1 ms is the catch-up after its target falls from 1540 to 80 ms, which outlasts half the row. In exchange nothing is trimmed: relay-mic-stall's trimmed_ms_per_min fell from 2152.5 to 0, its skips from 6.1 to 0, and its underruns from 24.2 to 0 a minute, and player_underruns_per_min fell from 12.1 to 4 on local-aac, 16.1 to 0 on relay-bbb, 6.1 to 0 on relay-mic, 10.6 to 2.7 on relay-mic-rtt40 and 6.1 to 4 on relay-mic-stall, holding at 4.4 on bursty-aac. The tap now files 3.3 to 6.1 short quanta a minute on the AAC rows, under 0.3 ms of missing audio, where it filed none. To deliver the audio a stall delays, the container consumer now waits and skips at the subscription's max delay, as native already does, rather than at the delay plus lookahead. relay-mic-rtt40's join backlog arrives reordered, so the consumer now waits on its holes and the estimator observes the frames that fill them, up to 775 ms late, and its target p95 returns from 320 to 780 ms, held for one half-life after the join. Later on 2026-11-11 audio began skipping as far as the shared clock's reference moves earlier, once those moves add up to one stretch window and only as far as it holds audio past its target, rather than speeding through them, and every replay row was re-measured. The tune-in backlog's jumps now land before the graded window, so the A/V lag p95 fell from 453.1 to 2.1 ms on relay-bbb (its p50 from 0.4 to -1.3), 743.7 to 1.9 on relay-mic-rtt40, whose p50 fell from 1.2 to 0.4 and its tap's missing audio rose from 0.6 to 0.9 ms a minute, since a jump past what is decoded skips the rest once it lands,, 335.5 to 39.2 on local-aac and 88.6 to 0.3 on relay-mic, and the p50 from 66.1 to 25.3 on relay-mic-stall, with nothing trimmed in any graded window. The tap's underruns fell from 6.1 to 2 a minute on local-aac and 6.1 to 0 on relay-bbb; local-aac's silence rose from 0.001 to 0.002. Later on 2026-11-11 the container consumer began waiting on a missing group only for the delay plus the lookahead, while still delivering groups that arrived until they age past the max delay, and every replay row was re-measured. relay-mic-rtt40's target p95 fell from 780 back to 320 ms, since the holes in its reordered join backlog no longer delay the frames behind them; its tap's missing audio rose from 0.9 to 1.1 ms a minute and its A/V lag p50 and p95 from 0.4 and 1.9 to 0.7 and 2.4 ms. bursty-aac's silence rose from 0.007 to 0.009 and its A/V lag p95 fell from 162.1 to 156.3 ms, and relay-bbb's lag p50 and p95 moved from -1.3 and 2.1 to -1.2 and 2.2 ms. relay-mic-stall did not move.", "rows": [ { "runtime": "chromium", @@ -432,10 +432,10 @@ "underrun_ms_per_min": 0.1, "trimmed_ms_per_min": 0, "stalled_share": 0.005, - "silence_share": 0.007, + "silence_share": 0.009, "target_ms_p95": 343.2, "av_lag_ms_p50": 10.4, - "av_lag_ms_p95": 162.1 + "av_lag_ms_p95": 156.3 }, { "runtime": "replay", @@ -466,8 +466,8 @@ "stalled_share": 0, "silence_share": 0, "target_ms_p95": 223.2, - "av_lag_ms_p50": -1.3, - "av_lag_ms_p95": 2.1 + "av_lag_ms_p50": -1.2, + "av_lag_ms_p95": 2.2 }, { "runtime": "replay", @@ -493,13 +493,13 @@ "player_underruns_per_min": 2.7, "player_skips_per_min": 0, "underruns_per_min": 0.7, - "underrun_ms_per_min": 0.9, + "underrun_ms_per_min": 1.1, "trimmed_ms_per_min": 0, "stalled_share": 0, "silence_share": 0, - "target_ms_p95": 780, - "av_lag_ms_p50": 0.4, - "av_lag_ms_p95": 1.9 + "target_ms_p95": 320, + "av_lag_ms_p50": 0.7, + "av_lag_ms_p95": 2.4 }, { "runtime": "replay",