diff --git a/js/watch/src/audio/terminal.test.ts b/js/watch/src/audio/terminal.test.ts index b3581701e7..ad3901b6ff 100644 --- a/js/watch/src/audio/terminal.test.ts +++ b/js/watch/src/audio/terminal.test.ts @@ -242,3 +242,27 @@ 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); +}); + +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 fccbe8716d..4f3c452e51 100644 --- a/js/watch/src/audio/terminal.ts +++ b/js/watch/src/audio/terminal.ts @@ -188,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/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..b867502132 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()?; + self.warmup_pending = !self.warmup.is_zero(); if fresh { self.fresh_encoder(); } - self.warmup_pending = !self.warmup.is_zero(); self.ready.push_back(Read::Gap { timestamp, duration }); continue; } @@ -798,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 @@ -1200,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. @@ -1222,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 } { @@ -1527,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() { @@ -2700,12 +2726,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