fix(libwebrtc): build the Opus decoder on macOS #27621

Merged
magnub merged 1 commit from upstream-pr/27621 into main 2026-11-27 08:34:17 +00:00
magnub commented 2026-11-26 19:36:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by magnub on 2026-11-26T19:36:31Z.


What

AudioDecoderOpusImpl::GeneratePlc (from #21347) grew the buffer with std::max(newSize, hostBuffer.capacity + hostBuffer.capacity / 2), where newSize is a std::size_t and capacity a std::uint64_t. Both are unsigned long on Linux, but on macOS std::uint64_t is unsigned long long. std::max then cannot deduce one type, so libwebrtc and every target linking it fail to build ("no matching function for call to 'max' ... deduced conflicting types for parameter '_Tp' ('std::size_t' (aka 'unsigned long') vs. 'std::uint64_t' (aka 'unsigned long long'))"). The call now names std::size_t, as HistoryItem.cpp does for its own growth. No behaviour change on 64-bit hosts.

Tested

macOS 27.0.1 (26A434) on an Apple M1 Pro, Apple clang 21.0.0, x86_64 Release build under Rosetta 2. Build: main debacdd4d9 plus #17425, #11049, #26739 and #25331, which the macOS build needs:

  • main: guest_webrtc_audio_decoder_opus_tests fails to build with the error above.
  • this PR: it builds, and guest_webrtc_audio_decoder_opus passes 3/3 (2.09 / 0.06 / 0.06 s).

The same unsigned long / unsigned long long pair reproduces the error with GCC 13 on Ubuntu 24.04, and the fixed call compiles there. tools/check_conventions.py --base origin/main passes. Log attached.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

https://claude.ai/code/session_012LL9hfx4BY6MbUCYMduDAQ
verify-two.log

Summary by CodeRabbit

  • Bug Fixes
    • Improved consistency in audio buffer sizing. Existing audio behavior remains unchanged.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5516104275 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27621). Originally posted by [magnub](https://github.com/magnub) on 2026-11-26T19:36:31Z. --- ### What `AudioDecoderOpusImpl::GeneratePlc` (from #21347) grew the buffer with `std::max(newSize, hostBuffer.capacity + hostBuffer.capacity / 2)`, where `newSize` is a `std::size_t` and `capacity` a `std::uint64_t`. Both are `unsigned long` on Linux, but on macOS `std::uint64_t` is `unsigned long long`. `std::max` then cannot deduce one type, so `libwebrtc` and every target linking it fail to build ("no matching function for call to 'max' ... deduced conflicting types for parameter '_Tp' ('std::size_t' (aka 'unsigned long') vs. 'std::uint64_t' (aka 'unsigned long long'))"). The call now names `std::size_t`, as `HistoryItem.cpp` does for its own growth. No behaviour change on 64-bit hosts. ### Tested macOS 27.0.1 (26A434) on an Apple M1 Pro, Apple clang 21.0.0, x86_64 Release build under Rosetta 2. Build: `main` `debacdd4d9` plus #17425, #11049, #26739 and #25331, which the macOS build needs: - main: `guest_webrtc_audio_decoder_opus_tests` fails to build with the error above. - this PR: it builds, and `guest_webrtc_audio_decoder_opus` passes 3/3 (2.09 / 0.06 / 0.06 s). The same `unsigned long` / `unsigned long long` pair reproduces the error with GCC 13 on Ubuntu 24.04, and the fixed call compiles there. `tools/check_conventions.py --base origin/main` passes. Log attached. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's technical debt file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_012LL9hfx4BY6MbUCYMduDAQ [verify-two.log](https://github.com/user-attachments/files/35481764/verify-two.log) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Improved consistency in audio buffer sizing. Existing audio behavior remains unchanged. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
MarcZX10 commented 2026-11-26 19:48:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-26T19:48:15Z.

Review: APPROVED


Reviewed — looks good

The change makes the buffer-growth std::max call compile when its arguments have different unsigned integer types, and I found no defect in the reviewed change.

What I ran

Reviewed head 159a2741d1f0df9ee90fae28da2ea0524887f58b using the prepared diff and repo_read.py for the changed function. No build or tests were run in this review; the build and test results in the PR description are author-reported.

Results

Check Result Note
Diff review passed One changed source file
Build and tests not run Author reports macOS build and test success

Findings

Blocking

None.

Non-blocking

None.

Not verified

The full changed file was not read; only lines 1–35 and 535–600 were read. files.json was unavailable through the reader, so excluded files could not be confirmed. No build or tests were run locally.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6079747867 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27621#pullrequestreview-6079747867). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-26T19:48:15Z. **Review:** APPROVED --- # Reviewed — looks good The change makes the buffer-growth `std::max` call compile when its arguments have different unsigned integer types, and I found no defect in the reviewed change. ## What I ran Reviewed head `159a2741d1f0df9ee90fae28da2ea0524887f58b` using the prepared diff and `repo_read.py` for the changed function. No build or tests were run in this review; the build and test results in the PR description are author-reported. ## Results | Check | Result | Note | |---|---|---| | Diff review | passed | One changed source file | | Build and tests | not run | Author reports macOS build and test success | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The full changed file was not read; only lines 1–35 and 535–600 were read. `files.json` was unavailable through the reader, so excluded files could not be confirmed. No build or tests were run locally. ## To get this to a good state Nothing is required.
Romannachwievor commented 2026-11-26 21:54:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Romannachwievor on 2026-11-26T21:54:56Z.

Review: COMMENTED


Tested on an Apple M1, macOS 26.5, AppleClang 21.0.0, Release with CMAKE_OSX_ARCHITECTURES=x86_64 (runs under Rosetta) and BUILD_TESTING=ON.
Base is main eb2e3e1cf7 plus local merges of #17425, #11049 and #26739, which a full macOS build needs.
On that base libwebrtc fails with core/libs/prx/libwebrtc/src/AudioDecoderOpusImpl.cpp:576:41: error: no matching function for call to 'max'.
I applied a one-line change identical to this diff (std::max<std::size_t>(...)) as a local commit on that base, not the PR head 159a2741d1 itself. After the incremental rebuild libwebrtc builds; the only remaining failure is the unrelated PipelinedFlushReadOrder.cpp test, which fails on main as well.
ctest -R webrtc: 127/127 passed. Linux and Windows not run.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6080902950 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27621#pullrequestreview-6080902950). Originally posted by [Romannachwievor](https://github.com/Romannachwievor) on 2026-11-26T21:54:56Z. **Review:** COMMENTED --- Tested on an Apple M1, macOS 26.5, AppleClang 21.0.0, Release with `CMAKE_OSX_ARCHITECTURES=x86_64` (runs under Rosetta) and `BUILD_TESTING=ON`. Base is main eb2e3e1cf7 plus local merges of #17425, #11049 and #26739, which a full macOS build needs. On that base libwebrtc fails with `core/libs/prx/libwebrtc/src/AudioDecoderOpusImpl.cpp:576:41: error: no matching function for call to 'max'`. I applied a one-line change identical to this diff (`std::max<std::size_t>(...)`) as a local commit on that base, not the PR head 159a2741d1 itself. After the incremental rebuild libwebrtc builds; the only remaining failure is the unrelated `PipelinedFlushReadOrder.cpp` test, which fails on main as well. `ctest -R webrtc`: 127/127 passed. Linux and Windows not run.
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
boykopovar/AnyPS5!27621
No description provided.