Repository navigation
acphal: audio frame deadlines are exact 1/375 s per frame index - #468
DavidM1911 wants to merge 1 commit into
Conversation
FRAME was 2667 us per frame where 128 samples at 48 kHz is 2666.6 us, so every scheduled frame drifted +0.333 us (+125 ppm, ~0.45 s/hour). Deadlines are now computed per 1-based frame index as epoch + k/375 s in integer nanoseconds; the >8-frames-late catch-up rule is kept by fast-forwarding the index to the same floor. Part of xcl-dev#329. Assisted-by: Devin (SWE-2 Flash Medium)
|
Code audit + NVIDIA RTX 5080 test run on ReviewLooks clean — Tested
Not tested
AI use: code review and test run orchestrated with Antigravity (Gemini 4 Neon) on the hardware listed above. |
|
Independent check of audio frame scheduling at Tested: Not tested: audible drift, actual audio playback, retail titles, or the full workspace suite. This checks the scheduler against simulated timestamps. AI use: OpenAI Codex (GPT-6) ran the tests and drafted this report. |
|
Data point from the same NVIDIA card the PR was tested on, different CPU/driver: RTX 3060 Ti 8 GB, Ryzen 7 9800X3D, driver 32.0.16.1742, Windows 11. Head
Not tested: audible retail audio on this stack (the run ended early on its own at t≈34 s, exit 0x0 - unrelated early-exit behaviour of the title); no long-run drift measurement. AI use: GPT-6.2 Astra (API model selector) in DSH ran the tests and wrote this comment; the human contributor reviewed it. |
|
Test run of Tested
Review: Deadlines are Not tested: no retail title or regression run (I have no unpacked game), no Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code. |
|
I added a synthetic
The totals include the first frame emitted before the catch-up clamp. After draining, neither revision emitted a frame 1 ns before the next deadline on the original 375 Hz grid. At that exact deadline, 2,666,666 ns after the hour boundary, the PR emitted On Windows 11 with Rust 1.100.0 MSVC, AI use — OpenAI Codex (GPT-6) wrote and ran the fixture and drafted this report. |
Part of #329 (item 3).
FRAMEwas 2667 µs where one audio frame (128 samples at 48 kHz) is exactly 1/375 s = 2666.6 µs, and eachpopscheduled the next frame by adding it — so the cadence drifted +0.333 µs per frame (+125 ppm, ~0.45 s per hour of audio). Deadlines are now computed per 1-based frame index asepoch + k/375 sin integer nanoseconds (frame_deadline), so there is no accumulation. The "a frame more than 8 late is not made up for" rule is kept by fast-forwarding the index to the same floor (now - 8·FRAME).What is in it
crates/xcl/src/hle/acphal.rs:Channelstoresepoch+next_frameindex instead ofOption<Instant>;frame_due/pop/connectreworked;frame_deadlinehelper;FRAME_CATCHUPconstant; a test that walks 375 frames (exactly 1 s) checking each is due atepoch + k/375 sand not 1 ns earlier.Tested
x86_64-pc-windows-msvc:cargo test -p xcl --lib acphal: 8 passed, 0 failedcargo test --workspace -- --test-threads=4: 677 passed, 0 failed, 41 ignoredscripts/smoke.ps1 -Seconds 60,cargo build --release -p xcl:main
a6f5f7a:this PR's head
0d407cf:Not tested
AI use