feat(libwebrtc): implement AudioCodecInfo constructor #14381

Merged
AlexWhitehouse merged 2 commits from upstream-pr/14381 into main 2026-11-06 04:27:44 +00:00
AlexWhitehouse commented 2026-11-01 11:02:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by AlexWhitehouse on 2026-11-01T11:02:43Z.


What

Implement _ZN6webrtc14AudioCodecInfoC1Eimiii (NID uPZSgYg7CZI) as a typed C export with an explicit object pointer. It stores all five arguments and initializes comfort noise to true and network adaption to false.

The constructor and struct are identical at WebRTC M127 e0b28a6a81a989c1f5c89e30fcd247870047390d and M134 8d78f5de6c27b2c793039989ea381f1428fb0100, in api/audio_codecs/audio_format.cc and .h. Sony's exact revision and console parity remain unverified. The implementation retains the upstream copyright notice and BSD licence.

Assert the 32-byte guest layout and every field offset (0, 8, 16, 20, 24, 28, 29). LP64 gives 4-byte ints, an 8-byte channel count and two 1-byte flags; alignment adds four internal padding bytes and two tail bytes. A fixed-width channel count also preserves the guest layout on Windows.

Null objects and violations of the five upstream DCHECK preconditions throw std::invalid_argument locally before writing. These exceptions are defensive local behavior; release upstream does not enforce those DCHECKs or provide this exception contract.

Update the throwing-export inventory from 385 to 384. The previous 325 figure counts only named __func__ stubs and omits 60 literal-NID stubs; the debt total includes both. The 31 unresolved data exports are unchanged.

Tested

Linux x86-64, GCC 15, Release, configured full build:

  • cmake --build build-full --target libs guest_webrtc_audio_codec_info_tests --parallel 6: passed.
  • Built existing libwebrtc test executables, then ctest --test-dir build-full -R 'guest_webrtc|public_headers' --output-on-failure: 72/72 passed in 146.83 seconds. Constructor test: 0.01 seconds.
  • Negative control: separately built the original origin/main library with its original declaration and throwing definition, then ran the final test executable against it. It linked and exited 1 with _ZN6webrtc14AudioCodecInfoC1Eimiii_nid_postfix not implemented.
  • Mutation check: swapped the minimum and maximum bitrate stores. The test failed at its minimum-bitrate assertion; restored the implementation, rebuilt, and passed the focused test and complete sweep above.
  • Coverage includes all fields and both flags, guard bytes on both sides, 1/2/6 channels, equal bitrate bounds, zero minimum, integer boundaries, and each violated precondition.
  • python3 tools/check_conventions.py --base origin/main and git diff --check: passed.
  • Open export-name searches found no duplicate implementation. Read open libwebrtc diffs and ran python3 tools/pr_overlap.py --branch feat/libwebrtc-audio-codec-info after committing. Shared inventory/header/CMake edits may need reconciliation as other PRs merge; no semantic dependency. The tool returned exit 2 because documentation cleanup #14212 conflicts with main; manually read its libwebrtc debt diff, which removes inventory numbers and changes spacing, with no constructor implementation.
  • No Windows or console execution. An initial sweep ran before the VAD test executable was built and reported it Not Run; built the existing targets and reran successfully as above.

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
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5106718899 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14381). Originally posted by [AlexWhitehouse](https://github.com/AlexWhitehouse) on 2026-11-01T11:02:43Z. --- ### What Implement `_ZN6webrtc14AudioCodecInfoC1Eimiii` (NID `uPZSgYg7CZI`) as a typed C export with an explicit object pointer. It stores all five arguments and initializes comfort noise to true and network adaption to false. The constructor and struct are identical at WebRTC M127 `e0b28a6a81a989c1f5c89e30fcd247870047390d` and M134 `8d78f5de6c27b2c793039989ea381f1428fb0100`, in `api/audio_codecs/audio_format.cc` and `.h`. Sony's exact revision and console parity remain unverified. The implementation retains the upstream copyright notice and BSD licence. Assert the 32-byte guest layout and every field offset (0, 8, 16, 20, 24, 28, 29). LP64 gives 4-byte ints, an 8-byte channel count and two 1-byte flags; alignment adds four internal padding bytes and two tail bytes. A fixed-width channel count also preserves the guest layout on Windows. Null objects and violations of the five upstream DCHECK preconditions throw `std::invalid_argument` locally before writing. These exceptions are defensive local behavior; release upstream does not enforce those DCHECKs or provide this exception contract. Update the throwing-export inventory from 385 to 384. The previous 325 figure counts only named `__func__` stubs and omits 60 literal-NID stubs; the debt total includes both. The 31 unresolved data exports are unchanged. ### 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. --> Linux x86-64, GCC 15, Release, configured full build: - `cmake --build build-full --target libs guest_webrtc_audio_codec_info_tests --parallel 6`: passed. - Built existing libwebrtc test executables, then `ctest --test-dir build-full -R 'guest_webrtc|public_headers' --output-on-failure`: 72/72 passed in 146.83 seconds. Constructor test: 0.01 seconds. - Negative control: separately built the original `origin/main` library with its original declaration and throwing definition, then ran the final test executable against it. It linked and exited 1 with `_ZN6webrtc14AudioCodecInfoC1Eimiii_nid_postfix not implemented`. - Mutation check: swapped the minimum and maximum bitrate stores. The test failed at its minimum-bitrate assertion; restored the implementation, rebuilt, and passed the focused test and complete sweep above. - Coverage includes all fields and both flags, guard bytes on both sides, 1/2/6 channels, equal bitrate bounds, zero minimum, integer boundaries, and each violated precondition. - `python3 tools/check_conventions.py --base origin/main` and `git diff --check`: passed. - Open export-name searches found no duplicate implementation. Read open libwebrtc diffs and ran `python3 tools/pr_overlap.py --branch feat/libwebrtc-audio-codec-info` after committing. Shared inventory/header/CMake edits may need reconciliation as other PRs merge; no semantic dependency. The tool returned exit 2 because documentation cleanup #14212 conflicts with main; manually read its libwebrtc debt diff, which removes inventory numbers and changes spacing, with no constructor implementation. - No Windows or console execution. An initial sweep ran before the VAD test executable was built and reported it Not Run; built the existing targets and reran successfully as above. ### 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 - [x] Generic behaviour, not specific to one title - [x] Depends on: <!-- #PR, or none --> none - [x] Fixes: <!-- issue it closes as Fixes #N, or none --> none - [x] Unblocks: <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> none - [x] GPUs tested: <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> n/a - [x] AI-assisted: <!-- yes / no --> yes
MarcZX10 commented 2026-11-01 14:21:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T14:21:20Z.

Review: COMMENTED


Reviewed — no blocking findings

The AudioCodecInfo five-argument constructor stores its arguments into a 32-byte struct whose LP64 offsets I checked, its NID matches the mangled name under the repository's own NID function, and the constructor sets the two defaults the PR states; the layout and the WebRTC source it follows are cited, not checked against WebRTC here.

What I ran

  • Exact head 821b209e953ef669e48e3fef3a5a5852704e1dcd, base e67cc81869.
  • Environment: Linux, /usr/bin/python3 3.11.2, no build.
  • Precheck: python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14381 --output-dir /dev/shm/reviewer-run/precheck/14381
  • ABI audit by hand (helper absent from the head tree): python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base e67cc81869 --head 821b209e953ef669e48e3fef3a5a5852704e1dcd --json (exit 0; passed_with_warnings; 60 findings of kind nid-alias-differs-from-symbol-hash, none for the new constructor; 412 symbols). The new constructor's computed NID is uPZSgYg7CZI, the value the export carries.
  • NID recomputed with tools/nid_names.py (compute_nid) for _ZN6webrtc14AudioCodecInfoC1Eimiii: uPZSgYg7CZI.
  • Test-quality helper on core/libs/prx/libwebrtc/tests/AudioCodecInfo.cpp from a head extract: one literal-path registration heuristic.
  • Struct layout checked against the static_asserts in include/AudioCodecInfo.hpp (size 32; offsets 0, 8, 16, 20, 24, 28, 29), which I recomputed by hand for LP64 (int, std::uint64_t, three int, two bool).

Results

Precheck report, checks table, unedited (/dev/shm/reviewer-run/precheck/14381/report.md):

Check Status Command / reason
build_and_compile not_applicable The precheck deliberately does not configure, build, or compile AnyPS5.
diff_check passed git diff --check e67cc818696fd6e6c58ac80adc6550c54aed68e8...821b209e953ef669e48e3fef3a5a5852704e1dcd
conventions_and_pr_template passed /usr/bin/python3 tools/check_conventions.py --base e67cc818696fd6e6c58ac80adc6550c54aed68e8 --head 821b209e953ef669e48e3fef3a5a5852704e1dcd --title feat(libwebrtc): implement AudioCodecInfo constructor --body /dev/shm/reviewer-run/precheck/14381/pr-body.md
changed_export_abi_audit failed /usr/bin/python3 tools/pr_abi_audit.py --base e67cc818696fd6e6c58ac80adc6550c54aed68e8 --head 821b209e953ef669e48e3fef3a5a5852704e1dcd --json
python_syntax not_applicable No changed Python implementation files.
related_python_unit_tests not_applicable No changed tools/ module has an existing sibling tools/tests/test_<module>.py suite.
python_test_registration not_applicable No changed test_*.py files.
live_dependency_and_mergeability_check passed /usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 14381 --repo boykopovar/AnyPS5 --output-dir /dev/shm/reviewer-run/precheck/14381/stack
build_dependent_cpp_tests not_applicable Not run: C++ tests need exact-head binaries, which require a build; the precheck does not build.
test_quality_heuristics failed /usr/bin/python3 /dev/shm/reviewer-run/precheck/14381/head-821b209e953e-c9fb54fd/tools/pr_test_quality.py --root /dev/shm/reviewer-run/precheck/14381/head-821b209e953e-c9fb54fd --json core/libs/prx/libwebrtc/CMakeLists.txt core/libs/prx/libwebrtc/Export.cpp core/libs/prx/libwebrtc/include/Api.hpp core/libs/prx/libwebrtc/include/AudioCodecInfo.hpp core/libs/prx/libwebrtc/src/AudioCodecInfo.cpp core/libs/prx/libwebrtc/tests/AudioCodecInfo.cpp docs/dev/debt/libwebrtc.md
negative_controls not_applicable No changed Python test module in tools/ can be run as a no-build base-source control.

Negative control

Not run here. The C++ test needs a build.

Findings

Blocking: none.

Non-blocking:

  • The new source file carries WebRTC's BSD licence header (copyright 2016 and 2011 notices). The same library already has WebRTC-licensed sources (src/RtcpCommonHeader.cpp carries the same 2016 header), so this follows precedent; whether copied licence text belongs in these files is the same maintainer question as in #14431.
  • The WebRTC revisions cited (M127 and M134) and the field order were not fetched here; the struct matches my recollection of audio_format.h, but that is not a check.

Sources

Not verified

  • The WebRTC source the PR adapts (M127 and M134) was not fetched; the field order and defaults are the author's citation.
  • The C++ test was not built or run here.
  • Hosted: at this head conventions, eligibility, labels, library-portability and report succeeded; linux, register-context, relinker, relinker-asan and write-watch were skipped.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5728557763 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14381#pullrequestreview-5728557763). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-01T14:21:20Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The `AudioCodecInfo` five-argument constructor stores its arguments into a 32-byte struct whose LP64 offsets I checked, its NID matches the mangled name under the repository's own NID function, and the constructor sets the two defaults the PR states; the layout and the WebRTC source it follows are cited, not checked against WebRTC here. ## What I ran - Exact head `821b209e953ef669e48e3fef3a5a5852704e1dcd`, base `e67cc81869`. - Environment: Linux, `/usr/bin/python3` 3.11.2, no build. - Precheck: `python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14381 --output-dir /dev/shm/reviewer-run/precheck/14381` - ABI audit by hand (helper absent from the head tree): `python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base e67cc81869 --head 821b209e953ef669e48e3fef3a5a5852704e1dcd --json` (exit 0; `passed_with_warnings`; 60 findings of kind `nid-alias-differs-from-symbol-hash`, none for the new constructor; 412 symbols). The new constructor's computed NID is `uPZSgYg7CZI`, the value the export carries. - NID recomputed with `tools/nid_names.py` (`compute_nid`) for `_ZN6webrtc14AudioCodecInfoC1Eimiii`: `uPZSgYg7CZI`. - Test-quality helper on `core/libs/prx/libwebrtc/tests/AudioCodecInfo.cpp` from a head extract: one literal-path registration heuristic. - Struct layout checked against the `static_assert`s in `include/AudioCodecInfo.hpp` (size 32; offsets 0, 8, 16, 20, 24, 28, 29), which I recomputed by hand for LP64 (`int`, `std::uint64_t`, three `int`, two `bool`). ## Results Precheck report, checks table, unedited (`/dev/shm/reviewer-run/precheck/14381/report.md`): | Check | Status | Command / reason | |---|---|---| | build_and_compile | not_applicable | `The precheck deliberately does not configure, build, or compile AnyPS5.` | | diff_check | passed | `git diff --check e67cc818696fd6e6c58ac80adc6550c54aed68e8...821b209e953ef669e48e3fef3a5a5852704e1dcd` | | conventions_and_pr_template | passed | `/usr/bin/python3 tools/check_conventions.py --base e67cc818696fd6e6c58ac80adc6550c54aed68e8 --head 821b209e953ef669e48e3fef3a5a5852704e1dcd --title feat(libwebrtc): implement AudioCodecInfo constructor --body /dev/shm/reviewer-run/precheck/14381/pr-body.md` | | changed_export_abi_audit | failed | `/usr/bin/python3 tools/pr_abi_audit.py --base e67cc818696fd6e6c58ac80adc6550c54aed68e8 --head 821b209e953ef669e48e3fef3a5a5852704e1dcd --json` | | python_syntax | not_applicable | `No changed Python implementation files.` | | related_python_unit_tests | not_applicable | `No changed tools/ module has an existing sibling tools/tests/test_<module>.py suite.` | | python_test_registration | not_applicable | `No changed test_*.py files.` | | live_dependency_and_mergeability_check | passed | `/usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 14381 --repo boykopovar/AnyPS5 --output-dir /dev/shm/reviewer-run/precheck/14381/stack` | | build_dependent_cpp_tests | not_applicable | `Not run: C++ tests need exact-head binaries, which require a build; the precheck does not build.` | | test_quality_heuristics | failed | `/usr/bin/python3 /dev/shm/reviewer-run/precheck/14381/head-821b209e953e-c9fb54fd/tools/pr_test_quality.py --root /dev/shm/reviewer-run/precheck/14381/head-821b209e953e-c9fb54fd --json core/libs/prx/libwebrtc/CMakeLists.txt core/libs/prx/libwebrtc/Export.cpp core/libs/prx/libwebrtc/include/Api.hpp core/libs/prx/libwebrtc/include/AudioCodecInfo.hpp core/libs/prx/libwebrtc/src/AudioCodecInfo.cpp core/libs/prx/libwebrtc/tests/AudioCodecInfo.cpp docs/dev/debt/libwebrtc.md` | | negative_controls | not_applicable | `No changed Python test module in tools/ can be run as a no-build base-source control.` | ## Negative control Not run here. The C++ test needs a build. ## Findings **Blocking:** none. **Non-blocking:** - The new source file carries WebRTC's BSD licence header (copyright 2016 and 2011 notices). The same library already has WebRTC-licensed sources (`src/RtcpCommonHeader.cpp` carries the same 2016 header), so this follows precedent; whether copied licence text belongs in these files is the same maintainer question as in #14431. - The WebRTC revisions cited (M127 and M134) and the field order were not fetched here; the struct matches my recollection of `audio_format.h`, but that is not a check. ## Sources - Constructor at head: https://github.com/boykopovar/AnyPS5/blob/821b209e953ef669e48e3fef3a5a5852704e1dcd/core/libs/prx/libwebrtc/src/AudioCodecInfo.cpp - Layout assertions at head: https://github.com/boykopovar/AnyPS5/blob/821b209e953ef669e48e3fef3a5a5852704e1dcd/core/libs/prx/libwebrtc/include/AudioCodecInfo.hpp ## Not verified - The WebRTC source the PR adapts (M127 and M134) was not fetched; the field order and defaults are the author's citation. - The C++ test was not built or run here. - Hosted: at this head `conventions`, `eligibility`, `labels`, `library-portability` and `report` succeeded; `linux`, `register-context`, `relinker`, `relinker-asan` and `write-watch` were skipped.
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!14381
No description provided.