fix(libwebrtc): cast away the vtable's const before calling the RtpPacketReceived deleting destructor #25116

Closed
Gonic0 wants to merge 1 commit from upstream-pr/25116 into main
Gonic0 commented 2026-11-21 16:59:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Gonic0 on 2026-11-21T16:59:46Z.


What

main stopped building libwebrtc on macOS after 8503c82d26 (feat(libwebrtc): implement the RtpPacketReceived constructors and destructor). Apple clang rejects the reinterpret_cast from const void* to a function pointer in the RtpPacketReceived destructor:

core/libs/prx/libwebrtc/src/RtpPacketReceived.cpp:115:13: error: reinterpret_cast from 'const void *' to 'DeletingDestructor' (aka 'void (*)(void *)') casts away qualifiers

This casts away the vtable slot's const first, as AudioDecoder.cpp, RtcStatsReport.cpp and RtcCertificate.cpp already do. The behaviour is unchanged on every platform.

Tested

macOS 27.3, Apple M5 Pro, Apple clang, x86-64 Release under Rosetta 2, BUILD_TESTING=ON. Tree: main a3b6b62649 with this change, plus #17425 and #11049, which main still needs to link libcurl.prx and the audio libraries on macOS (#24117).

  • Without this change the full build stops at the error above (seen on main ead4c70f10); with it the full build completes.
  • ctest --test-dir build -R webrtc -j6: 117 of 117 pass, including guest_webrtc_rtp_packet_received.
  • Linux and Windows: not built; the change is a cast those compilers already accepted.
  • tools/check_conventions.py passes; tools/pr_overlap.py --branch finds no overlap with open pull requests.

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
  • 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 (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5430275275 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25116). Originally posted by [Gonic0](https://github.com/Gonic0) on 2026-11-21T16:59:46Z. --- ### What `main` stopped building `libwebrtc` on macOS after 8503c82d26 (`feat(libwebrtc): implement the RtpPacketReceived constructors and destructor`). Apple clang rejects the `reinterpret_cast` from `const void*` to a function pointer in the `RtpPacketReceived` destructor: ``` core/libs/prx/libwebrtc/src/RtpPacketReceived.cpp:115:13: error: reinterpret_cast from 'const void *' to 'DeletingDestructor' (aka 'void (*)(void *)') casts away qualifiers ``` This casts away the vtable slot's `const` first, as `AudioDecoder.cpp`, `RtcStatsReport.cpp` and `RtcCertificate.cpp` already do. The behaviour is unchanged on every platform. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> macOS 27.3, Apple M5 Pro, Apple clang, x86-64 Release under Rosetta 2, `BUILD_TESTING=ON`. Tree: `main` `a3b6b62649` with this change, plus #17425 and #11049, which `main` still needs to link `libcurl.prx` and the audio libraries on macOS (#24117). - Without this change the full build stops at the error above (seen on `main` `ead4c70f10`); with it the full build completes. - `ctest --test-dir build -R webrtc -j6`: 117 of 117 pass, including `guest_webrtc_rtp_packet_received`. - Linux and Windows: not built; the change is a cast those compilers already accepted. - `tools/check_conventions.py` passes; `tools/pr_overlap.py --branch` finds no overlap with open pull requests. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/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 (none added) - [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 🤖 Generated with [Claude Code](https://claude.com/claude-code)

Pull request closed

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!25116
No description provided.