diff --git a/quest/m1/audio-jitter-target/README.md b/quest/m1/audio-jitter-target/README.md index 939e8b295e1..e29e7129189 100644 --- a/quest/m1/audio-jitter-target/README.md +++ b/quest/m1/audio-jitter-target/README.md @@ -94,7 +94,6 @@ native playback against its budgets. - [The `stretch` setting](/quest/m1/audio-jitter-target/stretch-setting.md) - a player sets how far audio may trail before it skips, and zero turns the stretch off - [Calibrate](/quest/m1/audio-jitter-target/calibrate.md) - every browser and native ceiling re-measured from seven Nightlies with the model - [Capped budgets](/quest/m1/audio-jitter-target/capped-budgets.md) - the AAC browser budgets are re-measured from nightlies after the TS importer groups each PES -- [Native A/V lag](/quest/m1/audio-jitter-target/native-av-lag.md) - `moq play --metrics` reports how far audio trails its presentation clock, so native rows grade `av_lag_ms` - [Chromium Opus stalled share](/quest/m1/audio-jitter-target/opus-stalled-share.md) - the Chromium Opus browser rows' stalled-share ceiling is measured with the stretch, and passes - [Native backpressure](/quest/m1/audio-jitter-target/native-backpressure.md) - native playback decodes audio only when the ring has room, holding the rest of the target encoded as the browser does diff --git a/quest/m1/audio-jitter-target/grading.md b/quest/m1/audio-jitter-target/grading.md index 6b664f0a5d3..03344d7dca8 100644 --- a/quest/m1/audio-jitter-target/grading.md +++ b/quest/m1/audio-jitter-target/grading.md @@ -75,10 +75,6 @@ Recommendations: Public API: none. Wire: none. -## Required - -- [Native A/V lag](/quest/m1/audio-jitter-target/native-av-lag.md) - `moq play --metrics` reports the presentation clock, so native rows can grade `av_lag_ms` - ## Related - [Audio outlives video under bufferbloat](/quest/m4/audio-bufferbloat-av.md) - adds audio and video rows through a rate-limited link to the same harness diff --git a/quest/m1/audio-jitter-target/native-av-lag.md b/quest/m1/audio-jitter-target/native-av-lag.md deleted file mode 100644 index 3da047e0a0c..00000000000 --- a/quest/m1/audio-jitter-target/native-av-lag.md +++ /dev/null @@ -1,34 +0,0 @@ -# [S] moq play reports how far audio trails its presentation clock - -## Goal - -`moq play --metrics` reports how far the native audio playhead trails the -presentation clock video plays from, so every native row in -`test/audio-quality` can grade `av_lag_ms` as the replay rows do. Native's -playback decision does not change here. - -## Plan - -Decided 2026-11-09 (maintainer, /quest-complete on -[moq-dev/moq#8361](https://github.com/moq-dev/moq/pull/8361)): ✅ keep the -PR's metrics half and revert its playback changes (rejected: land its stretch -keyed to the lag at arrival). That stretch held audio on a clock that goes -stale after a path-delay step, taking AAC `step` from 0 to 614 underruns a -minute, where `main`'s slow-down had hidden the stale clock by settling -behind it. It was built on the rule the -[epic](/quest/m1/audio-jitter-target/README.md) replaced the same day, so the -PR's recorded decisions "accept AAC step underruns" and "p50 within one pitch -period" go with it. - -What stays: `sync::Consumer::position` and the `clock` field. The metrics -writer (`rs/moq-cli/src/play/metrics.rs`) writes each sample's `clock`, the -presentation clock's media time at the instant the playhead is read, with the -field and meaning `test/audio-quality/clients/js/src/schema.ts` gives the -browser's, so `analyze.ts` reduces native samples to `av_lag_ms` unchanged. -Leave it out while nothing is mapped, as other unreadable fields are. - -Budgeting the lag belongs to -[the grading quest](/quest/m1/audio-jitter-target/grading.md), and native's -decision to [the stretch model](/quest/m1/audio-jitter-target/stretch.md). - -Public API: an additive `sync::Consumer::position`. Wire: none. diff --git a/rs/moq-cli/src/play/metrics.rs b/rs/moq-cli/src/play/metrics.rs index e5325d74b5a..6cbb1e3e1cf 100644 --- a/rs/moq-cli/src/play/metrics.rs +++ b/rs/moq-cli/src/play/metrics.rs @@ -5,7 +5,8 @@ //! and meanings, so its analyzer reduces a native run exactly as it does a //! browser one. Durations are milliseconds as floats. `at` is this process's //! monotonic clock from the first sample, `render` the device's clock, and -//! `timestamp` the media clock; fields this player cannot read are left out +//! `timestamp` the media clock, with `clock` where the presentation clock video +//! plays from stands on it at the same instant; fields this player cannot read are left out //! rather than written as zero. `comfort` and `utterances` have no browser //! counterpart: they show how a declared silence played, for push-to-talk. @@ -39,6 +40,8 @@ struct Sample { #[serde(skip_serializing_if = "Option::is_none")] timestamp: Option, #[serde(skip_serializing_if = "Option::is_none")] + clock: Option, + #[serde(skip_serializing_if = "Option::is_none")] stalled: Option, #[serde(skip_serializing_if = "Option::is_none")] delay: Option, @@ -241,11 +244,13 @@ impl Metrics { // Read straight after the device clock, so the two pair up. let now = Instant::now(); let (playhead, delay) = (self.playhead.at(now), self.presentation.delay()); + let clock = self.presentation.position(now); let sample = Sample { at: ms(now.duration_since(self.start)), render: observation.as_ref().map(|_| ms(totals.clock)), timestamp: playhead.map(ms), + clock: clock.map(ms), stalled: observation.as_ref().map(|(o, _)| o.stalled), delay: Some(ms(delay)), output_latency: observation.as_ref().and_then(|(o, _)| o.latency).map(ms), diff --git a/rs/moq-mux/src/sync.rs b/rs/moq-mux/src/sync.rs index 170cb90ebb7..3994bad8991 100644 --- a/rs/moq-mux/src/sync.rs +++ b/rs/moq-mux/src/sync.rs @@ -721,6 +721,11 @@ impl Consumer { self.current.lock().unwrap().state.lock().unwrap().due(timestamp) } + /// The media time the clock presents at `at`, or `None` before the first anchor. + pub fn position(&self, at: Instant) -> Option { + self.current.lock().unwrap().state.lock().unwrap().position(at) + } + /// The newest due picture's index in presentation order, or `None` to repeat the previous one. /// /// Pass queued timestamps in ascending order and discard entries through the diff --git a/test/audio-quality/README.md b/test/audio-quality/README.md index e06edf3202d..2f321d831fc 100644 --- a/test/audio-quality/README.md +++ b/test/audio-quality/README.md @@ -319,7 +319,8 @@ player's own count, which its stats panel shows, is read alongside: - `av_lag_ms`: how far the audio playhead trails the shared clock video plays from (`sync.now()`), sampled while playing. Audio and video keep separate clocks that align once the delay covers the arrivals, so this is the latency audio adds beyond the target: positive is audio late, negative - early. Its replay ceilings hold audio from settling later to buy fewer underruns. Unset natively. + early. Its replay ceilings hold audio from settling later to buy fewer underruns. Natively, the + presentation clock `moq play` paces video from (`sync::Consumer::position`). - `converge_ms`: from first audio to the last time the target moved more than one 20 ms bucket from its final value. - `render_load`: Chromium's render capacity, the share of each quantum's budget the graph used. diff --git a/test/audio-quality/clients/js/src/schema.ts b/test/audio-quality/clients/js/src/schema.ts index fece2bea085..6bfad590044 100644 --- a/test/audio-quality/clients/js/src/schema.ts +++ b/test/audio-quality/clients/js/src/schema.ts @@ -157,7 +157,7 @@ export const METRICS = { clock: "media", aggregations: ["p50", "p95"], description: - "How far the audio playhead trails the shared clock video plays from (`sync.now()`), sampled while playing: latency audio adds beyond the resolved target. Negative is audio ahead. Unset natively.", + "How far the audio playhead trails the shared clock video plays from (`sync.now()`), sampled while playing: latency audio adds beyond the resolved target. Negative is audio ahead.", }, target_ms: { unit: "ms", @@ -410,7 +410,7 @@ export type Sample = { * is only a sink with nothing written yet, or none at all. */ stalled?: boolean; - /** `sync.now()`: where the shared clock puts video, on the `media` clock. Unset natively. */ + /** `sync.now()`: where the shared clock puts video, on the `media` clock. Natively, `sync::Consumer::position`. */ clock?: Ms; /** `sync.out.delay`: the resolved playout target. Natively, the target the speaker is held on. */ delay?: Ms;