feat(libwebrtc): implement the webrtc::ColorSpace copy constructor and assignment #15189
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15189"
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:25:55Z.
What
Implements
webrtc::ColorSpace::ColorSpace(const ColorSpace&)andColorSpace::operator=(const ColorSpace&)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
= defaultincolor_space.cc(M127, M134).color_space.hdiffers between M127 and M134 only in spellinghdr_metadata_asabsl::optionalorstd::optional, andhdr_metadata.his identical. The filesrc/ColorSpace.cppstarts withcolor_space.cc's WebRTC notice and the BSD licence.WebRtcColorSpaceis the 68-byte layout:uint8_tIDs (primaries, transfer, matrix);intrange and the two chroma sitings at 4, 8 and 12;HdrMetadata(four chromaticities, two luminances, twointlight levels) at 16, with the optional's engaged flag at 64.Every member is trivially copyable, so both copy the whole object, and the assignment returns
this. A null object or source, which upstream dereferences, throws. 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_color_spacetest: copying an HDR10 color space (BT.2020, PQ, full range, chroma sitings, mastering metadata and light levels) and an SDR one without metadata into storage filled with 0xA5; assignment returnsthis, clears the metadata from an empty source and survives self-assignment; null arguments throwstd::invalid_argumentand leave the object untouched.ctest -j16on head 64670e7028: 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 274830625a, 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. Both copies now move 65 bytes (offsetof(WebRtcColorSpace, hasHdrMetadata) + 1) as the 13.42 module does, and the newTestTailPaddingUntouchedchecks bytes 65 to 67 keep 0xA5 after the copy constructor andoperator=. Full build andctest -j16: 3800/3800 pass (a first run under load failedguest_sce_net,guest_poll,guest_select_waitandguest_memory, which pass alone 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 BunnyFl on 2026-11-02T21:12:13Z.
Review: APPROVED
Matches firmware 13.42's
system/common/lib/libwebrtc.sprx(sha256d59d0caf6967329b39201a2a0bd6df7b994516f21701b9801908db6735ae5314) in layout and result, disassembly only. The copy constructor (wTCRZOkkrnM,0x1516f0) andoperator=(tY7zuWm3mFU,0x151730, which also returnsthisinrax) are the same copy:That's this PR's 68-byte
WebRtcColorSpacewithhasHdrMetadataat 64.Non-blocking: the module copies 65 bytes (
0x00-0x40), whilememmove(..., sizeof(WebRtcColorSpace))copies 68 and so also writes the destination's three tail-padding bytes. That would only show if a guest object reused that tail padding (e.g. a derived class under the Itanium ABI), but copyingoffsetof(WebRtcColorSpace, hasHdrMetadata) + 1bytes would match the module exactly.Tested on Windows 11, WinLibs GCC 15.2.0, with this head merged onto
main:guest_webrtc_color_spacepasses, nothing skipped. Withmain'sExport.cppandApi.hpp, the new source doesn't compile against the old parameterless declarations.