startup: add a voice-lifecycle control with explicit diagnostic and system providers #1392
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1399"
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-24T10:30:50Z.
Second slice of #1145, following the direction on the issue: a source-built client with an explicit
diagnostic XAudio2 provider rather than an intercepting tap.
One client drives a steady and a bursty submission plan through a small provider interface with two
implementations:
clock as the plan waits; it touches no device and stores no audio;
XAudio2Createand the realIXAudio2directly. There is no import patching and nohooking anywhere, so the diagnostics-disabled arm visibly calls the system provider.
The precondition the slice starts from is that the diagnostic window is faithful, so the fixture checks
that both arms observe the same lifecycle and the same buffer arguments for the same plan, and fails on
divergence with the first differing event. Only after that does it report timing.
Recorded per arm: timestamps, frame counts, buffer counts, callbacks, drops, queue depth and clock
progress. Audio bytes and user data are never recorded or stored — the system arm submits silence.
Measured here (shared-mode endpoint, XAudio2_9, 48 kHz stereo 16-bit, 120 blocks of 10 ms):
Two defects this control found in its own diagnostic arm while it was being built, both fixed: the arm
did not advance its clock during withholding gaps (so the bursty arm was unfaithful by construction and
diverged at event 3), and it reported queue depth in frames for one arm and buffers for the other.
Skips (77) when no shared-mode endpoint is available.
What this slice does not establish, restating the limit on the issue: a steady submission stream
would narrow the fault to after submission, and would still leave voice state, queued playback and
endpoint scheduling to verify. This fixture measures the client/provider boundary; it does not locate
the title's stutter.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T10:33:32Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
e60714288aℹ️ 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 tedin7 on 2026-11-24T10:40:05Z.
Review: COMMENTED
Dual-platform peer review of #1399 (
e6071428):Checks
git diff --check origin/main...HEAD: clean.tests/bidi_controls_check.pypassed (Checked 1148 tracked source, script and build/CI files: no bidirectional controls.).x2w_pipe.py win2025 1399 --targets startup_audio_provider --regex '^startup_audio_provider$'):--preset dev): builds cleanly (4.11s);startup_audio_providerskipped (exit 77) (1.96s) — no audio endpoint on the Windows Server 2025 VM./O2,--preset release): builds cleanly (1.61s);startup_audio_providerskipped (exit 77) (1.88s).Code audit (
tests/startup_audio_provider.cpp)SystemVoice::prepare()/submit()(out-of-bounds read):prepare()allocatespcm_.assign(block_frames * format_.channels, 0);(960 bytes for 480 frames * 2 channels), whereassubmit()setsbuffer.AudioBytes = frames * (format_.bits / 8) * format_.channels;(1920 bytes for 16-bit stereo).prepare()is missing* (format_.bits / 8).SystemVoice::OnBufferEnd()executes on XAudio2's audio thread and mutatestrace_.callbacksandtrace_.events.push_back({"callback", 0})without synchronization, whilerun_plan()readsvoice->trace().callbacksin a loop andsubmit()/start()/stop()push totrace_.eventson the main thread.SystemProvider::open()leaksengine_ifCreateMasteringVoice()fails, andmain()exits early without callingdiagnostic.close()whensystem.open()skips.SystemVoice::state()overwritestrace_.clock_frames = out.played_frames, whereasDiagnosticVoice::advance()accumulatestrace_.clock_frames += consumed.Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T10:31:07Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
e607142ℹ️ 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 R0Y00 on 2026-11-24T10:41:13Z.
I fixed the two review findings in
04bc596e. The silence buffer is sized in bytes and checked before submission. The callback only updates atomic completion state, and the test checks completion order and count separately from caller-side events, which can interleave differently on the system clock. A rejected submission or missing completion now fails the test. Windows Release ran both providers and passed startup_audio_provider on this revision. This is still a source-built voice control for #1145.Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T10:33:32Z.
Code review location:
tests/startup_audio_provider.cpp; line 247On any run that reaches the XAudio2 system arm, the 48 kHz stereo 16-bit plan allocates 960 bytes for a 480-frame block, while
submit()advertises 1,920 bytes viaAudioBytes. XAudio2 can therefore read beyondpcm_for every queued buffer, so the system arm is not submitting silence and may play unrelated heap contents or fault; allocatebits / 8bytes per sample as well.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T10:33:32Z.
Code review location:
tests/startup_audio_provider.cpp; line 261When
OnBufferEndruns on XAudio2's processing thread, it updates this non-atomic count andeventswhilerun_planreadstrace().callbacksand the producer appends submit events. These unsynchronized accesses race, including concurrentstd::vector::push_backcalls, so the lifecycle comparison can be corrupted or crash; collect callback records through synchronized state and merge them on the main thread.Useful? React with 👍 / 👎.