feat(libwebrtc): implement rtc::SentPacket constructors #16850

Merged
AlexWhitehouse merged 1 commit from upstream-pr/16850 into main 2026-11-11 14:25:48 +00:00
AlexWhitehouse commented 2026-11-07 18:15:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by AlexWhitehouse on 2026-11-07T18:15:57Z.


What

The two libwebrtc rtc::SentPacket constructors threw ..._nid_postfix not implemented:

  • _ZN3rtc10SentPacketC1Ell (NID i+gAZMGguUo): SentPacket(int64_t packet_id, int64_t send_time_ms);
  • _ZN3rtc10SentPacketC1EllRKNS_10PacketInfoE (NID LzIWcjdQauo): the same, plus const rtc::PacketInfo&.

This PR implements them from sent_packet.cc and sent_packet.h at M134 (8d78f5de), the revision the other libwebrtc ports cite. The .cc is identical at M127 (e0b28a6a). The new SentPacket.cpp starts with that file's notice.

  • Layout, checked by compiling probes against both milestones' headers and pinned by static_asserts in SentPacket.hpp:
    • PacketInfo is 40 bytes. Three flags sit at 0, 1 and 2, the 4-byte packet type and protocol enums at 4 and 8, optional<uint16_t> network_id at 12 (the value, then the engaged flag), and the three size_t sizes at 16, 24 and 32.
    • SentPacket is 56 bytes: packet_id at 0, send_time_ms at 8 and info at 16. Neither has a vptr.
  • First constructor: stores the IDs and default-initialises info as the header's member initialisers do: false flags, kUnknown enums, no network id and zero sizes.
  • Second constructor: copies the PacketInfo, the network id included when it is engaged.
  • Untouched bytes: padding and the payload of a disengaged optional are left alone, and the tests don't prescribe them.
  • Null pointers: a null object or source pointer throws, because upstream would dereference it.
  • Revision difference: M134 adds is_media at offset 2, which is padding in M127. This PR follows M134. The new debt entry records that the console's revision is unknown.

The libwebrtc unknown-export count drops from 263 to 261.

Tested

  • New tests: guest_webrtc_sent_packet_default and guest_webrtc_sent_packet_copy.
    • Both constructors are called on 0xA5-filled objects, with every pair from {0, −1, 1234567890123, INT64_MIN, INT64_MAX} as the IDs.
    • They read back every member.
    • The copy test runs all 16 combinations of the three flags and the engaged network id, with distinctive enums and sizes.
    • Both tests cover the null-pointer throws.
  • Linux x86-64 (Ubuntu 26.04, GCC 15, Release):
    • on main, both fail with _ZN3rtc10SentPacketC1Ell_nid_postfix not implemented and _ZN3rtc10SentPacketC1EllRKNS_10PacketInfoE_nid_postfix not implemented;
    • with this PR, both pass, and public_headers passes.
    • after rebasing onto main at dd4da52a88 (with #15609), all 49 libwebrtc tests and public_headers pass at 2da3bf29e5.
  • Windows 11: (build 26300, WinLibs MinGW-w64 GCC 15.2.0 UCRT, Release): all 37 libwebrtc tests pass at 87ca81cccf, the two new ones included, with no compiler warnings in the changed files.
  • Mutation check: swapping packet_id and send_time_ms fails both tests.
  • python3 tools/check_conventions.py --base origin/main: all checks passed.
  • python3 tools/pr_overlap.py --branch feat/libwebrtc-sent-packet: no open PR implements SentPacket. Its comparison failed closed, because several libwebrtc PRs conflict with main, so I read their diffs by hand.
    • The following implement other exports in the same Export.cpp, Api.hpp, CMakeLists.txt and debt file: #15189, #15197, #15262-#15265, #15270, #15271, #15274-#15277 and #15609, plus my #16381 (RateTracker), #16485 (CopyOnWriteBuffer) and #15766 (VideoFrame).
    • Those touching the libwebrtc count line conflict there textually, and whichever merges second recounts.
    • #14212 only reformats debt entries.

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:5204541974 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16850). Originally posted by [AlexWhitehouse](https://github.com/AlexWhitehouse) on 2026-11-07T18:15:57Z. --- ### What The two libwebrtc `rtc::SentPacket` constructors threw `..._nid_postfix not implemented`: - `_ZN3rtc10SentPacketC1Ell` (NID `i+gAZMGguUo`): `SentPacket(int64_t packet_id, int64_t send_time_ms)`; - `_ZN3rtc10SentPacketC1EllRKNS_10PacketInfoE` (NID `LzIWcjdQauo`): the same, plus `const rtc::PacketInfo&`. This PR implements them from [`sent_packet.cc`](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100/rtc_base/network/sent_packet.cc) and [`sent_packet.h`](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100/rtc_base/network/sent_packet.h) at M134 (8d78f5de), the revision the other libwebrtc ports cite. The `.cc` is identical at M127 (e0b28a6a). The new `SentPacket.cpp` starts with that file's notice. - **Layout,** checked by compiling probes against both milestones' headers and pinned by `static_assert`s in `SentPacket.hpp`: - `PacketInfo` is 40 bytes. Three flags sit at 0, 1 and 2, the 4-byte packet type and protocol enums at 4 and 8, `optional<uint16_t> network_id` at 12 (the value, then the engaged flag), and the three `size_t` sizes at 16, 24 and 32. - `SentPacket` is 56 bytes: `packet_id` at 0, `send_time_ms` at 8 and `info` at 16. Neither has a vptr. - **First constructor:** stores the IDs and default-initialises `info` as the header's member initialisers do: false flags, `kUnknown` enums, no network id and zero sizes. - **Second constructor:** copies the `PacketInfo`, the network id included when it is engaged. - **Untouched bytes:** padding and the payload of a disengaged optional are left alone, and the tests don't prescribe them. - **Null pointers:** a null object or source pointer throws, because upstream would dereference it. - **Revision difference:** M134 adds `is_media` at offset 2, which is padding in M127. This PR follows M134. The new debt entry records that the console's revision is unknown. The libwebrtc unknown-export count drops from 263 to 261. ### Tested - **New tests:** `guest_webrtc_sent_packet_default` and `guest_webrtc_sent_packet_copy`. - Both constructors are called on 0xA5-filled objects, with every pair from {0, −1, 1234567890123, INT64_MIN, INT64_MAX} as the IDs. - They read back every member. - The copy test runs all 16 combinations of the three flags and the engaged network id, with distinctive enums and sizes. - Both tests cover the null-pointer throws. - **Linux x86-64** (Ubuntu 26.04, GCC 15, Release): - on `main`, both fail with `_ZN3rtc10SentPacketC1Ell_nid_postfix not implemented` and `_ZN3rtc10SentPacketC1EllRKNS_10PacketInfoE_nid_postfix not implemented`; - with this PR, both pass, and `public_headers` passes. - after rebasing onto `main` at dd4da52a88 (with #15609), all 49 libwebrtc tests and `public_headers` pass at 2da3bf29e5. - **Windows 11:** (build 26300, WinLibs MinGW-w64 GCC 15.2.0 UCRT, Release): all 37 libwebrtc tests pass at 87ca81cccf, the two new ones included, with no compiler warnings in the changed files. - **Mutation check:** swapping `packet_id` and `send_time_ms` fails both tests. - `python3 tools/check_conventions.py --base origin/main`: all checks passed. - **`python3 tools/pr_overlap.py --branch feat/libwebrtc-sent-packet`:** no open PR implements `SentPacket`. Its comparison failed closed, because several libwebrtc PRs conflict with `main`, so I read their diffs by hand. - The following implement other exports in the same `Export.cpp`, `Api.hpp`, `CMakeLists.txt` and debt file: #15189, #15197, #15262-#15265, #15270, #15271, #15274-#15277 and #15609, plus my #16381 (RateTracker), #16485 (CopyOnWriteBuffer) and #15766 (VideoFrame). - Those touching the libwebrtc count line conflict there textually, and whichever merges second recounts. - #14212 only reformats debt entries. ### 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)
gabichuuuuu commented 2026-11-07 22:13:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-07T22:13:32Z.

Review: COMMENTED


Read 9508cc4b9b against main.

Both constructors match sent_packet.cc and sent_packet.h at 8d78f5de: member order and defaults, the 40-byte PacketInfo and 56-byte SentPacket offsets with libc++'s std::optional<uint16_t> (value at 12, engaged flag at 14), the (long, long) and (long, long, const PacketInfo&) mangled names, and copying network_id only when it's engaged. The only M127 differences are absl::optional and is_media, which is padding at offset 2 there, so writing it is harmless; the debt entry records this. The new tests can't build on main, where WebRtcSentPacket doesn't exist.

Count line. 296 to 294 matches main (296 NotImplemented_nid_no_patch stubs in libwebrtc/Export.cpp at 87473937d3), but #16893 changes the same line to 294 too, so whichever merges second should say 292.

Not run here; this is from reading the code.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5815240609 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16850#pullrequestreview-5815240609). Originally posted by [gabichuuuuu](https://github.com/gabichuuuuu) on 2026-11-07T22:13:32Z. **Review:** COMMENTED --- Read `9508cc4b9b` against `main`. Both constructors match `sent_packet.cc` and `sent_packet.h` at `8d78f5de`: member order and defaults, the 40-byte `PacketInfo` and 56-byte `SentPacket` offsets with libc++'s `std::optional<uint16_t>` (value at 12, engaged flag at 14), the `(long, long)` and `(long, long, const PacketInfo&)` mangled names, and copying `network_id` only when it's engaged. The only M127 differences are `absl::optional` and `is_media`, which is padding at offset 2 there, so writing it is harmless; the debt entry records this. The new tests can't build on `main`, where `WebRtcSentPacket` doesn't exist. **Count line.** 296 to 294 matches `main` (296 `NotImplemented_nid_no_patch` stubs in `libwebrtc/Export.cpp` at `87473937d3`), but #16893 changes the same line to 294 too, so whichever merges second should say 292. Not run here; this is from reading the code. AI-assisted: yes.
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!16850
No description provided.