feat(libwebrtc): implement the webrtc::EchoCanceller3Config copy constructor and assignment #15195
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15195"
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-11-02T20:26:15Z.
What
Implements
webrtc::EchoCanceller3Config::EchoCanceller3Config(const EchoCanceller3Config&)andoperator=(const EchoCanceller3Config&)in libwebrtc, which threw and were declared without parameters.The module's WebRTC revision lies between M127 and M134, as recorded in the debt file. Both are
= defaultinecho_canceller3_config.cc(M127, M134), andecho_canceller3_config.his identical at both. Every member of its nested structs is asize_t,int,floatorbool, so a default copy copies every member. This copies all 608 bytes; the firmware 13.42 copy leaves five padding ranges of the destination unwritten, which the debt entry records and the tests do not check.src/EchoCanceller3Config.cppstarts with that file's WebRTC notice and the BSD licence.The fields are not modelled:
WebRtcEchoCanceller3Configis 608 bytes aligned to 8, the size and alignment that compiling that header (withrtc_export.h) for x86-64 gives at both revisions. The assignment returnsthis. A null object or source throws. The default constructor and the fields stay as debt. It removes 2 exports from the inventory.Tested
Ubuntu 26.04 (WSL2, kernel 6.18), GCC 15.2.0, Release, full build with
BUILD_TESTING=ON.guest_webrtc_echo_canceller3_configtest: a patterned 608-byte config copies into storage filled with 0xA5, assignment returnsthisand survives self-assignment, and null arguments throwstd::invalid_argumentwithout changing the object.ctest -j16on head 7d014e81ec: 3596/3596 pass.check_conventions.py --base upstream/mainpasses.pr_overlap.py: no open pull request implements these functions. The shared lines are the pending-export count indocs/dev/debt/libwebrtc.mdand the source, test and declaration lists inCMakeLists.txtandApi.hpp.main4f41f4c375, head e5cb0fa18e, to resolve the conflicts on the sharedCMakeLists.txt,Export.cppand debt-file lines; both sides are kept and the debt count is recomputed fromExport.cpp. Full build andctest -j16: 3796/3800 pass;guest_sce_net,guest_poll,guest_select_waitandguest_memoryfailed under that load, pass when run alone, andmain4f41f4c375passes all 3799 with-j16on the same machine.check_conventions.py --base upstream/mainpasses.ctest -j16: 3800/3800 pass.check_conventions.py --base upstream/mainpasses.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 BunnyFl on 2026-11-03T23:28:09Z.
Review: COMMENTED
@alvaroelpob thanks. The 608-byte size and the
thisreturn check out against the firmware, and the PR passes on Windows. One small fidelity point and a question.What I ran: this head merged onto
main(merge98e71ab1a8), Windows 11, WinLibs GCC, Release.guest_webrtc_echo_canceller3_configandpublic_headerspass (2 of 2). That covers the Windows run your description lists as not tested.Firmware:
system/common/lib/libwebrtc.sprx13.42 (sha256d59d0caf6967329b39201a2a0bd6df7b994516f21701b9801908db6735ae5314), read from disassembly, not run:_ZN6webrtc20EchoCanceller3ConfigC1ERKS0_at0x3f3920(to itsretat0x3f3ac5)._ZN6webrtc20EchoCanceller3ConfigaSERKS0_at0x3f3ad0(to itsretat0x3f3c78).rax = rdi(3f3ad4: mov %rdi,%rax), which matches yourreturn config.The point: the firmware copy is member by member, not a block copy. Its last stores (before
3f3ac5) reach byte 607, which fits 608, but they skip the padding. For example:Byte
0x70is copied on its own, and nothing writes0x71to0x77. I listed every destination store from both bodies with a small script. Both leave the same five ranges unwritten:0x71–0x77,0x14e–0x14f,0x179–0x17f,0x184–0x187and0x249–0x24f(27 bytes).So on the console those destination bytes keep whatever they held.
std::memmoveover all 608 bytes overwrites them, andTestCopyConstructor/TestAssignmentpin that with a fullmemcmpagainst a 0xA5-filled target.Nothing is likely to read padding, so this isn't a blocker for me. Still, the PR text says a default copy "copies the whole object", and the test asserts more than the console does. Two ways to match it:
0x00–0x70,0x78–0x14d,0x150–0x178,0x180–0x183,0x188–0x248,0x250–0x25f), and have the test check that the padding keeps its 0xA5 fill;Question: do you know whether the PS5 module was built from a revision where these structs are identical to the ones you pinned? The padding positions above fit
boolmembers followed by wider fields, so they look consistent with your header. If you derived the 608 from a compile of that header, the gaps should match itsoffsetofs too.Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-04T14:56:42Z.
Review: APPROVED
@alvaroelpob thanks for answering the question and for the padding check. That settles it. The second option works for me.
MembersEqual(core/libs/prx/libwebrtc/tests/EchoCanceller3Config.cpp:34) compares every byte except the five ranges inFirmwareUnwrittenPadding(:32), which are the ones I listed from the 13.42 disassembly. So the tests no longer pin bytes the console leaves alone. The self-assignment case compares against a copy taken before it (:65), which keeps it a full-object check without depending on padding.What I ran: head
07942fb5edmerged ontomainb11c7bf84f(mergeb0da3deca1), Windows 11, WinLibs GCC, Release,BUILD_TESTING=ON:guest_webrtc_echo_canceller3_configandpublic_headers: 2 of 2 pass.sizeof(WebRtcEchoCanceller3Config)insrc/EchoCanceller3Config.cpp,guest_webrtc_echo_canceller3_configfails. The last 8 bytes are a member, not padding. A plain negative control doesn't apply, sincesrc/EchoCanceller3Config.cppis a file this PR adds.check_conventions.py --base upstream/mainpasses.pr_overlap.py --branch: 32 open PRs touch the same files (the libwebrtcCMakeLists.txt, header and debt lines), none the same exports.