feat(libwebrtc): implement the webrtc::AudioDeviceGeneric built-in effect and underrun defaults #14129

Merged
alvaroelpob merged 15 commits from upstream-pr/14129 into main 2026-11-02 19:46:22 +00:00
alvaroelpob commented 2026-10-31 19:57:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by alvaroelpob on 2026-10-31T19:57:20Z.


What

Implements these webrtc::AudioDeviceGeneric base methods in libwebrtc, which threw and were declared without parameters:

  • BuiltInAECIsAvailable(), BuiltInAGCIsAvailable() and BuiltInNSIsAvailable()
  • EnableBuiltInAEC(bool), EnableBuiltInAGC(bool) and EnableBuiltInNS(bool)
  • GetPlayoutUnderrunCount()

AudioDeviceGeneric is the abstract base of the platform audio devices. A device that does not override these methods gets the base versions in its vtable, so calls through the vtable reach these exports.

The module's WebRTC revision lies between M127 and M134, as recorded in the debt file by #13687. modules/audio_device/audio_device_generic.cc is the same at M127 branch-heads/6533 and M134 branch-heads/6998, except that M134 comments out the unused enable parameter names.

The functions are adapted from audio_device_generic.cc and live in src/AudioDeviceGeneric.cpp, which starts with that file's WebRTC copyright notice and the BSD licence text from WebRTC's LICENSE. The debt entry says it is adapted from audio_device_generic.cc.

As upstream, the three availability checks return false, and the three EnableBuiltIn* methods and GetPlayoutUnderrunCount return -1. None of them reads the device, so its layout is not needed. Upstream also logs RTC_LOG_F(LS_ERROR) << "Not supported on this platform" on each call. libwebrtc's logging is not implemented, so that is recorded as debt. The iOS-only GetPlayoutAudioParameters and GetRecordAudioParameters are not in the module. The inventory drops from 386 to 379.

Tested

Ubuntu 26.04 (WSL2, kernel 6.18), GCC 15.2.0, Release, full build with BUILD_TESTING=ON.

  • New guest_webrtc_audio_device_generic test, on a device filled with 0xC3:
    • The three availability checks return false.
    • The three EnableBuiltIn* methods return -1 for both true and false, and AEC stays unavailable afterwards.
    • GetPlayoutUnderrunCount returns -1.
    • No device byte changes.
  • Full ctest -j16 on head 61396729f3: 3037/3037 pass. check_conventions.py --base upstream/main passes. pr_overlap.py reports the open pull requests listed in Depends on.
  • Rebased onto main 1bc97b9527 after #13736 merged; the only conflicts were the include, CMake source and debt count lines. Full ctest -j16 on the top of the stack, #14148 head 0884de5716 (which contains this head, 2a05226ae3): 3087/3087 pass. check_conventions.py --base upstream/main passes.
  • Rebased onto main dc9dc7eaae after #13764 and #13816 merged. The conflicts were the debt count line and, in the AudioDeviceGeneric commit, the Export.cpp stubs next to the removed VAD stubs; that commit keeps main's side and removes only its own seven stubs. The count is now set from the stubs left in Export.cpp plus the 60 bound by NID (356
    31 on this head, 143089f08a). Full ctest -j16 on the top of the stack, #14148 head 44e052f6dd: 3113/3113 pass. check_conventions.py --base upstream/main passes.
  • Not tested: Windows, a title.

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: #14087, #14095, #14116, #14120
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5101037978 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14129). Originally posted by [alvaroelpob](https://github.com/alvaroelpob) on 2026-10-31T19:57:20Z. --- ### What Implements these `webrtc::AudioDeviceGeneric` base methods in libwebrtc, which threw and were declared without parameters: - `BuiltInAECIsAvailable()`, `BuiltInAGCIsAvailable()` and `BuiltInNSIsAvailable()` - `EnableBuiltInAEC(bool)`, `EnableBuiltInAGC(bool)` and `EnableBuiltInNS(bool)` - `GetPlayoutUnderrunCount()` `AudioDeviceGeneric` is the abstract base of the platform audio devices. A device that does not override these methods gets the base versions in its vtable, so calls through the vtable reach these exports. The module's WebRTC revision lies between M127 and M134, as recorded in the debt file by #13687. `modules/audio_device/audio_device_generic.cc` is the same at [M127 branch-heads/6533](https://webrtc.googlesource.com/src/+/e0b28a6a81a989c1f5c89e30fcd247870047390d/modules/audio_device/audio_device_generic.cc) and [M134 branch-heads/6998](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100/modules/audio_device/audio_device_generic.cc), except that M134 comments out the unused `enable` parameter names. The functions are adapted from `audio_device_generic.cc` and live in `src/AudioDeviceGeneric.cpp`, which starts with that file's WebRTC copyright notice and the BSD licence text from WebRTC's `LICENSE`. The debt entry says it is adapted from `audio_device_generic.cc`. As upstream, the three availability checks return false, and the three `EnableBuiltIn*` methods and `GetPlayoutUnderrunCount` return -1. None of them reads the device, so its layout is not needed. Upstream also logs `RTC_LOG_F(LS_ERROR) << "Not supported on this platform"` on each call. libwebrtc's logging is not implemented, so that is recorded as debt. The iOS-only `GetPlayoutAudioParameters` and `GetRecordAudioParameters` are not in the module. The inventory drops from 386 to 379. ### 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. --> Ubuntu 26.04 (WSL2, kernel 6.18), GCC 15.2.0, Release, full build with `BUILD_TESTING=ON`. - New `guest_webrtc_audio_device_generic` test, on a device filled with 0xC3: - The three availability checks return false. - The three `EnableBuiltIn*` methods return -1 for both `true` and `false`, and AEC stays unavailable afterwards. - `GetPlayoutUnderrunCount` returns -1. - No device byte changes. - Full `ctest -j16` on head 61396729f3: 3037/3037 pass. `check_conventions.py --base upstream/main` passes. `pr_overlap.py` reports the open pull requests listed in Depends on. - Rebased onto main 1bc97b9527 after #13736 merged; the only conflicts were the include, CMake source and debt count lines. Full `ctest -j16` on the top of the stack, #14148 head 0884de5716 (which contains this head, 2a05226ae3): 3087/3087 pass. `check_conventions.py --base upstream/main` passes. - Rebased onto main dc9dc7eaae after #13764 and #13816 merged. The conflicts were the debt count line and, in the AudioDeviceGeneric commit, the `Export.cpp` stubs next to the removed VAD stubs; that commit keeps `main`'s side and removes only its own seven stubs. The count is now set from the stubs left in `Export.cpp` plus the 60 bound by NID (356 31 on this head, 143089f08a). Full `ctest -j16` on the top of the stack, #14148 head 44e052f6dd: 3113/3113 pass. `check_conventions.py --base upstream/main` passes. - Not tested: Windows, a title. ### 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: #14087, #14095, #14116, #14120 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
CnRJay commented 2026-11-01 19:49:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-11-01T19:49:25Z.

Review: COMMENTED


Withdrawn. This review applied a title-ID/log requirement that is not in CONTRIBUTING (Unblocks: none is allowed), and it contained no code review.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5729922178 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14129#pullrequestreview-5729922178). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-11-01T19:49:25Z. **Review:** COMMENTED --- Withdrawn. This review applied a title-ID/log requirement that is not in CONTRIBUTING (`Unblocks: none` is allowed), and it contained no code review.
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!14129
No description provided.