diff --git a/doc/concept/audio-jitter.md b/doc/concept/audio-jitter.md index 64528e7788b..d52fff6e7f5 100644 --- a/doc/concept/audio-jitter.md +++ b/doc/concept/audio-jitter.md @@ -766,7 +766,10 @@ encoded, and a buffered player its whole lookahead, while native playback decodes everything at once. The browser's decode gate releases a playing ring's next frame while what it was given, landed or still decoding, reaches less than its floor and one window past the playhead, so the ring always holds a full -window to stretch, and a hole in the media plays as silence. +window to stretch, and a hole in the media plays as silence. A frame stamped +within a millisecond and two samples of where the last one ended continues it +in both players: millisecond stamps, or ones rounded from another clock, land +either side of the exact boundary, which is no hole. A zero `stretch` turns the stretch off, for content where a pitch-period splice is audible, such as music. Every window holds, so received audio plays diff --git a/js/watch/src/audio/replay.test.ts b/js/watch/src/audio/replay.test.ts index 0ebc9615708..fae4282f3fd 100644 --- a/js/watch/src/audio/replay.test.ts +++ b/js/watch/src/audio/replay.test.ts @@ -159,8 +159,11 @@ async function lag(trace: Arrival[], options: Options, settle: number) { return { lags, median: lags[lags.length >> 1], underruns, trimmed, accelerated }; } -/** The shortest pitch period a seam moves by: 2.5 ms. A lag shorter than that cannot be corrected. */ -const PERIOD = 2.5; +/** + * The longest pitch period of the replay's speech, at its 90 Hz floor: a seam moves by one period, so + * a lag shorter than that may rest uncorrected. + */ +const PERIOD = 1000 / 90; // Audio and video keep separate clocks that align once the delay covers the arrivals. The ring plays // onto the shared clock: in steady state the playhead rests within a pitch period of it, either way. @@ -373,8 +376,8 @@ describe("buffered replay against the shared clock", () => { lookahead: 500, duration: observed(30), }; - // NetEq's accelerate takes one pitch period per stretch, so this 2.5 ms tone gains about 30 ms a - // second: the stall's lag is gone well before 20 s. + // NetEq's accelerate takes one pitch period per stretch, at least 4.5 ms of this speech, so it + // gains well over 100 ms a second: the stall's lag is gone well before 20 s. const result = await play(trace, options, (at) => (at >= 2000 && at < 5000) || at >= 20_000); expect(result.min).toBeGreaterThanOrEqual(-PERIOD); expect(result.max).toBeLessThanOrEqual(PERIOD); diff --git a/js/watch/src/audio/replay.ts b/js/watch/src/audio/replay.ts index 156d1b4720f..575d731981a 100644 --- a/js/watch/src/audio/replay.ts +++ b/js/watch/src/audio/replay.ts @@ -99,6 +99,70 @@ export interface Quantum { accelerated: number; } +/** + * A seeded speech-like signal, a pure function of media time so every replay hears the same audio. + * + * A constant gives the stretch's pitch search its shortest period everywhere, so catching up removes + * one 2.5 ms period a window; speech's longer, varying periods and pauses let it catch up as fast as + * a real talker does. Syllables of 120 to 300 ms glide the fundamental between 90 and 220 Hz under a + * raised-cosine level, with pauses of 100 to 400 ms between some. The floor stays above the harness's + * -60 dBFS silence classifier, and no sample is exactly zero, which the output tap reads as missing. + */ +export class Speech { + readonly #rate: number; + readonly #origin: number; + #samples = new Float32Array(0); + #length = 0; + #phase = 0; + #seed = 0x5eed; + + /** `origin` is the earliest media timestamp read, in ms. */ + constructor(rate: number, origin: number) { + this.#rate = rate; + this.#origin = origin; + } + + /** `count` samples starting at media timestamp `timestamp`, in ms. */ + read(timestamp: number, count: number): Float32Array { + const start = Math.round(((timestamp - this.#origin) * this.#rate) / 1000); + if (start < 0) throw new Error(`speech read at ${timestamp} ms, before its ${this.#origin} ms origin`); + while (this.#length < start + count) this.#syllable(); + return this.#samples.slice(start, start + count); + } + + /** Mulberry32: uniform in [lo, hi). */ + #random(lo: number, hi: number): number { + this.#seed = (this.#seed + 0x6d2b79f5) | 0; + let t = this.#seed; + t = Math.imul(t ^ (t >>> 15), t | 1); + t ^= t + Math.imul(t ^ (t >>> 7), t | 61); + return lo + (((t ^ (t >>> 14)) >>> 0) / 4294967296) * (hi - lo); + } + + #syllable() { + const FLOOR = 0.03; + const pause = this.#random(0, 1) < 0.25; + const count = Math.round((this.#rate * (pause ? this.#random(100, 400) : this.#random(120, 300))) / 1000); + const from = this.#random(90, 220); + const to = this.#random(90, 220); + const peak = pause ? FLOOR : this.#random(0.1, 0.5); + if (this.#samples.length < this.#length + count) { + const grown = new Float32Array(Math.max(2 * this.#samples.length, this.#length + count)); + grown.set(this.#samples.subarray(0, this.#length)); + this.#samples = grown; + } + for (let i = 0; i < count; i++) { + const x = i / count; + this.#phase += (2 * Math.PI * (from + (to - from) * x)) / this.#rate; + const level = FLOOR + (peak - FLOOR) * 0.5 * (1 - Math.cos(2 * Math.PI * x)); + const p = this.#phase; + const value = level * (Math.sin(p) + 0.5 * Math.sin(2 * p) + 0.25 * Math.sin(3 * p)) * 0.6; + this.#samples[this.#length + i] = Math.abs(value) < 1e-6 ? 1e-6 : value; + } + this.#length += count; + } +} + /** Samples as the milliseconds `AudioBuffer` posts to the worklet. */ const millis = (rate: number, samples: number) => (samples / rate) * 1000; @@ -117,7 +181,7 @@ const settle = () => new Promise((resolve) => setImmediate(resolve)); * Play `trace` in simulated real time, yielding every render quantum from the first arrival to the * end of the observation. * - * A group's stream finishes with its last recorded frame. The audio is a constant, never zero, so + * A group's stream finishes with its last recorded frame. The audio is {@link Speech}, never zero, so * what the ring did not supply is exactly the zeros at the end of a quantum, which is how the * harness's output tap reads a real page. */ @@ -139,6 +203,8 @@ export async function* replay(trace: Arrival[], options: Options): AsyncGenerato // Where each group's stream finishes. const ends = new Map(); + const origin = trace.reduce((min, a) => Math.min(min, a.timestamp), Infinity); + const speech = new Speech(rate, origin); trace.forEach((arrival, i) => { ends.set(arrival.group, i); }); @@ -239,7 +305,7 @@ export async function* replay(trace: Arrival[], options: Options): AsyncGenerato ring.received(timestamp + micros(entry.duration)); await gate.wait(timestamp, abort.signal); if (abort.signal.aborted) return; - const pcm = new Float32Array(Math.round((entry.duration * rate) / 1000)).fill(0.5); + const pcm = speech.read(entry.timestamp, Math.round((entry.duration * rate) / 1000)); ring.write(timestamp, [pcm]); // The decoder reports each output to the gate the way `AudioBuffer` and `Decoder.#emit` do. const end = timestamp + micros((pcm.length / rate) * 1000); diff --git a/js/watch/src/audio/ring-buffer.test.ts b/js/watch/src/audio/ring-buffer.test.ts index cf99146f462..ff957bebab6 100644 --- a/js/watch/src/audio/ring-buffer.test.ts +++ b/js/watch/src/audio/ring-buffer.test.ts @@ -113,6 +113,22 @@ describe("writing data", () => { } }); + it("plays frames stamped within a millisecond of contiguous as contiguous", () => { + const buffer = exact({ rate: 48000, channels: 1, latency: 10 }); + // 480 samples is 10 ms. The second frame is stamped 1 ms late, the third 2 samples early (of + // the second's actual end), and the fourth after a real 2 ms hole. + write(buffer, 0, 480, { value: 1 }); + write(buffer, 11, 480, { value: 2 }); + write(buffer, (960 - 2) / 48, 480, { value: 3 }); + write(buffer, (1440 + 96) / 48, 480, { value: 4 }); + expect(buffer.length).toBe(4 * 480 + 96); + + const output = read(buffer, 4 * 480 + 96, 1)[0]; + expect(output.subarray(0, 1440).every((v, i) => v === 1 + Math.floor(i / 480))).toBe(true); + expect(output.subarray(1440, 1536).every((v) => v === 0)).toBe(true); + expect(output.subarray(1536).every((v) => v === 4)).toBe(true); + }); + // These drain the ring below its floor without refilling it, which the stretch slows down for, so // they run exact. it("should handle late-arriving samples (out-of-order writes)", () => { @@ -555,6 +571,17 @@ describe("declared end", () => { expect(buffer.silent).toBe(false); }); + it("ends where contiguous frames end, not at their jittered stamp", () => { + const buffer = new AudioRingBuffer({ rate: 48000, channels: 1, latency: 10 }); + // The second frame is stamped 1 ms late, so it plays from sample 480 and ends at 960, not 1008. + buffer.end(21_000); + write(buffer, 0, 480, { channels: 1 }); + write(buffer, 11, 480, { channels: 1 }); + expect(read(buffer, 1024, 1)[0].length).toBe(960); + expect(buffer.silent).toBe(true); + expect(buffer.underruns).toBe(0); + }); + it("counts running dry short of the end as an underrun", () => { const buffer = new AudioRingBuffer({ rate: 1000, channels: 1, latency: 20 }); write(buffer, 0, 20, { channels: 1 }); diff --git a/js/watch/src/audio/ring-buffer.ts b/js/watch/src/audio/ring-buffer.ts index c1bd09e2aa3..5ed35381afa 100644 --- a/js/watch/src/audio/ring-buffer.ts +++ b/js/watch/src/audio/ring-buffer.ts @@ -256,6 +256,11 @@ export class AudioRingBuffer { this.#writeIndex = start; this.#anchored = true; this.#level = Math.max(this.#received ?? start, start) - start; + } else if (this.#contiguous(start)) { + // A frame starting within a millisecond and two samples of where the last one ended + // continues it: timestamps stamped in milliseconds, or rounded from another clock, land on + // either side of the exact boundary, and a hole there would play a few samples of silence. + start = this.#writeIndex; } // Ignore samples behind the read index, which runs ahead of the playhead by the staged window: @@ -294,10 +299,6 @@ export class AudioRingBuffer { // Fill gaps with zeros if there's a discontinuity if (start > this.#writeIndex) { const gapSize = Math.min(start - this.#writeIndex, this.#buffer[0].length); - if (gapSize === 1) { - console.warn("floating point inaccuracy detected"); - } - for (let channel = 0; channel < this.channels; channel++) { const dst = this.#buffer[channel]; for (let i = 0; i < gapSize; i++) { @@ -325,6 +326,7 @@ export class AudioRingBuffer { if (end > this.#writeIndex) { this.#writeIndex = end; } + this.#snapEnd(); // Decoded audio arrived too, if no message said so first. this.received((end / this.rate) * 1_000_000); this.#resume(); @@ -371,11 +373,24 @@ export class AudioRingBuffer { */ end(timestamp: number): void { this.#end = Math.round((timestamp / 1_000_000) * this.rate); + this.#snapEnd(); // The end can arrive after the playhead already ran out at it, or before any audio, as for a // listener that joins during a mute. if (!this.#anchored || (this.#stalled && this.length <= 0 && this.#ended())) this.#silent = true; } + // Whether `index` is within a millisecond and two samples of the write index: the jitter of + // timestamps stamped in milliseconds or rounded from another clock. + #contiguous(index: number): boolean { + return Math.abs(index - this.#writeIndex) <= this.rate / 1000 + 2; + } + + // Move a declared end within that jitter of the written audio onto its end, since frames are placed + // contiguously rather than at their stamps. + #snapEnd(): void { + if (this.#anchored && this.#end !== undefined && this.#contiguous(this.#end)) this.#end = this.#writeIndex; + } + // Move the read index forward to `index`, dropping any queued audio it passes, staged included, // and the front of the incoming chunk at `start` when `index` lies past it. The caller counts the // skip; an empty ring only re-anchors over a gap it never held, so the trim does not move, as in diff --git a/quest/m1/audio-jitter-target/speech-replay.md b/quest/m1/audio-jitter-target/speech-replay.md deleted file mode 100644 index 9a305cef15b..00000000000 --- a/quest/m1/audio-jitter-target/speech-replay.md +++ /dev/null @@ -1,30 +0,0 @@ -# [S] Replays play a speech-like signal - -## Goal - -The audio-quality replays drive the players with a signal whose pitch -period and level vary like speech, so a replay's lag p95 measures how fast -the player catches up, not how slowly the time stretch removes periods from -a constant tone. - -## Plan - -Decided 2026-11-11 (maintainer, /quest-merge pick of -[moq-dev/moq#8507](https://github.com/moq-dev/moq/pull/8507)): keep. - -On the replays' constant tone, the pitch search removes one 2.5 ms period a -30 ms window, so every replay p95 lag after a stall is a slow catch-up that -speech would finish faster (#8507's relay-mic-stall p95: 501.8 ms). - -Recommendations: - -- Synthesize the signal in the harness (a varying fundamental with - syllable-rate level changes and short pauses above the -60 dBFS silence - classifier), seeded, so replays stay deterministic and no clip needs a - license. -- Re-measure the replay ceilings in `test/audio-quality/budgets.json` in the - same PR, noting the signal change. - -## Related - -- [ViSQOL](/quest/m4/audio-visqol.md) - scores a recorded clip on the live rows; this changes only the replays' synthetic input diff --git a/rs/moq-cli/src/play/timeline.rs b/rs/moq-cli/src/play/timeline.rs index 4e9f49889d2..61a9259735f 100644 --- a/rs/moq-cli/src/play/timeline.rs +++ b/rs/moq-cli/src/play/timeline.rs @@ -130,13 +130,20 @@ impl AudioTimeline { // keeps the next frame contiguous with the new timeline position. let origin = *self.origin.get_or_insert(start); let expected = (start.saturating_sub(origin).as_secs_f64() * sample_rate as f64).round() as u64; + // A hole within that rounding is the same jitter, not missing audio: the frame continues + // the last one rather than playing a few samples of silence ahead of it. let hole = expected.saturating_sub(self.written); + let hole = if (hole as f64) <= tolerance.as_secs_f64() * sample_rate as f64 { + 0 + } else { + hole + }; let skipped = hole > fill_max; let silence = if skipped { 0 } else { hole }; let reset_sink = rewound || skipped; self.written = self .written - .max(expected) + .saturating_add(hole) .saturating_add(u64::try_from(samples).unwrap_or(u64::MAX)); self.end = Some(end); @@ -234,6 +241,12 @@ mod tests { // 1024 frames end at 23.22 ms, but an FLV timestamp carries 23 ms. let rounded = timeline.push(Duration::from_millis(23), 1024, 44_100, 22_050); assert!(!rounded.reset_sink); + assert_eq!(rounded.silence, 0); + + // The third frame starts at 46.44 ms, a 47 ms stamp: no silence ahead of it either. + let late = timeline.push(Duration::from_millis(47), 1024, 44_100, 22_050); + assert!(!late.reset_sink); + assert_eq!(late.silence, 0); } #[test] diff --git a/test/audio-quality/README.md b/test/audio-quality/README.md index b039ce4f0df..687f76d877b 100644 --- a/test/audio-quality/README.md +++ b/test/audio-quality/README.md @@ -234,10 +234,11 @@ writes the same samples a page does, so `analyze.ts` reduces both alike, and the and clock checks have nothing to void. Decoding is taken as instant. A replay is deterministic, so its budgets are exactly what it measured. -The ring time-stretches live and buffered playback as the page's does, but the replay's audio is a constant, so -every seam admits at the shortest pitch period, 2.5 ms. Accelerate therefore moves less per stretch -than it would from speech; only fast accelerate, which takes every whole period that fits, moves its -most. +The ring time-stretches live and buffered playback as the page's does, on a seeded speech-like signal +rather than the decoded audio: syllables of 120 to 300 ms glide a 90 to 220 Hz fundamental under a +varying level, with pauses between some held above the silence classifier and no sample exactly +zero. A seam therefore removes one speech-length pitch period, so a replay's catch-up after a stall +moves at the pace speech would, not a constant tone's 2.5 ms a window. ```bash just test audio-quality-record # the three recorded lanes, 35 s each, needs the network diff --git a/test/audio-quality/budgets.json b/test/audio-quality/budgets.json index 75aff2a0cbc..bdb037f3577 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. 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. Also on 2026-11-11 the stretch became a player setting, 2 s by default, and the audio subscription's max delay became the delay plus it rather than the 2 s constant, so the container consumer delivers a late group that much longer before it ages out, and every replay row was re-measured: only relay-mic moved, its A/V lag p50 and p95 from 0.3 to 1.6 ms, under the 2.5 ms pitch period the stretch can move it by. Holding the constant max delay with the new bound reproduces the old values exactly.", + "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. Also on 2026-11-11 the stretch became a player setting, 2 s by default, and the audio subscription's max delay became the delay plus it rather than the 2 s constant, so the container consumer delivers a late group that much longer before it ages out, and every replay row was re-measured: only relay-mic moved, its A/V lag p50 and p95 from 0.3 to 1.6 ms, under the 2.5 ms pitch period the stretch can move it by. Holding the constant max delay with the new bound reproduces the old values exactly. On 2026-11-12 the replays stopped playing a constant and began playing a seeded speech-like signal (syllables gliding a 90 to 220 Hz fundamental, with pauses held above the silence classifier), since the stretch's pitch search found only its shortest period in a constant, and the browser ring stopped zero-filling a hole of up to a millisecond and two samples between frames, as native stopped writing silence for one: the recorded AAC timestamps land up to 2.5 samples either side of a 1024-sample boundary, and on speech the 2-sample holes this filled ended 119.1 quanta a minute short on bursty-aac. Every replay row was re-measured. The tap's underruns fell to 0 on bursty-aac (from 3.3) and local-aac (from 2), and relay-mic-rtt40's missing audio from 1.1 to 0.3 ms a minute while its player underruns rose from 2.7 to 3.1. The A/V lag p95 fell from 156.3 to 104.8 ms on bursty-aac, 39.2 to 15.1 on local-aac, 2.2 to 1.4 on relay-bbb and 501.8 to 484.9 on relay-mic-stall, whose p50 fell from 25.3 to 1.1, and rose from 1.6 to 3.4 on relay-mic and 2.4 to 3.5 on relay-mic-rtt40. Where audio rests moved within one speech pitch period, which is as close as one stretch seam can steer it: the p50 is 11 ms on bursty-aac (from 10.4), -4.2 on relay-bbb (from -1.2), 1.1 on relay-mic (from 1.6), 0.9 on relay-mic-rtt40 (from 0.7) and 1.7 on local-aac (from 1.8).", "rows": [ { "runtime": "chromium", @@ -428,14 +428,14 @@ "profile": "bursty-aac", "player_underruns_per_min": 4.4, "player_skips_per_min": 0, - "underruns_per_min": 3.3, - "underrun_ms_per_min": 0.1, + "underruns_per_min": 0, + "underrun_ms_per_min": 0, "trimmed_ms_per_min": 0, "stalled_share": 0.005, "silence_share": 0.009, "target_ms_p95": 343.2, - "av_lag_ms_p50": 10.4, - "av_lag_ms_p95": 156.3 + "av_lag_ms_p50": 11, + "av_lag_ms_p95": 104.8 }, { "runtime": "replay", @@ -444,14 +444,14 @@ "profile": "local-aac", "player_underruns_per_min": 4, "player_skips_per_min": 0, - "underruns_per_min": 2, - "underrun_ms_per_min": 0.1, + "underruns_per_min": 0, + "underrun_ms_per_min": 0, "trimmed_ms_per_min": 0, "stalled_share": 0, "silence_share": 0.002, "target_ms_p95": 203.2, - "av_lag_ms_p50": 1.8, - "av_lag_ms_p95": 39.2 + "av_lag_ms_p50": 1.7, + "av_lag_ms_p95": 15.1 }, { "runtime": "replay", @@ -466,8 +466,8 @@ "stalled_share": 0, "silence_share": 0, "target_ms_p95": 223.2, - "av_lag_ms_p50": -1.2, - "av_lag_ms_p95": 2.2 + "av_lag_ms_p50": -4.2, + "av_lag_ms_p95": 1.4 }, { "runtime": "replay", @@ -482,24 +482,24 @@ "stalled_share": 0, "silence_share": 0, "target_ms_p95": 80, - "av_lag_ms_p50": 1.6, - "av_lag_ms_p95": 1.6 + "av_lag_ms_p50": 1.1, + "av_lag_ms_p95": 3.4 }, { "runtime": "replay", "codec": "opus", "rate": 48000, "profile": "relay-mic-rtt40", - "player_underruns_per_min": 2.7, + "player_underruns_per_min": 3.1, "player_skips_per_min": 0, "underruns_per_min": 0.7, - "underrun_ms_per_min": 1.1, + "underrun_ms_per_min": 0.3, "trimmed_ms_per_min": 0, "stalled_share": 0, "silence_share": 0, "target_ms_p95": 320, - "av_lag_ms_p50": 0.7, - "av_lag_ms_p95": 2.4 + "av_lag_ms_p50": 0.9, + "av_lag_ms_p95": 3.5 }, { "runtime": "replay", @@ -514,8 +514,8 @@ "stalled_share": 0.05, "silence_share": 0.049, "target_ms_p95": 1540, - "av_lag_ms_p50": 25.3, - "av_lag_ms_p95": 501.8 + "av_lag_ms_p50": 1.1, + "av_lag_ms_p95": 484.9 } ] }