runtime: honor Opus activation, trimming and planar output #3084

Merged
R0Y00 merged 1 commit from upstream-pr/3084 into main 2026-11-27 22:01:32 +00:00
R0Y00 commented 2026-11-27 14:40:41 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T14:40:41Z.


Change

Honor activation-time channel counts for typed Opus streams. Decode at 48 kHz, apply the requested leading-frame trim and output capacity, and publish the corresponding completion record. Stereo streams support planar and interleaved output.

Verification

Tested 74d6e222 on x64 Windows with MSVC and libopus 1.5.2, configured with X2W_WITH_OPUS=ON.

cmake --build --preset dev --target startup_stub_xapu startup_xapu_opus_check startup_xapu_queue_check
ctest --preset dev --no-tests=error -R '^startup_xapu_(opus|queue)$' --output-on-failure

Both source-built tests passed, zero skips. The stereo fixture compares decoding to libopus, checks trimming 312 leading frames from a 960-frame packet, and verifies completion fields and output order. This verifies the stream interface; application playback still requires integration testing.

AI-assisted contribution.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5528454467 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3084). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-27T14:40:41Z. --- ## Change Honor activation-time channel counts for typed Opus streams. Decode at 48 kHz, apply the requested leading-frame trim and output capacity, and publish the corresponding completion record. Stereo streams support planar and interleaved output. ## Verification Tested 74d6e222 on x64 Windows with MSVC and libopus 1.5.2, configured with X2W_WITH_OPUS=ON. ```powershell cmake --build --preset dev --target startup_stub_xapu startup_xapu_opus_check startup_xapu_queue_check ctest --preset dev --no-tests=error -R '^startup_xapu_(opus|queue)$' --output-on-failure ``` Both source-built tests passed, zero skips. The stereo fixture compares decoding to libopus, checks trimming 312 leading frames from a 960-frame packet, and verifies completion fields and output order. This verifies the stream interface; application playback still requires integration testing. AI-assisted contribution.
R0Y00 commented 2026-11-27 14:46:51 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T14:46:51Z.


Release verification at 74d6e222 with MSVC 19.51, x64 Windows and libopus 1.5.2 also passed. With CMAKE_BUILD_TYPE=Release and X2W_WITH_OPUS=ON, ctest --test-dir out/opus-rel --no-tests=error -R '^startup_xapu_(opus|queue)$' --output-on-failure ran both tests, 2 passed, 0 failed, 0 skipped. The Debug build passed the same two fixtures.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7221218392 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3084#issuecomment-7221218392). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-27T14:46:51Z. --- Release verification at `74d6e222` with MSVC 19.51, x64 Windows and libopus 1.5.2 also passed. With `CMAKE_BUILD_TYPE=Release` and `X2W_WITH_OPUS=ON`, `ctest --test-dir out/opus-rel --no-tests=error -R '^startup_xapu_(opus|queue)$' --output-on-failure` ran both tests, 2 passed, 0 failed, 0 skipped. The Debug build passed the same two fixtures.
R0Y00 commented 2026-11-27 14:47:11 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T14:47:11Z.

Review: COMMENTED


Separate integration test at 74d6e222 with main ca659396 (tree 2bfb069f424c2d33fa82f962400ddb4de694cfde). Typed activation supplies the channel count, decode consumes the full Opus packet before trimming, and only the kept PCM and packed completion are written.

With -DX2W_WITH_OPUS=ON, MSVC x64, Windows 11 26200.9974 and libopus 1.5.2, I built startup_stub_xapu startup_xapu_opus_check startup_xapu_queue_check and ran ctest --test-dir <build> --no-tests=error -j 1 -V -R '^startup_xapu_(opus|queue)$'. Debug and Release /O2 each passed 2/2 with no skips. Two additional source-built Debug variants reduced the output capacity to 647 frames while requesting 960, or requested 647 with capacity 648. Both returned exactly 647 frames in planar and interleaved output, matched the libopus reference, and left the tails untouched. These are interface tests; application playback still needs integration evidence. Hosted Windows and both Linux jobs passed. A reviewer other than the PR author should give the merge verdict.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6089862176 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3084#pullrequestreview-6089862176). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-27T14:47:11Z. **Review:** COMMENTED --- Separate integration test at `74d6e222` with `main` `ca659396` (tree `2bfb069f424c2d33fa82f962400ddb4de694cfde`). Typed activation supplies the channel count, decode consumes the full Opus packet before trimming, and only the kept PCM and packed completion are written. With `-DX2W_WITH_OPUS=ON`, MSVC x64, Windows 11 26200.9974 and libopus 1.5.2, I built `startup_stub_xapu startup_xapu_opus_check startup_xapu_queue_check` and ran `ctest --test-dir <build> --no-tests=error -j 1 -V -R '^startup_xapu_(opus|queue)$'`. Debug and Release `/O2` each passed 2/2 with no skips. Two additional source-built Debug variants reduced the output capacity to 647 frames while requesting 960, or requested 647 with capacity 648. Both returned exactly 647 frames in planar and interleaved output, matched the libopus reference, and left the tails untouched. These are interface tests; application playback still needs integration evidence. Hosted Windows and both Linux jobs passed. A reviewer other than the PR author should give the merge verdict.
R0Y00 commented 2026-11-27 22:01:10 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T22:01:10Z.

Review: COMMENTED


Independent verification of exact head 74d6e222 integrated over 554735ef. With libopus 1.5.2 and X2W_WITH_OPUS=ON, built startup_stub_xapu startup_xapu_opus_check startup_xapu_queue_check. ctest --test-dir <build> --no-tests=error -j1 -V -R '^startup_xapu_(opus|queue)$' passed 2/2 in both Debug and Release /O2, no skips. Checked that typed streams retain the full decode before applying trim/capacity and that the completion describes the kept output. Reapplied over main 6cc46a3c (tree ce7c05f4); the PR's code and fixtures are byte-identical, with only upstream documentation changes in its touched paths. Hosted Windows passed.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6093763722 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3084#pullrequestreview-6093763722). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-27T22:01:10Z. **Review:** COMMENTED --- Independent verification of exact head `74d6e222` integrated over `554735ef`. With libopus 1.5.2 and `X2W_WITH_OPUS=ON`, built `startup_stub_xapu startup_xapu_opus_check startup_xapu_queue_check`. `ctest --test-dir <build> --no-tests=error -j1 -V -R '^startup_xapu_(opus|queue)$'` passed 2/2 in both Debug and Release /O2, no skips. Checked that typed streams retain the full decode before applying trim/capacity and that the completion describes the kept output. Reapplied over `main` `6cc46a3c` (tree `ce7c05f4`); the PR's code and fixtures are byte-identical, with only upstream documentation changes in its touched paths. Hosted Windows passed.
Sign in to join this conversation.
No reviewers
No labels
No milestone
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!3084
No description provided.