feat(libwebrtc): implement SmoothingFilterImpl::SmoothingFilterImpl(int) #18495

Merged
alvaroelpob merged 4 commits from upstream-pr/18495 into main 2026-11-16 21:35:50 +00:00
alvaroelpob commented 2026-11-11 18:40:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by alvaroelpob on 2026-11-11T18:40:16Z.


What

Implements webrtc::SmoothingFilterImpl::SmoothingFilterImpl(int), which threw through NotImplemented_nid_no_patch.

The constructor follows smoothing_filter.cc and smoothing_filter.h, the same at M127 (e0b28a6a81a9) and M134 (8d78f5de6c27) apart from absl::optional becoming std::optional. It stores init_time_ms_, computes init_factor_ and init_const_ with powf and alpha_ with exp, and leaves the optional end time disengaged. Because a guest calls AddSample, GetAverage and SetTimeConstantMs through the object's vtable and none of them is exported, the object gets a local vtable in SmoothingFilter order (D1, D0, AddSample, GetAverage, SetTimeConstantMs) whose entries follow the same file, with rtc::TimeMillis as the clock and the existing D1, as rtc::RateTracker does. The math goes through the guest libc powf, expf and exp.

src/SmoothingFilterImpl.cpp already carried the WebRTC notice and BSD licence; it now starts with the Derived from line. The 64-byte layout is asserted in include/SmoothingFilterImpl.hpp. Unverified on the console and recorded as debt: the layout, the vtable order and the optional flag position.

Tested

Linux: suite.py feat/libwebrtc-smoothing-filter-impl at 2e2c5bdfff: CTest 5716/5722 passed; conventions passed. Failing on main too: agc_driver_global_atomic_csub, agc_driver_stencil_copy_draw, agc_driver_coherent_atomic_loads_enabled, agc_driver_recorder, agc_draw_input_mirrors, agc_draw_input_reuse. guest_webrtc_smoothing_filter now also constructs filters with init times 0, 1, 100 and 100000 and calls AddSample, GetAverage, SetTimeConstantMs and the deleting destructor through the vtable slots: the constructor factors and alpha, no average and a refused time constant before the first sample, the first sample's state and end time, a time constant refused during initialization and accepted after it, and with alpha 0 the average following the last sample once time advances.

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:5264926827 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18495). Originally posted by [alvaroelpob](https://github.com/alvaroelpob) on 2026-11-11T18:40:16Z. --- ### What Implements `webrtc::SmoothingFilterImpl::SmoothingFilterImpl(int)`, which threw through `NotImplemented_nid_no_patch`. The constructor follows [smoothing_filter.cc](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100/common_audio/smoothing_filter.cc) and [smoothing_filter.h](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100/common_audio/smoothing_filter.h), the same at M127 (e0b28a6a81a9) and M134 (8d78f5de6c27) apart from `absl::optional` becoming `std::optional`. It stores `init_time_ms_`, computes `init_factor_` and `init_const_` with `powf` and `alpha_` with `exp`, and leaves the optional end time disengaged. Because a guest calls `AddSample`, `GetAverage` and `SetTimeConstantMs` through the object's vtable and none of them is exported, the object gets a local vtable in `SmoothingFilter` order (D1, D0, `AddSample`, `GetAverage`, `SetTimeConstantMs`) whose entries follow the same file, with `rtc::TimeMillis` as the clock and the existing D1, as `rtc::RateTracker` does. The math goes through the guest libc `powf`, `expf` and `exp`. `src/SmoothingFilterImpl.cpp` already carried the WebRTC notice and BSD licence; it now starts with the `Derived from` line. The 64-byte layout is asserted in `include/SmoothingFilterImpl.hpp`. Unverified on the console and recorded as debt: the layout, the vtable order and the optional flag position. ### 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: `suite.py feat/libwebrtc-smoothing-filter-impl` at 2e2c5bdfff: CTest 5716/5722 passed; conventions passed. Failing on main too: agc_driver_global_atomic_csub, agc_driver_stencil_copy_draw, agc_driver_coherent_atomic_loads_enabled, agc_driver_recorder, agc_draw_input_mirrors, agc_draw_input_reuse. guest_webrtc_smoothing_filter now also constructs filters with init times 0, 1, 100 and 100000 and calls AddSample, GetAverage, SetTimeConstantMs and the deleting destructor through the vtable slots: the constructor factors and alpha, no average and a refused time constant before the first sample, the first sample's state and end time, a time constant refused during initialization and accepted after it, and with alpha 0 the average following the last sample once time advances. ### 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
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!18495
No description provided.