feat(libwebrtc): implement webrtc::RmsLevel's constructor, destructor, Analyze and Average #14224
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14224"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by zaryabzip on 2026-11-01T00:49:10Z.
What
webrtc::RmsLevel's constructor, destructor,Analyze(rtc::ArrayView<const int16_t>)andAverage()are implemented. These are the fourRmsLevelexportslibwebrtc.sprxhas. They're adapted fromrms_level.cc, the wayExpFilterandRtcpCommonHeaderalready are onmain, with WebRTC's copyright notice and BSD licence at the top ofsrc/RmsLevel.cpp.Same at both pins. The module's WebRTC revision is somewhere from M127 to M134 (see the debt file).
rms_level.hand.ccare identical at the two pinned revisions except for one thing: M127 declaresblock_size_asabsl::optional<size_t>, M134 asstd::optional<size_t>. The abseil both pins use setsABSL_OPTION_USE_STD_OPTIONALto 2, so in WebRTC's C++20 buildabsl::optionalisstd::optional. The layout is therefore the same 40 bytes at both:sum_square_at 0;sample_count_at 8;max_sum_square_at 16;block_size_'s value and flag at 24 and 32.include/RmsLevel.hpppins that layout withstatic_asserts.Behaviour, as upstream:
Analyzegets the view's pointer and size in the two registers afterthis. It skips an empty view, resets on a new block size, and accumulates the float sum of squares and the per-call maximum.Averagereturns the RFC 6465 level: 127 for digital silence, 126 for inaudible but not muted. Then it resets.ExpFilter.The console's
log10could round a level differently, and nothing here was compared with the console. The debt entry says so. libwebrtc goes up by 4 functions.Test. The new
tests/RmsLevel.cppchecks:Average;Overlap:
git merge-treemerges this cleanly withmainand every open pull request that merges withmain.No title is known to reach these exports yet: no issue, bring-up discussion or PR mentions
libwebrtcor one of their NIDs, as of 2026-11-02.Tested
Windows 11 (WinLibs MinGW-w64 GCC 15.2.0 UCRT r7, CMake 4.3.1, Ninja 1.13.2) and Ubuntu 24.04 on WSL2 (GCC 13.3.0, CMake 3.28.3, Ninja 1.11.1), with the head
107269e3d0merged intomaincc26ab4438.libwebrtc/include/Api.hpprebuilds with no warnings, and so does each header compiled on its own.ctest -R "guest_webrtc|guest_offline_imports": 7 of 7 pass on both hosts.guest_webrtc_rms_levelpasses 3 of 3 on--repeat until-fail:3.WebRtcRmsLeveltype, so it can't build on plainmain. On thatmainwith onlyinclude/RmsLevel.hpp(and its#includeinApi.hpp) plus the test, withmain's stubs left in place, it aborts at the constructor with_ZN6webrtc8RmsLevelC1Ev_nid_postfix not implemented(Windows exit 0xc0000409, Linux SIGABRT).tools/check_conventions.pypasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T01:01:00Z.
Review: APPROVED
Reviewed — looks good
At head
107269e3d09238b8607886d58d5429cc9f34bdfb, the implementation matches the pinned WebRTCRmsLevelalgorithm and layout for the four exported methods, with focused tests covering accumulation, reset behavior, silence, and error handling.What I ran
Reviewed head
107269e3d09238b8607886d58d5429cc9f34bdfbagainst basecae3edaf11db8c6c1694c2d772d07c079755a71f(main); the exact-head merge preview was clean. Environment: Linux x86_64, glibc 2.36, Python 3.11.2, GCC 12.2.0. I compared the implementation with the pinned WebRTC source and inspected the complete diff, test source, and CMake registration.No local build or C++ test was run. The precheck's isolated snapshot does not include the local-only ABI/test-quality helper scripts; I ran the ABI audit and test-quality heuristic separately against files extracted from the exact head and inspected CMake registration directly.
Results
passed_with_warnings; the four new exports have one declaration and definition each and no aliases. Existing explicit aliases account for the warnings; the audit does not certify runtime ABI.cae3edaf11db8c6c1694c2d772d07c079755a71f; no declared dependencies.guest_webrtc_rms_levelis registered in the changed CMake file.mainatcc26ab4438(an ancestor of the reviewed base); not independently run here.Unedited outputs for local checks
git diff --checkproduced no output and exited successfully.Hosted check snapshot:
Negative control
Findings
Blocking
None found in the reviewed diff.
Non-blocking
The PR records that console
log10rounding has not been compared. That limitation is documented in the library debt entry; it was not independently measured in this review.Sources
107269e3d09238b8607886d58d5429cc9f34bdfb.rms_level.ccat commit8d78f5de6c27b2c793039989ea381f1428fb0100.rms_level.hat the same commit.Not verified
log10rounding.Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-11-01T20:00:42Z.
Review: COMMENTED
Withdrawn. The title-ID demand was not a CONTRIBUTING requirement;
Unblocks: noneis allowed and no title is known for these exports.