feat(libwebrtc): implement the webrtc::VideoFrame::Builder constructor and destructor for builders without references #15275
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15275"
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-02T22:37:26Z.
What
Implements
webrtc::VideoFrame::Builder::Builder()and~Builder()in libwebrtc, which threw and were declared without parameters, except for builders that hold references.The module's WebRTC revision lies between M127 and M134, as recorded in the debt file. Both are
= defaultinvideo_frame.cc(M127, M134). Every default member value of the 192-byteBuilderfrom the setters PR is zero (kNotSetId, null references, zero times,kVideoRotation_0, unset optionals anduse_low_latency_renderingfalse), so the constructor clears it.A builder that holds a frame buffer or packet infos has to release those guest references on destruction, the buffer through its virtual
Release. That throws throughNotImplemented_nid_no_patchand is recorded as debt; otherwise the destructor does nothing. A null builder throws.Builds on the setters PR, which adds the layout and file. 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_video_frame_buildertest: the constructor clears every field of a builder filled with 0xA5; a builder without references survives the destructor unchanged, and one with a buffer or with packet infos throwsstd::runtime_error.ctest -j16on head 69f4c08776: 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 092b9d4b9a, 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: 3796/3800 pass;guest_sce_net,guest_poll,guest_select_waitandguest_memoryfail only when the suite runs as a background job here, and pass when run in the foreground on this head and onmain.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 XairRrR on 2026-11-03T19:09:58Z.
Review: APPROVED
Reviewed — approved
The
webrtc::VideoFrame::Builderconstructor and destructor, plus the setters from #15274 that this branch carries, merge cleanly, build and pass their focused tests, and the new test fails when the constructor is reverted.What I ran
Head
092b9d4b9af2f7e86acbac962a6cacaf6c933153,main1e658521a0a599872612bb91949311e2956b5283, merged with--no-ffin a clean worktree (Debian 13 VM, GCC 14.2.0, Release, Ninja,BUILD_TESTING=ON).Results
git diff --checkcheck_conventions.pylibsOKunwrap_self_UnwrapTest_test_new_output_inherits_the_destination_directory_group) fails onmaintooguest_webrtc_video_frame_builderpublic_headers+ 64public_headers_compile_*public_headerstakes 60.8 s here; the AMD run reports it slow onmainas well, so this PR did not cause itNotImplemented_nid_no_patchcalls in the mergedExport.cpp(351 onmain), which matchesdocs/dev/debt/libwebrtc.md:5Negative control
The constructor's production code lives in a file this PR adds,
core/libs/prx/libwebrtc/src/VideoFrameBuilder.cpp. I changed only that body and rebuilt each time:main(NotImplemented_nid_no_patch(__func__)): the test aborts withstd::runtime_error: _ZN6webrtc10VideoFrame7BuilderC1Ev_nid_postfix not implemented.libwebrtc VideoFrame::Builder check failed at line 72. That is the first field check inTestConstructor.I then restored the file from the merged tree and rebuilt. The test passed again, and
git status --porcelainwas empty.Findings
Blocking
None.
Non-blocking
docs/dev/debt/libwebrtc.md:5) is correct; only the description text needs updating.core/libs/prx/libwebrtc/tests/VideoFrameBuilder.cpp. That comment has not been addressed at this head: the rebase kept those lines, and the author's reply does not mention it. The two of them should settle it. I don't treat it as blocking: the assertions check the documentedNotImplemented_nid_no_patchpath atcore/libs/prx/libwebrtc/src/VideoFrameBuilder.cpp:68-69.Not verified
Builderlayout and the all-zero default member values withvideo_frame.hat M127/M134 myself: there is no network access. The layout comes from #15274, and another reviewer has confirmed it against the header.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T20:29:40Z.
Review: APPROVED
Re-checked — approved
The new commit
b5b2cb3removes the two destructor cases that held a buffer or packet infos fromtests/VideoFrameBuilder.cpp. TheNotImplemented_nid_no_patchthrow stays in the production code. The checks pass, the focused test passes, and the test still fails when the constructor or the destructor is broken.What changed since my last review
b5b2cb3eb6: 18 lines deleted fromcore/libs/prx/libwebrtc/tests/VideoFrameBuilder.cpp. Commits 1–6 are identical to the ones I reviewed at092b9d4(range-diff=).What I ran
Head
b5b2cb3eb641f382b7862df061afe5287b8bfa77,main086c0686c8adff3ee648fdbe34e0b0b647e1d511, merged tree31e5423005824078ad87fabfa2978ccbe2ae1c72. The build was in a clean worktree: Debian 13 VM, GCC 14.2.0, Release, Ninja,BUILD_TESTING=ON.git diff --checkcheck_conventions.pylibsOKunwrap_self_UnwrapTest_test_new_output_inherits_the_destination_directory_group) also fails onmainguest_webrtc_video_frame_builderExport.cppand 351 onmain. This matchesdocs/dev/debt/libwebrtc.md:5Negative control
The production code is in
core/libs/prx/libwebrtc/src/VideoFrameBuilder.cpp, a file this PR adds. I changed only that file and rebuilt after each variant:Subprocess aborted).packetInfos || videoFrameBuffercondition. The trimmedTestDestructoraborts, so it still covers the destructor path for a builder without references.I then restored the file from the merged tree and rebuilt. The test passed again and
git status --porcelainwas empty.Previous findings
b5b2cb3,TestDestructor(core/libs/prx/libwebrtc/tests/VideoFrameBuilder.cpp:78-84) only checks that destroying a builder without references leaves it unchanged. The throw remains atcore/libs/prx/libwebrtc/src/VideoFrameBuilder.cpp:68-69and is documented in the debt entry.New findings
Blocking
None.
Non-blocking
std::runtime_error". A later bullet says those cases were dropped, but the first one now contradicts the test file. Updating it together with the 348→346 count would keep the description accurate.Not verified
Builderlayout and the zero default member values withvideo_frame.hat M127/M134 myself, because there is no network access. Another reviewer has confirmed them.ctest -j16run at this head (3796/3800, with the four failures passing in the foreground); that result is author-reported.