feat(libwebrtc): implement webrtc::VideoDecoder::GetDecoderInfo #17707

Merged
LeandroLP23 merged 1 commit from upstream-pr/17707 into main 2026-11-13 10:18:21 +00:00
LeandroLP23 commented 2026-11-09 11:15:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-11-09T11:15:36Z.


What

Implements webrtc::VideoDecoder::GetDecoderInfo in libwebrtc, adapted from video_decoder.cc. The WebRTC notice and BSD licence head the file. It is the default a title's VideoDecoder subclass gets when it does not override GetDecoderInfo.

Same code at both bounding revisions.

  • GetDecoderInfo is identical at M127 (e0b28a6a81) and M134 (8d78f5de6c).
  • The virtual order of video_decoder.h is the same at both; the headers differ in absl::optional versus std::optional, includes and a commented-out parameter name.
  • The vtable is the two destructor entries, then Configure, the two Decode overloads, RegisterDecodeCompleteCallback, Release, GetDecoderInfo and ImplementationName. That puts ImplementationName at slot 8.

Result. DecoderInfo holds a std::string, so it is returned through hidden storage. The storage is 48 bytes: the guest std::string (WebRtcGuestString) at 0 and is_hardware_accelerated at 40.

What the export does. It fills that storage with the name ImplementationName returns and false, which is what upstream's default-constructed DecoderInfo followed by implementation_name = ImplementationName() leaves.

The guest string follows the repository's libc string rules, not a reading of the console's libwebrtc.sprx.

  • The leading word is 0, as FillMessage and the other string builders in libc leave it.
  • Up to 15 characters stay inline. A longer name gets capacity length | 15 through GuestStringStorage, including its large-allocation rule.
  • For a string that starts empty, length | 15 is also what Dinkumware's geometric growth gives, because 15 + 15 / 2 is never larger.
  • The debt entry records the rule as unverified.

Null cases. A null result, decoder, vtable, ImplementationName slot or name throws. Upstream would crash on the null name in strlen.

Tested

Windows 11, MinGW GCC Release build. guest_webrtc_video_decoder is new; guest_webrtc_video_encoder and guest_webrtc_rtc_error still pass. The new test covers:

  • inline names of 0, 7 and 15 characters;
  • a 16-character name on the heap with capacity 31;
  • a 5,000-character name through the 32-byte-aligned large allocation, with the raw pointer stored before it;
  • both heap names freeing correctly through GuestStringStorage::Deallocate;
  • every invalid case, leaving the result untouched.

Negative controls: using slot 7, or dropping the | 15 mask, both fail the test.

tools/check_conventions.py --base origin/main passes. tools/pr_overlap.py --branch merged all 23 overlapping pull requests cleanly.

  • It also listed #17698 under same exports, for TestAllocate and the other heap callbacks. Those are anonymous-namespace helpers in separate test executables, not exports.
  • It could not compare #14212, #15189 and #17691, which already conflict with main; none touches VideoDecoder.
  • The branch merges cleanly with #17698, #17703 and #17704.

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 (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5222973457 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17707). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-11-09T11:15:36Z. --- ### What Implements `webrtc::VideoDecoder::GetDecoderInfo` in libwebrtc, adapted from [video_decoder.cc](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100/api/video_codecs/video_decoder.cc). The WebRTC notice and BSD licence head the file. It is the default a title's `VideoDecoder` subclass gets when it does not override `GetDecoderInfo`. **Same code at both bounding revisions.** - `GetDecoderInfo` is identical at M127 ([e0b28a6a81](https://webrtc.googlesource.com/src/+/e0b28a6a81a989c1f5c89e30fcd247870047390d)) and M134 ([8d78f5de6c](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100)). - The virtual order of `video_decoder.h` is the same at both; the headers differ in `absl::optional` versus `std::optional`, includes and a commented-out parameter name. - The vtable is the two destructor entries, then `Configure`, the two `Decode` overloads, `RegisterDecodeCompleteCallback`, `Release`, `GetDecoderInfo` and `ImplementationName`. That puts `ImplementationName` at slot 8. **Result.** `DecoderInfo` holds a `std::string`, so it is returned through hidden storage. The storage is 48 bytes: the guest `std::string` (`WebRtcGuestString`) at 0 and `is_hardware_accelerated` at 40. **What the export does.** It fills that storage with the name `ImplementationName` returns and `false`, which is what upstream's default-constructed `DecoderInfo` followed by `implementation_name = ImplementationName()` leaves. **The guest string follows the repository's `libc` string rules, not a reading of the console's `libwebrtc.sprx`.** - The leading word is 0, as `FillMessage` and the other string builders in `libc` leave it. - Up to 15 characters stay inline. A longer name gets capacity `length | 15` through `GuestStringStorage`, including its large-allocation rule. - For a string that starts empty, `length | 15` is also what Dinkumware's geometric growth gives, because `15 + 15 / 2` is never larger. - The debt entry records the rule as unverified. **Null cases.** A null result, decoder, vtable, `ImplementationName` slot or name throws. Upstream would crash on the null name in `strlen`. ### Tested Windows 11, MinGW GCC Release build. `guest_webrtc_video_decoder` is new; `guest_webrtc_video_encoder` and `guest_webrtc_rtc_error` still pass. The new test covers: - inline names of 0, 7 and 15 characters; - a 16-character name on the heap with capacity 31; - a 5,000-character name through the 32-byte-aligned large allocation, with the raw pointer stored before it; - both heap names freeing correctly through `GuestStringStorage::Deallocate`; - every invalid case, leaving the result untouched. Negative controls: using slot 7, or dropping the `| 15` mask, both fail the test. `tools/check_conventions.py --base origin/main` passes. `tools/pr_overlap.py --branch` merged all 23 overlapping pull requests cleanly. - It also listed #17698 under same exports, for `TestAllocate` and the other heap callbacks. Those are anonymous-namespace helpers in separate test executables, not exports. - It could not compare #14212, #15189 and #17691, which already conflict with `main`; none touches `VideoDecoder`. - The branch merges cleanly with #17698, #17703 and #17704. ### 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 (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!17707
No description provided.