feat(libwebrtc): implement the legacy VideoEncoder::InitEncode overload #17725
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/17725"
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 AlexWhitehouse on 2026-11-09T13:04:47Z.
What
The legacy libwebrtc overload
int webrtc::VideoEncoder::InitEncode(const VideoCodec*, int number_of_cores, size_t max_payload_size)(_ZN6webrtc12VideoEncoder10InitEncodeEPKNS_10VideoCodecEim, NIDgra0DGtALJU) threwnot implemented. This PR implements it fromvideo_encoder.ccat M134 (8d78f5de). The forwarding is the same at M127 (e0b28a6a). The newVideoEncoderInitEncode.cppstarts with that file's notice.As upstream does, the overload builds
Settings(Capabilities(/*loss_notification=*/false), number_of_cores, max_payload_size), with no encoder thread limit. It then calls the encoder's ownInitEncode(const VideoCodec*, const Settings&)and returns its result. The core count and payload size are passed through unchanged.video_encoder.hat both milestones with GCC's class-layout dump andstatic_asserts. M127's pinned Abseil mapsabsl::optionaltostd::optional, so the layout is the same at both revisions.Settingsoverload is vtable slot 4 from the address point: after the two destructor entries,SetFecControllerOverrideand the legacy overload itself.Settingsis 24 bytes:capabilities.loss_notificationat 0,number_of_coresat 4,max_payload_sizeat 8, andoptional<int> encoder_thread_limitat 16 (its engaged flag at 20).Settingsobject is built in host memory with that layout, and the guest virtual is called through its System V ABI (APS5_VABI). A null encoder, vtable or slot throws.VideoEncoder.cpp(SetFecControllerOverride) isn't touched.Tested
guest_webrtc_video_encoder_init_encodeuses a synthetic guest vtable whose slot-4 callback records the receiver, the codec pointer and everySettingsfield, and returns a distinctive value. It covers:main, it fails with_ZN6webrtc12VideoEncoder10InitEncodeEPKNS_10VideoCodecEim_nid_postfix not implemented;guest_webrtc_video_encoderandpublic_headers.python3 tools/check_conventions.py --base origin/main: all checks passed.python3 tools/pr_overlap.py: no open PR implements this export.ColorSpace) couldn't be compared automatically. Neither touchesInitEncode.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)🤖 Generated with Claude Code