feat(libwebrtc): implement VideoFrame width and height #15766

Merged
AlexWhitehouse merged 1 commit from upstream-pr/15766 into main 2026-11-07 17:16:51 +00:00
AlexWhitehouse commented 2026-11-04 13:33:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by AlexWhitehouse on 2026-11-04T13:33:07Z.


What

Implements libwebrtc webrtc::VideoFrame::width() const (ZoZkZB0F7vw) and webrtc::VideoFrame::height() const (8qjTJRqcnn0), which threw through NotImplemented_nid_no_patch.

Source: api/video/video_frame.cc at M134 (lines 327–333), the same as M127 (lines 314–320), the two ends of the revision range in the debt file's "Source revision" entry:

int VideoFrame::width() const {
  return video_frame_buffer_ ? video_frame_buffer_->width() : 0;
}
  • Layout: in video_frame.h, VideoFrame starts with uint16_t id_ and then scoped_refptr<VideoFrameBuffer> video_frame_buffer_, a single pointer (scoped_refptr.h), so the buffer is at offset 8. That is the same at M127.
  • Virtual slots: VideoFrameBuffer derives from RefCountInterface: AddRef 0, Release 1, the Itanium destructor pair 2–3, then type 4, width 5, height 6. The declarations are the same at M127.
  • Implementation: src/VideoFrameDimensions.cpp reads the buffer pointer, returns 0 when it is null, and otherwise calls slot 5 or 6 with the buffer as this (APS5_VABI). It starts with video_frame.cc's notice copied byte for byte, plus the WebRTC BSD licence, as the other libwebrtc ports do. A null frame, a null vtable or a null slot, which upstream dereferences, throws. Reference counts are not touched, as upstream does not touch them.
  • Kept self-contained in a new 16-byte WebRtcVideoFrameDimensions prefix header rather than a VideoFrame.hpp, because alvaroelpob's open VideoFrame series (#15274, #15275, #15276) adds its own include/VideoFrame.hpp. Those PRs leave width and height as stubs. If #15276 merges first, I'll switch these two to its WebRtcVideoFrame struct.
  • Debt: a new entry under "Public source implementations". The inventory count drops from 351 to 349; both exports already had names, so the unnamed figure stays 60.

Tested

Linux x86-64 (Ubuntu 26.04, GCC 15, Release):

  • New registered ctest guest_webrtc_video_frame_dimensions:

    • a frame with a null buffer: both return 0;
    • a frame whose buffer is a synthetic guest object whose slots 5 and 6 return 853 and 479: both exports return those values, each slot is called once with the buffer as this, and the 256-byte frame storage (guard-filled) is unchanged;
    • a null frame: both throw.
  • On main: the test fails with _ZNK6webrtc10VideoFrame5widthEv_nid_postfix not implemented, so the libwebrtc group goes from 13 passed and 1 failed to 14/14 with this PR.

  • Mutation check: swapping slots 5 and 6 fails with libwebrtc VideoFrame dimensions check failed at line 41.

  • Windows 11 (build 26300, WinLibs MinGW-w64 GCC 15.2.0 UCRT, Release): ctest -R webrtc passes 14/14 at 96a941f038, with no warnings in the new files.

    • The new test can't be built against main on Windows, because main declares both exports as (void).
    • The Linux negative control above ran the test against main's library.
  • python3 tools/check_conventions.py --base origin/main: all conventions checks passed. The public-header audit passed: 406 libraries, 28,350 exports.

  • python3 tools/pr_overlap.py --branch feat/libwebrtc-video-frame-dimensions: no open PR implements these exports, but some lines are shared:

    • #15274, #15275 and #15276 (alvaroelpob's VideoFrame series) conflict in Export.cpp and Api.hpp, because they remove the neighbouring Builder and render_time_ms stubs on adjacent lines. Their CMake changes merge cleanly.
    • The inventory count line in docs/dev/debt/libwebrtc.md is shared with most open libwebrtc PRs: #14224, #14232, #14381, #15092, #15190–#15192, #15194, #15197, #15211, #15261–#15264, #15266–#15270, #15272, #15274–#15277, #15285 and #15609.
    • #14212 (debt spacing) also conflicts on that debt file.

    Whichever merges second recounts and rebases.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5155150048 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15766). Originally posted by [AlexWhitehouse](https://github.com/AlexWhitehouse) on 2026-11-04T13:33:07Z. --- ### What Implements libwebrtc `webrtc::VideoFrame::width() const` (`ZoZkZB0F7vw`) and `webrtc::VideoFrame::height() const` (`8qjTJRqcnn0`), which threw through `NotImplemented_nid_no_patch`. Source: [`api/video/video_frame.cc`](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100/api/video/video_frame.cc#327) at M134 (lines 327–333), the same as [M127](https://webrtc.googlesource.com/src/+/e0b28a6a81a989c1f5c89e30fcd247870047390d/api/video/video_frame.cc#314) (lines 314–320), the two ends of the revision range in the debt file's "Source revision" entry: ```cpp int VideoFrame::width() const { return video_frame_buffer_ ? video_frame_buffer_->width() : 0; } ``` - **Layout:** in [`video_frame.h`](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100/api/video/video_frame.h), `VideoFrame` starts with `uint16_t id_` and then `scoped_refptr<VideoFrameBuffer> video_frame_buffer_`, a single pointer ([`scoped_refptr.h`](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100/api/scoped_refptr.h)), so the buffer is at offset 8. That is the same at M127. - **Virtual slots:** [`VideoFrameBuffer`](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100/api/video/video_frame_buffer.h) derives from [`RefCountInterface`](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100/api/ref_count.h): `AddRef` 0, `Release` 1, the Itanium destructor pair 2–3, then `type` 4, `width` 5, `height` 6. The declarations are the same at M127. - **Implementation:** `src/VideoFrameDimensions.cpp` reads the buffer pointer, returns 0 when it is null, and otherwise calls slot 5 or 6 with the buffer as `this` (`APS5_VABI`). It starts with `video_frame.cc`'s notice copied byte for byte, plus the WebRTC BSD licence, as the other libwebrtc ports do. A null frame, a null vtable or a null slot, which upstream dereferences, throws. Reference counts are not touched, as upstream does not touch them. - **Kept self-contained** in a new 16-byte `WebRtcVideoFrameDimensions` prefix header rather than a `VideoFrame.hpp`, because alvaroelpob's open VideoFrame series (#15274, #15275, #15276) adds its own `include/VideoFrame.hpp`. Those PRs leave `width` and `height` as stubs. If #15276 merges first, I'll switch these two to its `WebRtcVideoFrame` struct. - **Debt:** a new entry under "Public source implementations". The inventory count drops from 351 to 349; both exports already had names, so the unnamed figure stays 60. ### Tested Linux x86-64 (Ubuntu 26.04, GCC 15, Release): - New registered ctest `guest_webrtc_video_frame_dimensions`: - a frame with a null buffer: both return 0; - a frame whose buffer is a synthetic guest object whose slots 5 and 6 return 853 and 479: both exports return those values, each slot is called once with the buffer as `this`, and the 256-byte frame storage (guard-filled) is unchanged; - a null frame: both throw. - **On `main`:** the test fails with `_ZNK6webrtc10VideoFrame5widthEv_nid_postfix not implemented`, so the libwebrtc group goes from 13 passed and 1 failed to 14/14 with this PR. - **Mutation check:** swapping slots 5 and 6 fails with `libwebrtc VideoFrame dimensions check failed at line 41`. - **Windows 11** (build 26300, WinLibs MinGW-w64 GCC 15.2.0 UCRT, Release): `ctest -R webrtc` passes 14/14 at 96a941f038, with no warnings in the new files. - The new test can't be built against `main` on Windows, because `main` declares both exports as `(void)`. - The Linux negative control above ran the test against `main`'s library. - `python3 tools/check_conventions.py --base origin/main`: all conventions checks passed. The public-header audit passed: 406 libraries, 28,350 exports. - **`python3 tools/pr_overlap.py --branch feat/libwebrtc-video-frame-dimensions`:** no open PR implements these exports, but some lines are shared: - **#15274, #15275 and #15276** (alvaroelpob's VideoFrame series) conflict in `Export.cpp` and `Api.hpp`, because they remove the neighbouring Builder and `render_time_ms` stubs on adjacent lines. Their CMake changes merge cleanly. - **The inventory count line** in `docs/dev/debt/libwebrtc.md` is shared with most open libwebrtc PRs: #14224, #14232, #14381, #15092, #15190–#15192, #15194, #15197, #15211, #15261–#15264, #15266–#15270, #15272, #15274–#15277, #15285 and #15609. - **#14212** (debt spacing) also conflicts on that debt file. Whichever merges second recounts and rebases. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!15766
No description provided.