feat(libwebrtc): implement webrtc::VideoFrame::render_time_ms #15276
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15276"
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:29Z.
What
Implements
webrtc::VideoFrame::render_time_ms() constin libwebrtc, which threw and was declared without parameters.The module's WebRTC revision lies between M127 and M134, as recorded in the debt file.
video_frame.cc(M127, M134) returnstimestamp_us()divided by 1000 at both.timestamp_us_is at offset 32 ofVideoFrame, afterid_, the buffer reference,timestamp_rtp_andntp_time_ms_, which are the same at both revisions.WebRtcVideoFramecovers that prefix.The function is added to
src/VideoFrameBuilder.cpp, so this builds on theBuilderPRs. The division rounds toward zero, as in C++. A null frame throws. It removes 1 export 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: 0, 999, 1000, 123456789, -1, -999, -1000, -1500 andINT64_MAXmicroseconds give the truncated milliseconds; a null frame throws.ctest -j16on head ca8a21d959: 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 fcfc333cb5, 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:01:22Z.
Review: APPROVED
Reviewed — approved
webrtc::VideoFrame::render_time_msand theVideoFrame::Buildersetters, constructor and destructor stacked under it build cleanly. The libwebrtc tests andpublic_headerspass, and the new test fails when the implementations are replaced with throwing stubs.What I ran
Head
fcfc333cb56431278fe9cc22cbc4069fc4d5581amerged intomain1e658521a0a599872612bb91949311e2956b5283(merged tree68b0ae99406f4c84b6d0e616a53e5f9c3225a9e1). Debian 13 VM, GCC 14.2.0, Release, Ninja,BUILD_TESTING=ON.Results
git diff --checkcheck_conventions.pylibs(script)unwrap_self_UnwrapTest_test_new_output_inherits_the_destination_directory_group, also fails onmainand is not caused by this PRguest_webrtc_*(14 tests, including the newguest_webrtc_video_frame_builder)public_headersmaintoo)git status --porcelainemptyNegative control
The test needs the new headers, so I kept
VideoFrame.hppandApi.hpp. I replaced the seven functions insrc/VideoFrameBuilder.cppwith bodies that callNotImplemented_nid_no_patch(__func__), which is howmainbehaves. The test then fails as expected:output
I restored the merged file and rebuilt; the test passes again and the worktree matches the merged tree.
Findings
Blocking
None.
Non-blocking
core/libs/prx/libwebrtc/tests/VideoFrameBuilder.cpp:86-103). This confirms the point oneandonlydean raised: the block still expectsstd::runtime_errorwhen destroying a builder that holds a frame buffer or packet infos. The rebase reply did not change it. Those are valid inputs that are not supported yet, so this test will need rewriting once the references are released. The throw in the code (src/VideoFrameBuilder.cpp:66-70) is fine. The block comes from #15275, so it should be removed there, and this branch rebased on it.render_time_ms). The file is right; only the description is stale.Depends online already declares this, so it is only a reminder to merge in order.Not verified
VideoFrameoffsets (timestampUsat 32) and the 192-byteBuilderlayout at M127 and M134: no network access tovideo_frame.h. The code matches what the description and the debt entries say, and thestatic_asserts pin the layout.public_headersand the script's selection were run.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T20:27:48Z.
Review: APPROVED
Re-checked — approved
The new commit
b5b2cb3eb641, from the rebase on the updated #15275, removes the destructor test cases that expected builders holding a frame buffer or packet infos to throw. Everything else in the stack is unchanged, and the checks pass.What changed since my last review
b5b2cb3eb641, "test(libwebrtc): drop the unsupported held-reference cases from the VideoFrame::Builder destructor test".TestDestructornow only checks a builder without references (core/libs/prx/libwebrtc/tests/VideoFrameBuilder.cpp:77-83). The throw in the code stays (core/libs/prx/libwebrtc/src/VideoFrameBuilder.cpp:66-70).d8756654cd32(the render-time test) only changes its context to fit the shorterTestDestructor. The other commits are the same patches as before (range-diff=).What I ran
Head
d9f11d0265cb7e3b5f78815824e9a1ba132fad25merged intomain086c0686c8adff3ee648fdbe34e0b0b647e1d511(merged tree2cc00a80583c0d3eebcdd8a844ee62d3b69e5e50). Debian 13 VM, GCC 14.2.0, Release, Ninja,BUILD_TESTING=ON.git diff --checkcheck_conventions.pylibs(script)unwrap_self_UnwrapTest_test_new_output_inherits_the_destination_directory_group, is a known failure onmain, not caused by this PR.guest_webrtc_*(14 tests)guest_webrtc_video_frame_buildertakes 0.01 sgit status --porcelainemptyNegative control
The test changed again, so I ran the control again. With
set_idandrender_time_msreplaced by throwing stubs (howmainbehaves), the test aborts at the first one it calls. With onlyrender_time_msstubbed, it aborts inTestRenderTimeMs:output
I then restored the merged file and rebuilt. The test passes again and the worktree matches the merged tree.
Previous findings
int reference = 0;…Require(threw);block is gone.TestDestructornow only checks the case without references, and the destructor still throws for builders that hold references.Depends on: #15274, #15275declares this.New findings
Blocking
None.
Non-blocking
None.
Not verified
VideoFrameandBuilderlayouts at M127 and M134: I had no network access tovideo_frame.h. Thestatic_asserts fix the layout the code relies on.