audio: validate what the real XAudio2 provider puts on the endpoint #1529
Open
triggered02 wants to merge 19 commits from
upstream-pr/1536 into main
pull from: upstream-pr/1536
merge into: R0Y00:main
R0Y00:main
R0Y00:codex/indirect-large-backed-views
R0Y00:codex/word3-preflight-check
R0Y00:codex/vertex-table-two-records
R0Y00:codex/live-index-alias
R0Y00:codex/copied-vertex-buffer-srv
R0Y00:codex/windows-stage-test-output
R0Y00:codex/preserve-live-srv-retirement
R0Y00:codex/share-render-target-tracking
R0Y00:codex/sgd5-negative-offset-fixture
R0Y00:coverage-dashboard
R0Y00:codex/mesh-loose-root
R0Y00:codex/mesh86-cache-padding
R0Y00:codex/xmem-scatter-preflight
R0Y00:codex/mesh-depth-ps
R0Y00:codex/indirect-dispatch-refresh
R0Y00:codex/compute-container-index
R0Y00:codex/startup-compute-formatted-load
R0Y00:codex/compute-indirect-producer
R0Y00:codex/compute-atomic-soffset
R0Y00:codex/mesh-dual-handoff
R0Y00:codex/startup-run-sh-watcher-control
R0Y00:codex/queue31-page-alias
R0Y00:codex/indexed-indirect-compute-root
R0Y00:codex/typed-buffer-view-metadata
R0Y00:codex/translated-indexed-address-alias
R0Y00:codex/fixed-mesh-create-result
R0Y00:codex/xmem-section-lease
R0Y00:codex/startup-slot86-mesh-cache
R0Y00:codex/restore-mesh-barrier-iteration
R0Y00:codex/translated-indirect-upload-index
R0Y00:codex/xapu-completion-opt-in
R0Y00:codex/translated-indexed-rect
R0Y00:codex/translated-indexed-indirect
R0Y00:codex/startup-mesh-lds-integration
R0Y00:codex/startup-console-ms24
R0Y00:codex/startup-slot57-mesh-request
R0Y00:codex/indirect-copy-provenance
R0Y00:codex/present-color-producer-trace
R0Y00:codex/compute-dispatch-binding-trace
R0Y00:codex/translated-indirect-table-buffers
R0Y00:codex/indirect-copy-provenance-base
R0Y00:codex/mix-half-literal-source
R0Y00:codex/translated-indirect-draw
R0Y00:codex/xmem-scatter-diagnostics
R0Y00:codex/slot148-recording-upload
R0Y00:codex/slot70-loading-art-verified
R0Y00:codex/command-list-upload-arena
R0Y00:codex/recover-failed-command-list
R0Y00:codex/startup-heap-timing-notes
R0Y00:codex/align-audio-input-timeline
R0Y00:codex/synthetic-depth-export-control
R0Y00:codex/startup-texture1d-on-windows
R0Y00:codex/1629-packed-position-fixture
R0Y00:codex/cpu-srv-refresh
R0Y00:codex/stream-root-srv-draw
R0Y00:codex/audio-mixer-timer
R0Y00:codex/startup-reload-published-shader
R0Y00:codex/priority-integrate-1284
R0Y00:codex/guest-sixteen-page-record
R0Y00:codex/aot-placed-dxr-batch
R0Y00:codex/guest-directory-selection
R0Y00:codex/gamesave-enumerate-read
R0Y00:codex/readme-archive-to-pixels
R0Y00:codex/pe-placed-view-draw
R0Y00:codex/archive-directory-gpu
R0Y00:codex/slot133-dxr-build
R0Y00:codex/materialize-placed-vertex-view
R0Y00:codex/dstorage-directory-offsets
R0Y00:codex/xg-nine-bc-copy
R0Y00:codex/xg-slot10-bc64-arrays
R0Y00:codex/dxr-guest-address-readback
R0Y00:codex/gpu-va-high-bits
R0Y00:codex/clarify-diagnostic-startup-scope
R0Y00:codex/xg-six-levels
R0Y00:codex/typed-derived-blend
R0Y00:codex/english-legal-text-progress
R0Y00:codex/address-bc-4ks
R0Y00:codex/dstorage-bounded-file-read
R0Y00:codex/wide-srv-offsets-menu
R0Y00:codex/startup-memory-srv
R0Y00:codex/bound-view-tail
R0Y00:codex/language-selector-readback
R0Y00:codex/setup-menu-progress
R0Y00:codex/cpu-plane-refresh
R0Y00:codex/startup-ubyte-vertex
R0Y00:codex/presenter-window-selection
R0Y00:codex/startup-uniform-buffer-lane
R0Y00:codex/intro-loop-timing
R0Y00:codex/static-clzero-loops
R0Y00:codex/document-rtx-intro
R0Y00:codex/startup-insertq
R0Y00:codex/nv12-startup-texture
R0Y00:codex/stream-stage-draw
R0Y00:codex/startup-null-uav-format
R0Y00:codex/startup-draw-capture
R0Y00:codex/shorten-windows-checks
R0Y00:codex/dstorage-rfc1950
R0Y00:codex/startup-dump-fence
R0Y00:codex/pr1135-review-base
R0Y00:codex/startup-stream-requests
R0Y00:codex/startup-chroma-view
R0Y00:codex/readme-graphics-pipeline-streams
R0Y00:codex/static-crt-free-tls
R0Y00:codex/arc-140t-rtx-5080-laptop-gpu-reports
R0Y00:codex/main-startup-progress-entry
R0Y00:codex/signed-dxil-catalogue
R0Y00:codex/reloc-free-preferred-base
R0Y00:codex/quad-dpp-bit-mask
R0Y00:codex/raw-srv-bounds
R0Y00:codex/rx9070-31044-hardware-report
R0Y00:codex/gpu-page-source-provenance
R0Y00:codex/runtime-placeholder-interior
R0Y00:codex/gpu-copy-queue-tile-order
R0Y00:codex/pe-pin-external-providers
R0Y00:codex/xmem-placeholder-reservations
R0Y00:codex/xmem-shared-physical-pages
R0Y00:codex/pe-package-startup
R0Y00:codex/xmem-tools-memory-query
R0Y00:codex/cpu-stack-output-import
R0Y00:codex/pe-load-security-cookie
R0Y00:codex/record-three-bvh-retests
R0Y00:codex/cpu-rbp-frame-anchor
R0Y00:codex/xmem-default-startup
R0Y00:codex/record-rtx-3050-ti-9597
R0Y00:codex/docs-readme-start-here
R0Y00:codex/check-compute-mad24-truncation
R0Y00:codex/docs-discord-community
R0Y00:codex/bound-rcx-branch-mutants
R0Y00:codex/rtx5060ti-bvh-62114
R0Y00:codex/837-neutral-readme-disclaimer
R0Y00:codex/record-rtx-3070-ti
R0Y00:codex/title-neutral-public-wording
R0Y00:codex/exe-shadow-frame-submissions
R0Y00:codex/exe-shadow-runtime-chain
R0Y00:codex/readme-polish
R0Y00:codex/gpu-coverage-nov23
R0Y00:codex/spirv-minlod
R0Y00:codex/shadow-shim-device
R0Y00:codex/exe-two-shadow-frames
R0Y00:codex/shim-dispatch-cleanup
R0Y00:codex/fix-spirv-cache-probe
R0Y00:codex/sampler-use
R0Y00:codex/ballot-bit-extract
R0Y00:codex/packed-fma-release
R0Y00:codex/cpu-packed-fma-o2
R0Y00:codex/publish-coverage-dashboard
R0Y00:codex/mesh-cbv-binding-order
R0Y00:codex/spirv-window-fixture
R0Y00:codex/ps-e32-float-uint
R0Y00:codex/ps-cbuffer-reads
R0Y00:codex/fixed-profile-rescan
R0Y00:codex/shim-compute-integration
R0Y00:codex/readme-visible-coverage
R0Y00:codex/readme-research-navigation
R0Y00:codex/integrate-pr-256
R0Y00:codex/indexed-mesh
R0Y00:codex/sampled-coverage
R0Y00:codex/first-ms
R0Y00:codex/dual-ps
R0Y00:codex/ps-attribute
R0Y00:codex/compute-first
R0Y00:codex/ps-export
R0Y00:codex/readme-research-status
R0Y00:codex/ps-layout
R0Y00:codex/blast-window
R0Y00:codex/chart-caption
R0Y00:codex/reviewer-roles
R0Y00:codex/blast-aot
R0Y00:codex/archive-program
R0Y00:codex/crc-stream-program
R0Y00:codex/exe-image-data-chain
R0Y00:codex/local-cpu-fixture-coverage
R0Y00:codex/exe-bound-frame-chain
R0Y00:codex/exe-mapped-comparison
R0Y00:codex/contribution-dependencies
R0Y00:codex/exe-entry-aot
R0Y00:codex/bink-frame-heap-integration
R0Y00:docs/hardware-seven-reports
R0Y00:codex/bink-custom-heap
R0Y00:codex/bink-heap-callers
R0Y00:codex/discussions-entry-points
R0Y00:codex/gpu-community-batch-64
R0Y00:codex/ffx-scratch-writers
R0Y00:codex/generic-project-documentation
R0Y00:codex/ffx-dispatch-rcas
R0Y00:codex/four-windows-gpu-reports
R0Y00:codex/title-neutral-project-wording
R0Y00:codex/community-coverage-provenance
R0Y00:codex/rcas-packed-texels
R0Y00:codex/community-gpu-retests
R0Y00:codex/community-build-and-gpu-reports
R0Y00:codex/ffx-provider-loop
R0Y00:codex/ffx-recurrent-views
R0Y00:codex/ffx-recurrent-resource
R0Y00:codex/amd-wave64-reports
R0Y00:codex/ffx-backend-slots
R0Y00:codex/upscaler-device-init
R0Y00:codex/ffx-context-lifecycle
R0Y00:codex/ffx-version-query
R0Y00:codex/ffx-provider-contract
R0Y00:codex/typed-object-callback
R0Y00:codex/cpu-ordinal-import
R0Y00:codex/chained-cpu-ranges
R0Y00:codex/cpu-import-call
R0Y00:codex/cpu-direct-call
R0Y00:codex/cpu-leaf-aot
R0Y00:codex/community-project-status
R0Y00:codex/script-state-path-replay
R0Y00:codex/script-state-evidence
R0Y00:codex/bc7-resident-tail
R0Y00:codex/bcpack-mip-tail
R0Y00:codex/bc7-texture-draw
R0Y00:codex/asset-ranges
R0Y00:codex/pixel-constants
R0Y00:codex/pixel-aot
R0Y00:codex/pre-exe-workloads
R0Y00:codex/root-signature-device-coverage
R0Y00:engineering/packed-bvh-leaves
R0Y00:engineering/bvh-build-and-update
R0Y00:engineering/intake-root-roundtrip
R0Y00:community/gpu-check-release
R0Y00:community/english-contributor-entry
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
R0Y00/Xbox2Windows!1529
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1536"
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:44:58Z.
Output validation for the real XAudio2 provider, as the narrower slice you asked for on #1145 and with the capture isolation you requested on 2026-11-24.
What changed since your review
You asked to switch the fixture from shared-endpoint loopback to a capture scoped to the source-built playback process, because an RMS-classified shared capture lets another client supply the apparent tone or break a valid silence window. That is what the current head does:
AUDIOCLIENT_ACTIVATION_TYPE_PROCESS_LOOPBACKwithPROCESS_LOOPBACK_MODE_INCLUDE_TARGET_PROCESS_TREE. The report names the isolation it actually had (process).77) instead of quietly downgrading to the endpoint capture your review objected to.What it does
A source-built caller drives the real XAudio2 provider (no import patching, no replacement voice, provider selection untouched) through a plan of a known tone → intentional silence → a queue left to drain → resumed tone. Each captured 10 ms window is classified as tone or silence by RMS level, so the report is transitions and timing, not samples. Audio bytes stay in memory and are never stored or printed.
Measured here
Shared-mode endpoint, 48 kHz float, 2 ch, buffer 48000 frames ≈ 1000 ms:
startup_audio_output_validationpasses consistently (ctest, ~10.3 s); skips with 77 when there is no endpoint or the process-scoped activation is refused.Three things had to be right before any number meant anything
GetBufferSize.I also assert structure (tone → silence of the planned length → tone) and report onset and resume delay as diagnostics, because the endpoint's own start latency on this machine ranges 60–775 ms — a property of the machine, not of the plan, and it must not decide whether the plan reached the endpoint.
What it does not establish
Verification
Passes; exit 77 (capability skip) when the host cannot provide the process-scoped capture, which is reported as a skip, not a pass.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T13:50:04Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
94830fbb9fℹ️ 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 chatgpt-codex-connector[bot] on 2026-11-24T13:45:10Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
94830fbℹ️ 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:58:44Z.
Both findings were real; fixed in
db0200b4.Sample representation. You're right that
wBitsPerSample == 32says nothing about the encoding, and that the else-branch was a silent PCM16 assumption — a 32-bit PCM mix would have been read as float and 8/24-bit read as 16-bit (the 8-bit path reading past the packet). The fixture now checks the format tag and, forWAVE_FORMAT_EXTENSIBLE, the subformat GUID, accepting IEEE float32 or PCM16 and skipping anything else with the tag and bit depth in the skip reason. No representation is decoded by assumption any more.Plan clock. Also right, and it had been producing a nonsense number that I should have questioned: the resumption was being detected before it was submitted.
beginis now rebased at the same instantcapture.begin_framesis reset, so the phase loops schedule from the same origin as the capture windows. The measured gap also tightened to 3960–3990 ms against a planned 4000 ms across three runs, instead of the looser 3820–3850 it was scoring by accident.The negative
resume_vs_submitwas the tell that the plan and the timeline disagreed — thank you for catching it; a number that says an event happened before its cause should never have been reported as a passing measurement.startup_audio_output_validationpasses 3/3 after the change.Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T13:50:04Z.
Code review location:
tests/startup_audio_output_validation.cpp; line 259beginis captured before the quiet/probe/reset block, but the capture windows are rebased afterward while both phase loops still schedule against this old value. On an endpoint whose probe takes more than 600 ms—the reported endpoint range reaches 775 ms—those deadlines have already expired when the plan starts, so the resumption is queued early and the measured gap can fall outside the ±600 ms check, failing a correct provider because the endpoint is slow. Rebasebeginwhencapture.begin_framesis reset.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T13:50:04Z.
Code review location:
tests/startup_audio_output_validation.cpp; line 129wBitsPerSample == 32does not establish that samples are IEEE float, while every other encoding is read as signed 16-bit. A 32-bit PCM mix format is therefore interpreted as float, and 8/24-bit PCM is misread (the 8-bit path reads past the packet); on those valid endpoint formats, RMS classification is corrupted or the test accesses invalid capture bytes instead of validating or skipping the endpoint. Check the format tag/subformat and valid bits, and skip unsupported representations.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T14:11:03Z.
Review: CHANGES_REQUESTED
Please switch this fixture from shared endpoint loopback to capture scoped to the source-built playback process, as discussed in #1145. This version classifies endpoint windows by RMS, so another client can supply the apparent tone or turn a valid silence window into a failure. Keep the real XAudio2 provider, use two distinguishable signals in the isolation control, and report only aggregate transitions. If process-scoped activation is unavailable, use the named capability skip. Keep an assertion failure separate from capability skips.
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T14:16:37Z.
Switched to process-scoped capture as asked, in
4b309f4b— but I have to report that I could not make it run on this host, which changes what the commit demonstrates.What changed
ActivateAudioInterfaceAsyncwithVIRTUAL_AUDIO_DEVICE_PROCESS_LOOPBACKandPROCESS_LOOPBACK_MODE_INCLUDE_TARGET_PROCESS_TREE, so another client cannot supply the tone or break a silence window. The real XAudio2 provider and the tone/silence/drain plan are unchanged.The blocker
Process-loopback activation is refused on this host:
ActivateAudioInterfaceAsyncreturns0x8000000E(E_ILLEGAL_METHOD_CALL) in both MTA and STA, with the COM-initialised calling thread and the message pump in place. So the fixture skips with that reason — a named capability skip as you specified (exit 77, separate from assertion failures).The honest consequence: the new capture and isolation path has never executed anywhere. It compiles and it skips, and compiling is not evidence. I am not claiming the process-scoped capture works, only that it is implemented and that its unavailability is reported rather than silently passing.
What I need from you
VAD\Process_Loopbackactivates, so the isolation control can be exercised before merge? If not, this PR cannot show the thing it exists to show and I would rather leave it as a draft than merge an unexercised path.0x8000000Eon Windows 11 26200 with an ordinary console app suggests either a policy restriction on this machine (it is a VM-style host with a virtual speaker device) or a precondition I have not met; I did not want to guess further and present a workaround as a fix.Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T14:49:25Z.
Added the half of this fixture that can run anywhere, because the endpoint arm skips on this host and a fixture that only skips is not evidence.
startup_audio_output_validation --self-testchecks the metric the isolation control classifies with, with no endpoint involved: a 440 Hz tone must score high at 440 and low at 880, the reverse for 880 Hz, silence must be zero, white noise must not read as a tone, and the empty-window and zero-rate guards must return zero.The discrimination requirements are the control. Without them, "our tone was present" would be unfalsifiable — a metric that scored everything as tone would satisfy presence alone.
Fail-first: with
frequency_shareforced toreturn 1.0, all six requirements fail and the test exits 1. Restored:Registered as
startup_audio_output_validation_classifierand added to theprtest preset, so it gates pull requests; the endpoint arm keeps its capability skip:I also normalised the file: several blocks I inserted programmatically had a blank line after every line (766 → 670 lines), which would have been noise in review.
What this does not establish: anything about the endpoint, the capture or the provider. It checks the classifier only, and the endpoint arm remains unexercised here until a host activates
VAD\Process_Loopback— which is still the open question in my previous comment.Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T16:48:42Z.
Updated in
4c55ae31. Mapping each point from your review to what is now in the fixture, and where I could not verify it.Process-scoped capture instead of shared endpoint.
process_loopback_client()activatesVIRTUAL_AUDIO_DEVICE_PROCESS_LOOPBACKwithAUDIOCLIENT_ACTIVATION_TYPE_PROCESS_LOOPBACK,TargetProcessId = GetCurrentProcessId()andPROCESS_LOOPBACK_MODE_INCLUDE_TARGET_PROCESS_TREE; the device client is released before activation, so the shared endpoint client is only used to read the mix format. There is no shared-endpoint capture path to fall back to.Two distinguishable signals in the isolation control. A second process (
self noise) plays 880 Hz through the real provider for the whole run while the fixture plays 440 Hz blocks; classification is by frequency share at 440 and 880, not by RMS, so an interfering client cannot be read as our tone, and a valid silence window cannot be broken by it.Aggregate transitions only. The report is
plan:,endpoint:,stream_latency:, phase transitions and timings; no samples are printed or stored.Named capability skip, separate from assertion failures. Activation failure returns the named reason, which the skip line prints verbatim, and exits 77:
Assertion failures still exit 1 (
FAIL: ...), so a skip cannot be read as a pass.Also fixed while in there: the header still described the shared-endpoint design and claimed the fixture reported
shared; the isolation field started as"shared"and now starts as"unknown"and becomes"process"only after the scoped client activates. COM is now initialized MTA, matching the documented ApplicationLoopback sample pattern.What I could not verify, and why. This host cannot activate process loopback: a minimal probe calling
ActivateAudioInterfaceAsyncwith STA and MTA, targeting both the fixture's own pid and the shell's, in both loopback modes, returns0x8000000Ein all six combinations. So the switch to MTA is documented-pattern-correct but unverified here, and I am not claiming the arm works. Establishing that needs a host where process-scoped activation succeeds; on such a host the existing isolation control is what would falsify a wrongly shared capture.AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-25T18:49:27Z.
Rebased onto current
main(b976e8bc) and force-pushed: head is74c6904f(was397efb64). Five commits replayed, none dropped or squashed; only the hashes changed and the messages are byte-identical.git diff --stat origin/main..HEADis the PR's own three files (CMakeLists.txt+13,CMakePresets.json,tests/startup_audio_output_validation.cpp+741).I also fixed the reason this PR's Windows job was red. The PR added
startup_audio_output_validation_classifierto theprtest preset, butbuildPresets[pr].targetsis an explicit list and never gotstartup_audio_output_validation, socmake --build --preset prdid not produce the fixture andctest --preset prfailed with “Unable to find executable … startup_audio_output_validation”. This was true at397efb64as well, so it is not a rebase artifact.74c6904fadds the target tobuildPresets[pr].targets; I checked the preset parses, the classifier test name matches theprinclude regex,startup_indirect_mesh_lease_warp_dualfrommainstill matches, and the endpoint arm (startup_audio_output_validation) is still deliberately outside theprgate.Conflict: one, in
CMakePresets.json.mainhad addedstartup_indirect_mesh_lease_warp_dualto theprinclude alternation; I kept that and re-applied only this PR'sstartup_audio_output_validation_classifier.CMakeLists.txtmerged cleanly;tests/startup_audio_output_validation.cppwas untouched bymainand is byte-identical to the original head.Verified on
74c6904f(out/pe-envPython, from the worktree):git diff --checkclean;docs_links_check.py19 files/469 links;bidi_controls_check.py1738 files;startup_tools_lint_check.py9 files parse. I also compiled the fixture translation unit withcl /W4 /c(exit 0, no warnings) and linked it withole32 xaudio2 mmdevapi(exit 0), and ran the built classifier:audio.exe --self-test→ exit 0 withPASS: 440 and 880 tones separated, silence and noise do not score as tone. That is not a CMake configure/build, so the real gates remainctest --preset pr -R '^startup_audio_output_validation_classifier$'(device-free, must pass) andctest --preset dev -R '^startup_audio_output_validation'(the endpoint arm may capability-skip 77, which is a skip, not a pass).Deliberately unchanged: the endpoint/process-loopback arm still renders a real tone through the shared endpoint, so it stays out of the PR gate and remains capability-dependent; I have not measured it here. The commit subjects still carry the leading BOM they had before — I preserved the messages byte-for-byte rather than rewriting history.
This PR still carries
CHANGES_REQUESTEDfrom your earlier review of the capture design; the branch content is the same design with the CI gate repaired, so it needs a re-review rather than another code change from me unless you want the capture scope changed.Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-26T03:30:45Z.
Rebased onto current main (
e46d336c); head is now e823386 (was �e076002). Replay was clean � no manual conflict resolution this time � and no conflict markers.Verified on e823386: ests/startup_run_ps1_check.py exit 0; CMakePresets.json parses, startup_audio_output_validation is in uildPresets[pr].targets, and the pr include regex matches startup_audio_output_validation_classifier; docs_links_check 523 links; idi_controls_check 1973 files; startup_tools_lint_check 11 files; git diff --check clean. The fixture ( ests/startup_audio_output_validation.cpp, 741 lines) and all eight CMake registrations survived, and main's 116 added CMakeLists.txt lines are intact.
This clears the rebase requirement; the branch still carries the older CHANGES_REQUESTED for the capture design, so it needs a re-review rather than another code change.
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-26T03:32:01Z.
Resolving both Codex findings from the review of
94830fbb, and @R0Y00's change request. Current head e823386.P2 � "Rebase the timing clock after the calibration probe": fixed in 98ac7d6a. ests/startup_audio_output_validation.cpp:553-554 now does exactly what the review asked:
cpp capture.begin_frames = capture.appended; begin = now_ms(); // the capture windows were rebased above, so the plan must be scheduledso the phase loops schedule against the rebased clock rather than the pre-probe egin, and a slow endpoint probe no longer expires the deadlines. The pre-fix egin at line 489 is the calibration clock only.
P2 � "Validate the loopback sample encoding before decoding": fixed in 98ac7d6a. Lines 227-245 now classify the mix format instead of trusting wBitsPerSample == 32: WAVE_FORMAT_IEEE_FLOAT with 32 bits, or WAVE_FORMAT_EXTENSIBLE whose SubFormat GUID is loat with 32 bits, sets loat32; plain PCM or the PCM subformat with 16 bits sets pcm16; everything else takes the explicit refusal path
cpp std::snprintf(why, sizeof(why), "unsupported mix format tag=%u bits=%u", format->wFormatTag, format->wBitsPerSample);so 8/24-bit PCM and 32-bit PCM are skipped with a reason instead of being decoded as float or read past the packet.
@R0Y00's change request (shared endpoint loopback -> process-scoped capture): implemented in c592302f (process_loopback_client, capture scoped to the source-built playback process) and described in the head commit e823386.
Both Codex threads are therefore addressed by code, not by argument; the remaining blocker on this PR is a re-review to clear CHANGES_REQUESTED. Verified on e823386: startup_run_ps1_check exit 0, preset target/regex proof, docs 523 links, bidi 1973 files, lint 11 files.
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-01T18:16:27Z.
Restored mergeability after main moved: merged
origin/main(158ef794) intoaudio/output-validation, head isad9f6470.The only conflict was
CMakePresets.json, and both hunks were unions:buildPresets.pr.targets: main's 40 targets plusstartup_audio_output_validation(41, no duplicates);testPresets.prfilter: main's regex plus thestartup_audio_output_validation_classifierarm. The endpoint arm stays out of the smoke preset as before, since it skips (77) without a loopback endpoint.Verified on this head: the file parses as JSON, the target list is a superset of main's and of the previous head's, the filter is main's regex plus exactly that one arm, and
tests/bidi_controls_check.pyandtests/docs_links_check.pypass. No Windows evidence is claimed from this Linux host — the fixture itself still needs a Windows run with WASAPI loopback.Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-02T15:56:59Z.
The Windows job failed, but not on this PR's change: the only failing test is
startup_indirect_mesh_cache_heap_warp, which is the flake tracked in #3822 —ValueError: not enough values to unpack (expected 1, got 0)attests/startup_indirect_mesh_cache_check.py:205, with the shim log showing the mesh request stillpendingwhen the fixture reached theglob().It is the same failure I just recorded on #3822, from this run. Nothing in this PR touches request publication, the mesh cache, or that fixture — this PR adds the XAudio2 output-validation check and its classifier arm.
Re-running the job; the audio validation itself is unaffected either way.
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-03T15:34:43Z.
@R0Y00 Point-by-point against your review, plus one real flaw your isolation comment let me find.
Your six asks, against the current head:
TargetProcessId=GetCurrentProcessId(),INCLUDE_TARGET_PROCESS_TREE, shared client released afterGetMixFormatXAudio2Create, no import patchingplan:/windows/floor/peak/threshold, no samplesThe isolation control was not testing isolation. The interferer was
CreateProcessW'd by the captured process (startup_audio_output_validation.cpp:458), while the capture usesPROCESS_LOOPBACK_MODE_INCLUDE_TARGET_PROCESS_TREE— documented as including the target and its child processes. So the 880 Hz tone was inside the scope, and thegap_level > 0.01assertion could only ever pass because the capture happened to be armed before the child existed. That is activation-snapshot behaviour, not contract.Fixed in
824df514: the playing/capturing arm now runs in a dedicated child process and the fixture launches the interferer, making them siblings — outside the documented target tree at every instant, so the result no longer depends on when membership is snapshotted. The interferer signals that its voice accepted audio before the capture arms and is checked alive when it ends, and it renders 100 ms whole-cycle buffers so it cannot underrun during the gap (the old 10 ms buffer plusSleepcould have left it silent inside the gap — which would have let the gap check pass for the wrong reason).What the gap assertion now proves: a live, fixture-started 880 Hz render on the same endpoint did not reach a capture scoped to the sibling tree. It does not prove the capture is unscoped-capable or that the interferer's audio was audible; an unscoped endpoint capture would be needed to measure that, and it is not in this PR.
Also merged current
mainin0f83f29d, resolvingCMakePresets.jsonby taking main's file and re-appending this branch's build target and classifier arm (regex verified compiling, parens balanced).Still needs your side:
0x8000000Eon every activation attempt here, i.e. process loopback does not activate on this host, so the fixture takes its named skip. One run on a Windows 11 machine whereVAD\Process_Loopbackactivates would settle it — after that, if you are content with the named skip for hosts without it, this is ready.Also worth correcting: an earlier comment of mine claimed classification is by frequency share rather than RMS. The plan windows are still RMS-classified; frequency share only attributes the isolation gap and tone. Your RMS sentence was answered by the scoping, and the description should have said so.
Build:
cmake --build out/build/clang --target startup_audio_output_validation -j 8links with clang-cl 19 + xwin (not run — no process loopback here).Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-03T16:01:58Z.
Review: CHANGES_REQUESTED
I built and ran both startup_audio_output_validation CTests at
824df514(MSVC Debug, Windows 11 build 26300). The classifier passed all four synthetic inputs. The process-capture test returned 77: ActivateAudioInterfaceAsync returned 0x8000000e before capture, even though this head initializes MTA.The callback currently exposes IUnknown and IActivateAudioInterfaceCompletionHandler only. A local control changing it to a WRL RuntimeClass with FtmBase and constructing it with WRL Make got past the exact activation error on the same machine and opened a process-scoped 44.1 kHz, eight-channel stream. The real-provider fixture then failed separately because the probe tone was not observed within four seconds. The agile callback looks like the right first fix, but I still need a passing end-to-end isolation run on the resulting head. Please keep the activation HRESULT diagnostic distinct from a missing endpoint and record a run with playback, the classified gap, and both sibling-interference checks.
Reference: https://learn.microsoft.com/en-us/windows/win32/api/mmdeviceapi/nf-mmdeviceapi-activateaudiointerfaceasync
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-03T16:12:17Z.
Fixed in
58ca9af0, following your local control exactly.What was wrong.
ActivateAudioInterfaceAsyncmarshals the completion callback into another apartment, so the handler has to be agile. The old handler was a classic-COM object exposing onlyIUnknownandIActivateAudioInterfaceCompletionHandler, with no free-threaded marshaler — hence0x8000000Ebefore any capture existed, MTA notwithstanding.The handler now answers
IID_IMarshalfrom aCoCreateFreeThreadedMarshaler— the same thing WRL'sFtmBaseinstalls — and keeps its own reference counting, so the call sites do not change shape.One deviation from your control worth explaining: I did not use
Microsoft::WRL::RuntimeClass<..., FtmBase>because the xwin SDK splat's<wrl/implements.h>includes aWinString.hit does not ship, so WRL would make the documented clang-cl cross-compile unable to build this fixture at all (verified — that is the error I got first). The hand-rolled marshaler is the same mechanism with no new header or link dependency.Diagnostics are now distinct, as you asked — an activation rejection can no longer read as a missing endpoint:
ActivateAudioInterfaceAsyncrejectedprocess loopback activation call failed (0x…)process loopback activation did not complete within 5 s (last 0x…)process loopback activation result failed (0x…)process loopback interface unavailable after activation (0x…)QueryInterfacefor the client failedprocess loopback client query failed after activation— all still reported through the named capability skip (77), not as assertion failures.
Verified:
cmake --build out/build/clang --target startup_audio_output_validation -j 8links with clang-cl 19 + xwin. Not verified: the end-to-end isolation run you asked for — this host has no process-loopback activation at all, so it takes the skip and cannot exercise the new path. That run on58ca9af0is the one I need from you, and I would rather say so than imply the build proves anything about activation.You also noted the real-provider fixture then failed because the probe tone was not observed within four seconds. I have not touched that: if activation now succeeds on your machine, the probe-tone timing is the next thing to look at, and I would want your run's plan/transition output before changing any timing constant — guessing at it would be exactly the kind of change that makes a fixture pass for the wrong reason.
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-03T16:16:25Z.
Two things in this comment: the fix is unchanged, and the branch was silently un-CI-able for a while.
Why
58ca9af0had no CI run. The branch had goneCONFLICTING, and a conflicted PR never gets apull_requestrun — GitHub cannot build the merge ref. Nothing was wrong with the change; the job simply never existed. Mergingmain(8814402b) produced one conflict, inCMakePresets.json, resolved by taking main's file and re-appending this branch's build target and classifier arm (regex verified compiling, 31/31 parens).So the agile-handler change from the previous comment is now on a head that can actually be tested.
What I need from you, on
8814402b: the end-to-end isolation run. This host has no process-loopback activation at all, so it takes the skip and cannot exercise the new path — the build is the only thing I can verify. If activation now succeeds, the probe-tone not-observed-within-four-seconds failure you saw is the next thing, and I would want that run's plan and transition output before touching any timing constant.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-03T16:20:04Z.
Independent retest on
8814402b: MSVC Debug, Windows 11 build 26300. The device-free classifier passed. The capture still skipped with 77 because ActivateAudioInterfaceAsync returned 0x8000000E before activation. This head delegates IMarshal, but its QueryInterface still returns E_NOINTERFACE for IAgileObject.In the same source and environment, I only added an explicit IAgileObject interface to the callback and returned it from QueryInterface. Activation then opened a process-scoped 44.1 kHz, eight-channel stream. The capture still failed at the next stage with “endpoint never delivered the probe tone within 4 s”. This isolates two separate steps: fix the callback agility contract on the checked-in head, then verify the provider tone and sibling control with an actual capture.
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-03T16:25:39Z.
@R0Y00 Added in
c0e7291e— and your phrasing is the whole fix: agility is two things, not one.The handler delegated
IMarshalbut still answeredE_NOINTERFACEforIAgileObject. It now derives fromIAgileObjectand returns itself for that IID; the marker interface has no methods, so answering it is the contract.objidl.hsupplies the declaration. Nothing else changed — the marshaler, the distinct activation diagnostics and the interferer scope all stay as they were on8814402b.I kept the hand-rolled marshaler rather than switching to WRL
FtmBasefor the reason in the previous comment: the xwin splat's<wrl/implements.h>includes aWinString.hit does not ship, so WRL would make the documented clang-cl route unable to build this fixture at all. With both halves now explicit, the object should satisfy actiation the same way your control did.Your two-step isolation is now the roadmap on this PR:
endpoint never delivered the probe tone within 4 sfailure you saw after activation succeeded.I have deliberately not touched (2). With activation working, that failure is the first real observation of the provider path this fixture has ever had, and the timing constants are the wrong thing to guess at without it: if the plan/transition output from a working activation shows the tone arriving late rather than not at all, the fix is a deadline; if it never arrives, the deadline is not the bug. Send that run's output and I will treat it as the specification rather than inventing a threshold.
Also for the record on this branch:
58ca9af0had no CI run at all because the branch wasCONFLICTING, and a conflicted PR never gets apull_requestrun — GitHub cannot build the merge ref.8814402bmergedmainand the run started;c0e7291ebuilds clean with clang-cl.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-03T16:40:47Z.
Independent retest on
c0e7291e(MSVC Debug, Windows 11 build 26300). The checked-in callback opened the process capture at 44.1 kHz, 8 channels, 32 bits. The classifier passed. The endpoint arm failed at the probe with no capability skip.The probe did receive the tone. An aggregate-only diagnostic read 176,841 capture frames across 401 windows while XAudio2 played 172,800 samples. Peak on any channel was 0.097697, but the eight-channel arithmetic mean peaked at 0.024424 and the highest classified-window RMS was 0.017397, below the hard 0.02 probe threshold. The 440 Hz share reached 0.426328. As a second local control, touching only the probe threshold let it detect the tone at 60.5 ms. That run then failed at the later resume check: 30 ms per planned phase, onset 10.0 ms, silence index 200.0 ms, no recognized resumption. The local controls were reverted.
The activation fix is confirmed. For the fixture, please preserve the distinct 440/880 test and make probe and duration classification robust to channel dilution and window alignment. A synthetic multichannel case exercising the quiet/tone/resume classifier would make that behavior reproducible without an endpoint.
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-03T17:14:05Z.
Your diagnostic is the specification, so
16c7df97implements it directly. Activation stays as it is; everything below is the classifier and the plan.What your numbers said. The tone was there — 0.0977 on one channel, 440 Hz share 0.426 — but the fixture thresholded the eight-channel arithmetic mean, which divides a one-channel tone by eight (your mean peak 0.0244, window RMS 0.0174 against the hard 0.02). So the probe could not fire on a correct capture. Then the 30 ms phases: a quiet run that swallowed the resumption is what a phase shorter than the endpoint's packet granularity has to produce.
Three changes, all in
tests/startup_audio_output_validation.cpp:mean_leveland printed, so a run now shows the dilution instead of requiring a local instrumented control to find it.The synthetic multichannel case you asked for is in
--self-test(startup_audio_output_validation_classifier, no endpoint needed): an 8-channel window with the tone on one channel; the same window started 3 ms into the tone; an 880 Hz interferer on one channel; a full quiet/tone/gap/resume/tail plan built from classified windows; and three negative controls (no resumption, no tone, and a capture that only ever shows quiet). The distinct 440/880 test is preserved — an 880 interferer on one channel must classify as other, never as ours.Mutation controls, both killed: restoring the old downmixed rule (
mean_level >= 0.02) fails four assertions, including the 8-channel case and the 3 ms-offset window; reporting the first tone run as the resumption fails the plan check and the no-resumption control.What this does not establish. Nothing about the real endpoint path: this host has no audio device, so the loopback arm skips here. Whether the plan is now resolvable against a real shared-mode stream on your machine is exactly the run you have been making, and the new
windows=... peak_level=... peak_mean=... peak_share440=...line will say which side of the threshold it landed on if it fails again.X2W_AUDIO_VALIDATION_DEBUG=1prints the per-window class.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-03T17:21:17Z.
Review: COMMENTED
Independent MSVC Debug retest on
16c7df97, Windows 11 build 26300: the device-free classifier passed, including multichannel dilution, window alignment and the quiet/tone/resume negative controls. The real process capture returned failure after the parent's 60 s wait. The only endpoint-arm output was the sibling-process launch line, so this run does not establish where the child stalled. Please keep aggregate progress visible after activation, probe and each playback phase, and make diagnostic output flush across the subprocess boundary so a future timeout identifies its last completed stage.Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-03T17:29:59Z.
Hosted Windows jobs on
16c7df97are green, and the relevant line is explicit: the device-free test ran on Windows and passed —So the synthetic multichannel/plan case is now covered on the target platform without an endpoint, on every PR. The endpoint arm itself still needs a machine with an audio device — yours.
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-03T17:33:20Z.
Good news in your retest first: the device-free classifier passed on Windows, including the multichannel, alignment and negative controls — that part of the work is now covered on the target platform.
For the capture arm,
20cc04f3makes the child say where it is. The failure mode you hit was structural: the child's stdout is a pipe into the harness, and nothing in that arm was flushed, so a stall produced exactly the launch line and nothing else.progress:line.open,activate(before the loopback request and once the client has activated),capture(format, isolation, endpoint buffer),caller,plan,baseline(how long quiet took),probe(stream latency),measure, each submitted tone block with the window count so far,silence,withheld, each resumption block,tail, andcollected(window and frame totals).progress:line names the stage the child entered — which is the only honest claim a parent can make about a child still inside a call.Verified on this host (clang-cl 19 xwin, Wine + vkd3d-proton, no audio device):
The child's lines appear in the parent's stream in order — that interleaving is the evidence that the flush works across the process boundary. What it cannot tell you is which stage your machine's run stalls in; the next run will, and the last
progress:line before the timeout names it.--self-teststill exits 0 with the same PASS line.Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-03T17:39:42Z.
Heads-up on the CI you will see for the last two pushes: after
20cc04f3the branch went DIRTY against main (3b300328, once #3943/#3949/#3950 landed), and a conflicted pull request gets nopull_requestrun at all — so that head had no checks rather than failing ones.a9b2dd6bmerges current main; both conflicts were additive (build target list gainsstartup_audio_output_validation, theprfilter gainsstartup_audio_output_validation_classifierbeside main's lazy-texture selectors — 91 alternatives, 31(/ 31),ctest -N -Rreports 105 matched tests). The self-test still passes on the merged tree, and the hosted run ona9b2dd6bis the check.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.