feat(libwebrtc): implement rtc::ExpFilter Reset and Apply #13689
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/13689"
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 alvaroelpob on 2026-10-31T00:04:24Z.
What
Implements
rtc::ExpFilter::Reset(float)andrtc::ExpFilter::Apply(float, float)in libwebrtc. Both threw and were declared without parameters.The module's WebRTC revision lies between M127 and M134, as recorded in the debt file by #13687.
rtc_base/numerics/exp_filter.handexp_filter.ccare the same at M127 branch-heads/6533 and M134 branch-heads/6998. From M135 the class moves to thewebrtcnamespace, which no longer matches the export names.The two functions are adapted from
exp_filter.ccand live insrc/ExpFilter.cpp, which starts with that file's WebRTC copyright notice and the BSD licence text from WebRTC'sLICENSEat the same revision. The debt entry says they are adapted fromexp_filter.cc.WebRtcExpFilteris the 12-byte layout fromexp_filter.h(alpha_,filtered_,max_), checked withstatic_asserts. The two member functions takethisas their first argument:Resetstoresalphaand sets the output tokValueUndefined(-1), leavingmax_alone.Applybehaves like upstream. The first sample after an unset output becomes the output. An exponent of 1 usesalpha_directly, and any other exponent usespow(alpha_, exp). Ifmax_is set, the result is clamped to it.The debt file records the source and notes that the last bit of a result can differ if the console build fuses the multiply-adds. The inventory drops from 411 to 409.
Tested
Ubuntu 26.04 (WSL2, kernel 6.18), GCC 15.2.0, Release, full build with
BUILD_TESTING=ON.guest_webrtc_exp_filtertest:Resetsets alpha and the unset output and keepsmax_.pow(alpha, 0.5).std::invalid_argument.ctest -j16on head0155e95648: 3031/3031 pass.check_conventions.py --base upstream/mainpasses.pr_overlap.pyreports no overlap with open pull requests.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-10-31T00:31:05Z.
Review: APPROVED
Reviewed — looks good
The
ExpFilterimplementation matches the pinned WebRTC logic for valid objects, and its declarations, test registration, and declared #13687 dependency are consistent.What I ran
Reviewed head
8f63559455b61e103a370148dd46d2e469ae1fc8against PR basef25279c0ca4cb068370df4baaa46de7b4f4741c7. The stack check previewed it cleanly against currentmaincbc30121bd6135d6ba8f50fe0377a642b0a5139e; the exact #13687 head is included. Environment: Debian Linux x86-64, Python 3.11.2; no local build or C++ test run.Results
passed_with_warnings; both changed ExpFilter exports have matching declarations and definitions, with no target-specific findings. Remaining warnings concern existing unknown exports.guest_webrtc_exp_filteris registered. I inspected coverage forReset, first-sample behavior, exponents 1/2/fractional, the-1sentinel restart, max clamping, and the local null guard.Unedited outputs
Findings
Blocking
None found in the reviewed stack head.
Non-blocking
The PR says upstream dereferences a null filter “so a null filter throws.” The pinned source does not specify an exception for a null
thispointer; that call is outside the valid-object contract. The newstd::invalid_argumentguard is reasonable defensive behavior, but should be described as local behavior rather than upstream behavior.Sources
Not verified
No local build or test run, Linux hosted product build, macOS runtime, or console/title behavior was independently verified. CTest results are author-reported.