runtime: count decoded Opus completions and desktop audio submissions #3178
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3178"
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 lambirou on 2026-11-27T20:30:11Z.
Changes
Adds bounded, saturating telemetry to the optional Opus decode path:
xapu.dllcounts readable type 3 commands, successful libopus decodes, dequeued type 3 completions, and each refusal reason (invalid_argument,opus_error,capacity,queue_full,short_command,unknown_handle,out_of_memory,header).x2w-audio XApu opus summary:line is written at the last disconnect, or fromatexitwhen the run never disconnects, only when the counters moved.acceptedandnot_opensubmissions, so an endpoint that never opened is distinguishable from one that accepted decoded blocks.Validation
Built with libopus 1.5.2 (static MSVC runtime) on Windows 11 build 26300:
startup_xapu_opus_count: passed (2 decodes/dequeues, 7 refusals by reason, one summary, saturation, typed-completions-off control).startup_xapu_opus,startup_xapu_queue,startup_audio_output: 3/3 passed.Limits
The counters prove that the optional decode path ran and that the caller consumed the results. They do not prove that the output was audible, that the desktop sink accepted the same block, or that XMA/AcpHal works. The title run behind the 27/11 audio observation was not available locally, so this PR adds the measurement, not the run receipt.
Refs #1145 #870.
Merge update (2026-11-27,
b1dd0bd7)Merged
origin/main(e582a9a4) into the branch. The only conflict wassrc/startup_stubs/xapu.cpp: main's typed Opus stream path (48 kHz stream channels, skipped frames, planar stereo, sequence/options/context result words) and this PR's counters/refusal classification now share oneQueueEntryand onedecode_packet. The stream path computesentry.frames/valueand the planar buffer; the counters observe the successful decode and refusal reason.Debug
startup_xapu_opus_count,startup_xapu_queue,startup_xapu_opusandstartup_audio_outputpass 4/4 with libopus 1.5.2 static. A separate Release libopus 1.5.2 static build now links and passes the same four tests.Review update (2026-11-27,
fd2f693e)R0Y00's invalid-slot finding is fixed. Both return sites now set
DecodeRefusal::invalid_argument: the typed stream check inXApuEnqueueCommandand the legacyslot >= max_slotscheck indecode_packet. The channel-count invalid-argument branches in the stream path set it too.startup_xapu_opus_count_checknow sends a valid packet and output window withslot = UINT32_MAXthrough both the legacy connection and a process-1 typed stream connection. Both returnE_INVALIDARG, queue nothing and leave the output untouched. The summary is nowtype3=10 packets=2 completions=2 refusals=9 invalid_argument=3 ..., matching the expected counts.Debug and Release with libopus 1.5.2 static:
startup_xapu_opus_count,startup_xapu_queue,startup_xapu_opusandstartup_audio_outputpass 4/4. CI is running onfd2f693e.Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-27T22:19:50Z.
Merged
origin/main(e582a9a4); head isb1dd0bd7. Thexapu.cppconflict now combines main's typed Opus stream path with this PR's counters and refusal reasons. Debug Opus/queue/audio tests are 4/4. The local Release link still hits the prebuilt static Opus debug-CRT mismatch (LIBCMTDvsLIBCMT), unrelated to the merge; the default no-Opus build is unaffected.Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-27T22:23:22Z.
Windows checks #8436 completed successfully on
b1dd0bd7.Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-27T22:24:30Z.
@R0Y00 @pigalot #3178 is ready for review at
b1dd0bd7:mainis merged, the Opus stream path and counters share onedecode_packet, Debug Opus/queue/audio tests are 4/4, and Windows checks #8436 is green.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T22:55:33Z.
Review: CHANGES_REQUESTED
I integrated
b1dd0bd7overmain4b0350ea(clean tree1660eb86), built with libopus 1.5.2, and ranctest --test-dir <build> --no-tests=error -j1 -V -R '^(startup_xapu_(opus_count|queue|opus)|startup_audio_output)$'. The existing suite passed 4/4 in Debug and Release /O2.The documented
invalid_argumenttelemetry misses out-of-range slots in two paths. The typed stream path setshr_invalid_argbeforedecode_packetwithout settingrefusal, and the legacy path indecode_packetalso returns early forslot >= max_slotswithout setting it. I added two synthetic type-3 commands withslot = UINT32_MAXto the count fixture, using a valid packet and output window. Each returnedE_INVALIDARG, queued nothing and left the output untouched. The summary changed fromtype3=8 invalid_argument=1 refusals=7totype3=10 invalid_argument=1 refusals=7; I expectedtype3=10 invalid_argument=3 refusals=9.Please classify the invalid slot at both returns and add a counter control covering both modes. A local change assigning
DecodeRefusal::invalid_argumentat the two sites produced the expected summary and passed all four Debug tests. The changes and probe stayed local.Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-27T23:11:15Z.
Review update (2026-11-27,
01677235)R0Y00's invalid-slot finding is fixed. Both return sites now set
DecodeRefusal::invalid_argument: the typed stream check inXApuEnqueueCommandand the legacyslot >= max_slotscheck indecode_packet. The channel-count invalid-argument branches in the stream path set it too.startup_xapu_opus_count_checknow sends a valid packet and output window withslot = UINT32_MAXthrough both the legacy connection and a process-1 typed stream connection. Both returnE_INVALIDARG, queue nothing and leave the output untouched. The summary is nowtype3=10 packets=2 completions=2 refusals=9 invalid_argument=3 ..., matching the expected counts.Debug with libopus 1.5.2 static:
startup_xapu_opus_count,startup_xapu_queue,startup_xapu_opusandstartup_audio_outputpass 4/4. CI is running on01677235.Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-27T23:11:21Z.
@R0Y00 both invalid-slot paths now classify
invalid_argument, and the fixture verifies the expectedtype3=10 invalid_argument=3 refusals=9summary on01677235. Could you re-review?Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-27T23:15:59Z.
Release is now verified too: with a Release libopus 1.5.2 static build,
startup_xapu_opus_count,startup_xapu_queue,startup_xapu_opusandstartup_audio_outputpass 4/4 onfd2f693e, includingtype3=10 invalid_argument=3 refusals=9.Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-27T23:16:13Z.
Windows checks #8462 completed successfully on
fd2f693e. Debug and Release Opus/queue/audio tests are 4/4 with libopus 1.5.2 static.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T23:35:59Z.
Review: APPROVED
The previous invalid-slot finding is addressed on
fd2f693e: both the legacy decode guard and typed stream guard now classifyslot >= max_slots, and the count fixture exercises both. Independently integrated overmainfad97f47(clean tree3208b0ee) and built with libopus 1.5.2.ctest --test-dir <build> --no-tests=error -j1 -V -R '^(startup_xapu_(opus_count|queue|opus)|startup_audio_output)$'passed 4/4 in Debug and Release /O2, no skips. Both logs containtype3=10 packets=2 completions=2 refusals=9 invalid_argument=3, and the rest of the refusal fields are intact. The intervening #3222 merge adds only GPU fixture/docs changes and leaves the audio paths and tests identical. Hosted Windows passed.