audio: report pacing error against the ideal cadence in the pacing control #1501
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1508"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T13:18:47Z.
A sharper instrument for the boundary #1368 measures — pacing error against the ideal cadence, not just gaps and drain.
Why
A stutter is a statement about timing error. The existing control reports first submission, largest gap, drained interval and recovery, so it can show that a bursty feed starved the queue. What it cannot express is drift: how far each submission landed from where it should have been. This adds that per-block deviation, computed against the ideal cadence (block duration counted from phase start, including blocks a bursty feed withheld), and reports worst-case and RMS per phase.
Measured on this machine's endpoint (shared mode, float32, 2 ch, 48 kHz, 24000-frame buffer)
The bound is measured, not chosen
A feed scheduled with
Sleep(1)cannot be tighter than the host's timer tick, and the tick differs per host (#1448 measured the same overshoot here). So the fixture measuresSleep(1)'s median overshoot and sets the steady bound to three ticks (46.6 ms here). It then fails if:Both arms must hold for the test to pass, so the metric has to be sensitive rather than merely non-zero.
What this does not establish
Where the title's stutter comes from. This still measures the desktop sink, not the title's audible path, which it drives through the system
XAudio2. It sharpens the same boundary; it does not locate the fault. #1145 stays open for the path-level work I asked direction on.startup_audio_pacingpasses; build clean. AI-assisted (Claude Code).Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T13:21:25Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
2f933a45a2ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T14:01:47Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T13:19:00Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
2f933a4ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T13:22:46Z.
Good catch — fixed in
69a3e0ef.You were right on both halves: the bound was the tick, not the scheduling, and the steady phase takes the worst of 120 wake-ups while the nine calibration sleeps only measure
Sleep(1)'s typical overshoot. On this host (16.0 ms tick) the old three-tick bound happened to be loose enough, which is exactly why it would have passed here and flaked on a host with a raised timer resolution.The fix calibrates the mechanism the fixture actually uses: it runs the same wait loop, the same number of times (120), with nothing submitted, and takes the worst deviation from the ideal cadence. The steady bound is then
max(3 × tick, 2 × measured scheduler worst + 5 ms):So on a ~1 ms-tick host the three-tick term collapses to a few ms and the calibrated scheduler term is what the bound rests on — the case you described. It also still fails if the bursty feed does not drift further than the steady one, so the metric has to separate the two feeds to pass.
One residual I am naming rather than hiding: a deschedule longer than any of the 120 calibration wake-ups during the measurement phase would still fail the steady check. I think that is the right behaviour — a stall that big is a real scheduling event worth reporting, not noise to be absorbed — but if you would rather the steady bound be a percentile of the calibration (say the 95th) so isolated stalls never fail the run, say so and I will change it.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T13:59:34Z.
Maintainer update at
15e42befkeeps maximum and RMS timing diagnostic and uses p95 for acceptance. The synthetic control ignores one isolated delay and detects a sustained tail. The real Windows Release pacing test passed twice in a row.Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T13:21:25Z.
Code review location:
tests/startup_audio_pacing.cpp; line 253On a Windows host with a usable endpoint and a raised timer resolution,
Sleep(1)can have a roughly 1 ms median, making this a roughly 3 ms hard limit. The steady phase checks the maximum over 120 submissions, while the nine calibration sleeps measure timer granularity rather than scheduler delays; one deschedule longer than the limit during the run can therefore make CTest fail despite a healthy sink. Use a tail-tolerant criterion or keep this bound informational so the diagnostic does not fail intermittently on loaded hosts.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T14:01:47Z.
Code review location:
tests/startup_audio_pacing.cpp; line 253Fixed at
15e42bef. The test gates on p95 while keeping maximum and RMS in diagnostics. A deterministic control covers an isolated and a sustained scheduling delay. Two Windows Release runs gave steady p95 14.5 and 14.4 ms, bursty 1691.2 and 1693.7 ms.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T14:09:25Z.
Review: COMMENTED
Technical review of commit
69a3e0ef48a13800dbba8428ecb59d765de35a3d:Code & fixture audit
tests/startup_audio_pacing.cppadds per-block ideal-cadence pacing error tracking (pacing_error_max_ms,pacing_error_rms_ms) to bothrun_steadyandrun_bursty.sleep_granularity_ms()(9-sampleSleep(1)median) andcalibrate_scheduler_ms()(120-wake-up dry run matching the steady loop) derivesteady_limit_ms = max(3.0 * tick_ms, 2.0 * jitter_ms + 5.0), avoiding brittle fixed-millisecond thresholds on hosts with raised timer resolution, while still enforcing sensitivity (bursty.pacing_error_max_ms > steady.pacing_error_max_ms + 5.0 * tick_ms).Verification
tests/docs_links_check.py,tests/bidi_controls_check.py,git diff --check, andgit merge-tree --write-tree origin/main HEADall pass.--preset dev): builtstartup_audio_pacing(4.45s);ctest --preset dev -R '^startup_audio_pacing$' --no-tests=error: skipped (exit 77, capability skip — no audio endpoint on headless VM; not a pass and not a failure)./O2(--preset release): builtstartup_audio_pacing(1.91s);ctest --preset release -R '^startup_audio_pacing$' --no-tests=error: skipped (exit 77, capability skip — no audio endpoint on headless VM).