From 8c3e25e523704a9645dbc6ab23e7216c55da3f3c Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Thu, 19 Nov 2026 17:55:31 -0800 Subject: [PATCH 1/3] chore(quest): claim quest/m0/nightly/push-to-talk-native.md Quest-Claim: 72478612baa53a25 From 30773ee29ac4fb475fd19d58e824f9446ca295d4 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Thu, 19 Nov 2026 18:52:50 -0800 Subject: [PATCH 2/3] fix(audio): a gap after a declared end does not clip the next utterance Since groups are keyed by start (#9027), the run a publisher skips across a pause arrives on moq-lite-06 as a drop, so every resume after a declared end reads as End, Gap, then the fresh encoder's first packet. Both players primed the codec warmup there, trimming the first 80 ms of every utterance. A gap after a declared end now reaches the fresh encoder's first packet unprimed, as a declared end alone does. Co-Authored-By: Claude Opus 5.5 --- js/watch/src/audio/terminal.test.ts | 13 ++++++++++ js/watch/src/audio/terminal.ts | 5 +++- quest/m0/nightly/push-to-talk-native.md | 33 ------------------------- rs/moq-audio/src/decode/consumer.rs | 19 ++++++++------ 4 files changed, 28 insertions(+), 42 deletions(-) delete mode 100644 quest/m0/nightly/push-to-talk-native.md diff --git a/js/watch/src/audio/terminal.test.ts b/js/watch/src/audio/terminal.test.ts index b3581701e7..45ca1a82ca 100644 --- a/js/watch/src/audio/terminal.test.ts +++ b/js/watch/src/audio/terminal.test.ts @@ -242,3 +242,16 @@ test("a fresh encoder after a declared end takes no pre-roll from the stopped on expect(terminal.preroll()).toEqual([]); expect(terminal.span(opus(2_000_000)).frames).toBe(0); }); + +test("a gap after a declared end reaches the fresh encoder's first frame unprimed", () => { + const terminal = new Terminal(); + terminal.clear(0, 80_000); + terminal.update(frame(0n, 0)); + terminal.decoded(packet(0), Duration.micros(20_000)); + terminal.update(end(1n, 20_000)); + // Before lite-07 the run the publisher skipped across the silence arrives as a drop. + terminal.update(gap); + expect(terminal.update(frame(2n, 1_000_000))).toBe(true); + expect(terminal.preroll()).toEqual([]); + expect(terminal.span(opus(1_000_000)).frames).toBe(960); +}); diff --git a/js/watch/src/audio/terminal.ts b/js/watch/src/audio/terminal.ts index fccbe8716d..0c68c49975 100644 --- a/js/watch/src/audio/terminal.ts +++ b/js/watch/src/audio/terminal.ts @@ -88,7 +88,10 @@ export class Terminal { /** Apply one ordered consumer read and report whether a codec epoch ended before it. */ update(read: Update): boolean { if (read.kind === "gap") { - this.#prime = true; + // A gap after a declared end reaches the fresh encoder's first frame, which decodes unprimed + // as after any declared end: a wire before lite-07 names the run the publisher skipped + // across its silence a drop, so after every pause this gap is that silence, not lost media. + if (this.#end === undefined) this.#prime = true; this.#before = undefined; this.#preroll = []; this.#prerollEnd = undefined; diff --git a/quest/m0/nightly/push-to-talk-native.md b/quest/m0/nightly/push-to-talk-native.md deleted file mode 100644 index f44b621ab1..0000000000 --- a/quest/m0/nightly/push-to-talk-native.md +++ /dev/null @@ -1,33 +0,0 @@ -# [M] Push-to-talk plays on the native listener again - -## Goal - -Nightly's Audio quality push-to-talk step passes its four native-listener -checks again, with the cause found and fixed rather than a ceiling moved. - -## Plan - -Found by [moq-dev/moq#9139](https://github.com/moq-dev/moq/pull/9139), which -saw the push-to-talk row fail on 2026-11-18 (run -[44342367698](https://github.com/moq-dev/moq/actions/runs/44342367698)); it failed again on 2026-11-19 -([44562804083](https://github.com/moq-dev/moq/actions/runs/44562804083)) and passed on 2026-11-17. All four native -checks fail together and the native metrics come back null, so the analyzer -cannot line up the native clock with the page's: - -``` -native: an utterance did not resume on its head; ... no playback from the first press; ... -"native": {"offset": null, ... "comfort": null} -``` - -Null metrics suggest the native listener played nothing, not that it played -badly. It broke between the 2026-11-17 and 2026-11-18 heads; bisect that -range first. Suspects that touch the native or publish audio path: -[moq-dev/moq#8984](https://github.com/moq-dev/moq/pull/8984), -[moq-dev/moq#9027](https://github.com/moq-dev/moq/pull/9027), and -[moq-dev/moq#9031](https://github.com/moq-dev/moq/pull/9031). Reproduce -locally with the Audio quality job's push-to-talk step; never dispatch -Nightly. - -Caused by: whichever PR the bisect names. - -Public API: none expected. Wire: none expected. diff --git a/rs/moq-audio/src/decode/consumer.rs b/rs/moq-audio/src/decode/consumer.rs index b23f484e21..35e288a6bf 100644 --- a/rs/moq-audio/src/decode/consumer.rs +++ b/rs/moq-audio/src/decode/consumer.rs @@ -431,13 +431,15 @@ impl Consumer { self.boundary = Some(Duration::try_from(timestamp)?); self.started = true; // Groups lost past a declared end were the fresh encoder's, so the packet - // after them still comes from it. + // after them still comes from it, and decodes as its first, unprimed: a wire + // before lite-07 names the run the publisher skipped across its silence a + // drop, so after every pause this gap is that silence, not lost media. let fresh = self.end.is_some(); self.restart()?; - if fresh { - self.fresh_encoder(); + match fresh { + true => self.fresh_encoder(), + false => self.warmup_pending = !self.warmup.is_zero(), } - self.warmup_pending = !self.warmup.is_zero(); self.ready.push_back(Read::Gap { timestamp, duration }); continue; } @@ -2700,12 +2702,13 @@ mod tests { assert_eq!(after_loss(true, None).await[0], (1_000_000, 960 - 312)); } - /// The stopped encoder's history primes none of the fresh encoder's warmup, so a loss of - /// its first groups trims the whole warmup after them. + /// A gap after a declared end reaches the fresh encoder's first packet, which plays from its + /// own stamp rather than a warmup later: before lite-07 the run skipped across every pause + /// arrives as a drop, so priming there would clip the start of each utterance. #[tokio::test(start_paused = true)] - async fn a_loss_after_a_declared_end_trims_the_whole_warmup() { + async fn a_gap_after_a_declared_end_trims_no_warmup() { let warmup = Some(Duration::from_millis(10)); - assert_eq!(after_loss(true, warmup).await[0].0, 1_010_000); + assert_eq!(after_loss(true, warmup).await[0], (1_000_000, 960 - 312)); } /// Decodes two Opus packets, then, past lost groups and a declared end if `declared`, one From d8c196d01a1a65015981f4fdf7751d624b2745cd Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Thu, 19 Nov 2026 19:13:37 -0800 Subject: [PATCH 3/3] fix(audio): a join during a pause plays the fresh encoder's first packet whole A fresh encoder's first packet needs no warmup, so starting one drops the warmup a join or a gap left pending, in both players. Co-Authored-By: Claude Opus 5.5 --- js/watch/src/audio/terminal.test.ts | 11 ++++++++++ js/watch/src/audio/terminal.ts | 10 ++++----- rs/moq-audio/src/decode/consumer.rs | 32 +++++++++++++++++++++++++---- 3 files changed, 44 insertions(+), 9 deletions(-) diff --git a/js/watch/src/audio/terminal.test.ts b/js/watch/src/audio/terminal.test.ts index 45ca1a82ca..ad3901b6ff 100644 --- a/js/watch/src/audio/terminal.test.ts +++ b/js/watch/src/audio/terminal.test.ts @@ -255,3 +255,14 @@ test("a gap after a declared end reaches the fresh encoder's first frame unprime expect(terminal.preroll()).toEqual([]); expect(terminal.span(opus(1_000_000)).frames).toBe(960); }); + +test("a join during a pause plays the fresh encoder's first frame whole, past a gap or not", () => { + for (const gapped of [false, true]) { + const terminal = new Terminal(); + terminal.clear(0, 80_000); + terminal.update(end(1n, 20_000)); + if (gapped) terminal.update(gap); + expect(terminal.update(frame(2n, 1_000_000))).toBe(true); + expect(terminal.span(opus(1_000_000)).frames).toBe(960); + } +}); diff --git a/js/watch/src/audio/terminal.ts b/js/watch/src/audio/terminal.ts index 0c68c49975..4f3c452e51 100644 --- a/js/watch/src/audio/terminal.ts +++ b/js/watch/src/audio/terminal.ts @@ -88,10 +88,7 @@ export class Terminal { /** Apply one ordered consumer read and report whether a codec epoch ended before it. */ update(read: Update): boolean { if (read.kind === "gap") { - // A gap after a declared end reaches the fresh encoder's first frame, which decodes unprimed - // as after any declared end: a wire before lite-07 names the run the publisher skipped - // across its silence a drop, so after every pause this gap is that silence, not lost media. - if (this.#end === undefined) this.#prime = true; + this.#prime = true; this.#before = undefined; this.#preroll = []; this.#prerollEnd = undefined; @@ -191,7 +188,10 @@ export class Terminal { this.#end = undefined; this.#endGroup = undefined; this.#before = undefined; - // A fresh encoder's first packets need no frames of the stopped one ahead of them. + // A fresh encoder's first packets need no frames of the stopped one ahead of them, and no + // warmup a join or a gap left pending: a wire before lite-07 names the run the publisher + // skipped across its silence a drop, so after every pause a gap reaches this frame too. + this.#prime = false; this.#forget(); this.#resetEpoch(); } diff --git a/rs/moq-audio/src/decode/consumer.rs b/rs/moq-audio/src/decode/consumer.rs index 35e288a6bf..b867502132 100644 --- a/rs/moq-audio/src/decode/consumer.rs +++ b/rs/moq-audio/src/decode/consumer.rs @@ -436,9 +436,9 @@ impl Consumer { // drop, so after every pause this gap is that silence, not lost media. let fresh = self.end.is_some(); self.restart()?; - match fresh { - true => self.fresh_encoder(), - false => self.warmup_pending = !self.warmup.is_zero(), + self.warmup_pending = !self.warmup.is_zero(); + if fresh { + self.fresh_encoder(); } self.ready.push_back(Read::Gap { timestamp, duration }); continue; @@ -800,10 +800,12 @@ impl Consumer { } /// Expect a fresh encoder's packets: its pre-skip is trimmed again, and the stopped - /// encoder's history primes none of its warmup. + /// encoder's history primes none of its warmup. Its first packet needs no warmup either, so + /// one a join or a gap left pending is dropped. fn fresh_encoder(&mut self) { self.decoder.reapply_delay(); self.primed = Duration::ZERO; + self.warmup_pending = false; } /// Reset resampling state at a hole, returning whatever the resampler was still @@ -1202,6 +1204,9 @@ mod tests { Lost, /// A timestamp jump across contiguous groups. Undeclared, + /// A declared end, then a seek past the starts after it, as a wire before lite-07 delivers + /// the run a publisher skipped across a pause. + DeclaredGap, } /// Decodes `first` packets, then six more a second later, past a `cut` in the timeline. @@ -1224,6 +1229,10 @@ mod tests { Break::Declared => producer.discontinuity().unwrap(), Break::Lost => producer.seek(1_000_000).unwrap(), Break::Undeclared => {} + Break::DeclaredGap => { + producer.discontinuity().unwrap(); + producer.seek(1_000_000).unwrap(); + } } } for packet in 0..if epoch == 0 { first } else { 6 } { @@ -1529,6 +1538,21 @@ mod tests { assert_eq!(frames, 8 * 960); } + /// A join during a pause reaches a fresh encoder's first packet, which needs no warmup, past a + /// gap or not. + #[tokio::test(start_paused = true)] + async fn a_join_during_a_pause_trims_no_warmup() { + for cut in [Break::Declared, Break::DeclaredGap] { + let (stamps, frames) = warmup_output(cut, 0).await; + assert_eq!( + stamps, + [1_000_000, 1_020_000, 1_040_000, 1_060_000, 1_080_000, 1_100_000], + "{cut:?}" + ); + assert_eq!(frames, 6 * 960, "{cut:?}"); + } + } + /// The codec's history primes it across a gap, so only the warmup it falls short of is trimmed. #[tokio::test(start_paused = true)] async fn a_gap_trims_the_warmup_the_history_leaves() {