feat(libwebrtc): implement the voice activity detector API #13816

Merged
mkrieger95 merged 1 commit from upstream-pr/13816 into main 2026-11-01 02:59:35 +00:00
mkrieger95 commented 2026-10-31 07:54:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mkrieger95 on 2026-10-31T07:54:43Z.


What

Replace the five throwing WebRtcVad exports in libwebrtc with the WebRTC voice activity detector: create/free, initialize/reset, aggressiveness modes 0–3 and processing of 10/20/30 ms int16 PCM frames at 8/16/32/48 kHz. Build the WebRTC-derived libfvad core from a pinned source submodule. Keep its internal symbols hidden and include its license and patent notices in release archives.

This PR adds the five VAD exports alongside the existing libwebrtc implementations. API signatures and semantics follow public WebRTC; PS5 ABI and classification parity have not been measured and are recorded in the library debt file.

Tested

Linux x86-64, GCC 14.2, Release, BUILD_TESTING=ON; rebased onto upstream 7c4dcf0ad84de7a473ce97bb21644c614f1c3bd3 on 2026-11-01 UTC.

  • Built libwebrtc, the VAD test and the existing WebRTC regression targets. All six CTests pass: guest_webrtc_vad, guest_webrtc_fast_int_to_buffer, guest_webrtc_time, guest_webrtc_exp_filter, guest_webrtc_rtcp_common_header, guest_webrtc_opus.
  • python3 -m unittest tools.tests.test_package_release: suite passes, 78 tests run with 5 platform-specific skips.
  • Public-header audit: 394 libraries, 25,132 exports pass. Test-script registration: all 233 scripts registered. Conventions and diff whitespace checks pass.
  • Dynamic-symbol inspection confirms all five VAD exports and no exported libfvad, VAD-core or signal-processing helpers. Generated the NID-patched libwebrtc.prx successfully.
  • The VAD implementation and regression-test source are unchanged from the original head. Conflict resolution preserves the newer WebRTC declarations and source notes and records 385 remaining throwing exports.

No Windows, macOS, title or console execution; no full-project build or PS5 classification-parity claim. The full Linux and Windows PR builds require a maintainer to start them.

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:5095725995 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13816). Originally posted by [mkrieger95](https://github.com/mkrieger95) on 2026-10-31T07:54:43Z. --- ### What Replace the five throwing WebRtcVad exports in libwebrtc with the WebRTC voice activity detector: create/free, initialize/reset, aggressiveness modes 0–3 and processing of 10/20/30 ms int16 PCM frames at 8/16/32/48 kHz. Build the WebRTC-derived libfvad core from a pinned source submodule. Keep its internal symbols hidden and include its license and patent notices in release archives. This PR adds the five VAD exports alongside the existing libwebrtc implementations. API signatures and semantics follow public WebRTC; PS5 ABI and classification parity have not been measured and are recorded in the library debt file. ### 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 14.2, Release, `BUILD_TESTING=ON`; rebased onto upstream `7c4dcf0ad84de7a473ce97bb21644c614f1c3bd3` on 2026-11-01 UTC. - Built `libwebrtc`, the VAD test and the existing WebRTC regression targets. All six CTests pass: `guest_webrtc_vad`, `guest_webrtc_fast_int_to_buffer`, `guest_webrtc_time`, `guest_webrtc_exp_filter`, `guest_webrtc_rtcp_common_header`, `guest_webrtc_opus`. - `python3 -m unittest tools.tests.test_package_release`: suite passes, 78 tests run with 5 platform-specific skips. - Public-header audit: 394 libraries, 25,132 exports pass. Test-script registration: all 233 scripts registered. Conventions and diff whitespace checks pass. - Dynamic-symbol inspection confirms all five VAD exports and no exported libfvad, VAD-core or signal-processing helpers. Generated the NID-patched `libwebrtc.prx` successfully. - The VAD implementation and regression-test source are unchanged from the original head. Conflict resolution preserves the newer WebRTC declarations and source notes and records 385 remaining throwing exports. No Windows, macOS, title or console execution; no full-project build or PS5 classification-parity claim. The full Linux and Windows PR builds require a maintainer to start them. ### 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: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-31 08:11:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T08:11:15Z.

Review: APPROVED


Reviewed — looks good

The exact head adds the five VAD exports with matching declarations and definitions, validates supported PCM inputs, packages the pinned dependency notices, and records that PS5 parity remains unmeasured.

What I ran

Reviewed head bc646b5e6972e2f4ebfe45fa8c16fffd3fb1dbc5 against PR base 828ac0b2ae74aac181ba128fb59b08a1534f2041; the merge preview against current main e8c25dd3baa6e78531d5eee067fec5cbe8af3dcf was clean. Local environment: Debian Linux x86-64, Python 3.11; I did not use a compiler. Commands run from the exact-head checkout:

git diff --check 828ac0b2ae74aac181ba128fb59b08a1534f2041...bc646b5e6972e2f4ebfe45fa8c16fffd3fb1dbc5
python3 tools/check_conventions.py --base 828ac0b2ae74aac181ba128fb59b08a1534f2041 --head bc646b5e6972e2f4ebfe45fa8c16fffd3fb1dbc5 --title 'feat(libwebrtc): implement the voice activity detector API' --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13816-bc646b5e6972/pr-body.md
python3 -m py_compile tools/package_release.py
python3 -m unittest tools.tests.test_package_release
python3 tools/check_test_registration.py --scripts

The author reports a Debian x86-64/GCC 14.2 Release build, guest_webrtc_vad CTest pass, public-header audit, dynamic-symbol inspection, and NID-patched PRX generation. These are author-reported, not local runs. Hosted checks currently pass for conventions, intake, and labels; they do not include a product build.

Results

Check Result
Diff whitespace Passed
Conventions and PR template Passed
Python syntax Passed
Release packaging tests Passed: 78 run, 5 skipped
Python test registration Passed: all 230 scripts registered
Current-main merge preview Clean
Hosted checks Conventions, intake, labels passed; no product build
Raw output from locally run checks
All conventions checks passed.

Packaged 4 public headers and recursive dependencies
Packaged 4 public headers and recursive dependencies
......................s...........................s............ss............s
----------------------------------------------------------------------
Ran 78 tests in 0.862s

OK (skipped=5)
230 test script(s), each run by an add_test or a workflow

Negative control

Assertion Change on base Result
Release package includes the libfvad license notice Ran the new packaging test against base The test errored with KeyError because libs/licenses/libfvad.txt is absent. This is consistent with the feature being absent, but is not counted as a successful assertion-based negative control.

Findings

Blocking: None found.

Non-blocking: The PR correctly records that PS5 ABI and classification parity have not been measured. No console or title behavior was independently confirmed in this review.

Sources

Not verified

I did not locally build or run the C++ guest test, independently inspect the generated PRX, or test Windows, macOS, a PS5, or title behavior. The build, CTest, public-header audit, symbol inspection, and PRX-generation results above are from the PR description. The exact head remains bc646b5e6972e2f4ebfe45fa8c16fffd3fb1dbc5 at review time.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5721941959 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13816#pullrequestreview-5721941959). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-31T08:11:15Z. **Review:** APPROVED --- # Reviewed — looks good The exact head adds the five VAD exports with matching declarations and definitions, validates supported PCM inputs, packages the pinned dependency notices, and records that PS5 parity remains unmeasured. ## What I ran Reviewed head `bc646b5e6972e2f4ebfe45fa8c16fffd3fb1dbc5` against PR base `828ac0b2ae74aac181ba128fb59b08a1534f2041`; the merge preview against current `main` `e8c25dd3baa6e78531d5eee067fec5cbe8af3dcf` was clean. Local environment: Debian Linux x86-64, Python 3.11; I did not use a compiler. Commands run from the exact-head checkout: ```sh git diff --check 828ac0b2ae74aac181ba128fb59b08a1534f2041...bc646b5e6972e2f4ebfe45fa8c16fffd3fb1dbc5 python3 tools/check_conventions.py --base 828ac0b2ae74aac181ba128fb59b08a1534f2041 --head bc646b5e6972e2f4ebfe45fa8c16fffd3fb1dbc5 --title 'feat(libwebrtc): implement the voice activity detector API' --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13816-bc646b5e6972/pr-body.md python3 -m py_compile tools/package_release.py python3 -m unittest tools.tests.test_package_release python3 tools/check_test_registration.py --scripts ``` The author reports a Debian x86-64/GCC 14.2 Release build, `guest_webrtc_vad` CTest pass, public-header audit, dynamic-symbol inspection, and NID-patched PRX generation. These are author-reported, not local runs. Hosted checks currently pass for conventions, intake, and labels; they do not include a product build. ## Results | Check | Result | |---|---| | Diff whitespace | Passed | | Conventions and PR template | Passed | | Python syntax | Passed | | Release packaging tests | Passed: 78 run, 5 skipped | | Python test registration | Passed: all 230 scripts registered | | Current-main merge preview | Clean | | Hosted checks | Conventions, intake, labels passed; no product build | <details><summary>Raw output from locally run checks</summary> ```text All conventions checks passed. Packaged 4 public headers and recursive dependencies Packaged 4 public headers and recursive dependencies ......................s...........................s............ss............s ---------------------------------------------------------------------- Ran 78 tests in 0.862s OK (skipped=5) 230 test script(s), each run by an add_test or a workflow ``` </details> ## Negative control | Assertion | Change on base | Result | |---|---|---| | Release package includes the libfvad license notice | Ran the new packaging test against base | The test errored with `KeyError` because `libs/licenses/libfvad.txt` is absent. This is consistent with the feature being absent, but is not counted as a successful assertion-based negative control. | ## Findings **Blocking:** None found. **Non-blocking:** The PR correctly records that PS5 ABI and classification parity have not been measured. No console or title behavior was independently confirmed in this review. ## Sources - [VAD wrapper at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/bc646b5e6972e2f4ebfe45fa8c16fffd3fb1dbc5/core/libs/prx/libwebrtc/Vad.cpp) - [Pinned WebRTC VAD implementation](https://github.com/webrtc-mirror/webrtc/blob/3710345e71ad3a7c1f4ed4efef152fd4fc24869a/common_audio/vad/webrtc_vad.c) - [Pinned libfvad submodule revision](https://github.com/dpirch/libfvad/tree/532ab666c20d3cfda38bca63abbb0f152706c369) ## Not verified I did not locally build or run the C++ guest test, independently inspect the generated PRX, or test Windows, macOS, a PS5, or title behavior. The build, CTest, public-header audit, symbol inspection, and PRX-generation results above are from the PR description. The exact head remains `bc646b5e6972e2f4ebfe45fa8c16fffd3fb1dbc5` at review time.
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!13816
No description provided.