Skip to content

feat(libwebrtc): implement FileWrapper output and ownership - #14246

Open
mkrieger95 wants to merge 1 commit into
boykopovar:mainfrom
mkrieger95:feat/webrtc-file-wrapper-v2
Open

mkrieger95 wants to merge 1 commit into
boykopovar:mainfrom
mkrieger95:feat/webrtc-file-wrapper-v2

Conversation

@mkrieger95

@mkrieger95 mkrieger95 commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

What

Implement four previously throwing libwebrtc exports: webrtc::FileWrapper::Close, Flush, Write(const void*, size_t) and the move constructor. Operations use the existing guest libc FileStream APIs, preserving guest stream tracking and platform handling.

Supersedes boykopovar/AnyPS5#13882.

The eight-byte object owns one stream pointer. Write reports whether all requested bytes were accepted; Flush forwards stream errors; Close clears ownership even when the close reports a write failure and succeeds when already empty. Move construction transfers ownership and empties the source without reading uninitialized destination storage.

Source evidence: compared file_wrapper.h and file_wrapper.cc at M127 with M134 header and implementation. These four methods, signatures and one-pointer layout are identical. Those versions bracket the module's inferred revision from its rtc namespace and InterleavedView exports, as investigated in boykopovar/AnyPS5#13687. This code is written against that contract; no new third-party dependency or copied source is added.

PS5 ABI and behavior have not been measured. Invalid wrappers/move objects, Flush or Write without an open stream, and nonempty writes from null data throw for upstream contract violations. These limitations are recorded in docs/dev/debt/libwebrtc.md. No title unblock is claimed.

Tested

Linux x86-64, GCC 14.2, Release, BUILD_TESTING=ON; based on upstream ba627802e2210187d417deb64c8f2fed8e33011f on 2026-11-01 UTC.

  • Built the production library and all focused test targets listed below.
  • 7/7 focused CTests pass: guest_webrtc_file_wrapper, guest_webrtc_vad, guest_webrtc_fast_int_to_buffer, guest_webrtc_time, guest_webrtc_exp_filter, guest_webrtc_rtcp_common_header, guest_webrtc_opus.
  • python3 core/libs/tests/test_public_headers.py --audit-only: 399 libraries, 26,227 exports pass.
  • python3 tools/check_conventions.py --base origin/main and git diff --check: pass.
  • Binary writes split across calls, exact byte count and read-back, zero-length writes, successful flush, close and repeated close.
  • Move into prefilled destination storage, source detachment, destination usability, closing the moved-from object without closing its transferred stream, and moving an empty object.
  • Rejected writes on read-only streams retain ownership. Linux /dev/full checks failed flush, failed implicit flush during close, and pointer clearing even when close returns false.
  • Null/closed object preconditions and nonempty null-data writes.
  • Original mutation checks (before this rebase): five deliberate mutations fail at their intended assertions: Write always reports success; Close always reports success; move leaves the source attached; Flush does nothing; Close keeps its stream pointer.
  • FileWrapper implementation, object-layout header and regression-test source are unchanged from the original head. The debt entry is inserted before the existing source-revision note, with blank lines around it; the shared derived export tally and end-of-file insertion point are no longer edited.

Not tested: Windows, a title or a PS5. No console-parity claim; no full-suite or whole-project-build claim.

Overlap check at ed8d036367a423d4131eda0488751fc3c9d56d0b: python3 tools/pr_overlap.py --branch feat/webrtc-file-wrapper-v2 --repo boykopovar/AnyPS5 scanned 1,662 open PRs against ba627802e2210187d417deb64c8f2fed8e33011f. The reported same exports/new files are this PR itself (#14246), whose remote head was still the previous revision during the scan. No other completed comparison reports conflicting lines, exports or new files. Full pairwise merge previews are clean with #14087, #14095, #14116, #14120, #14129, #14148, #14232 and #14381. This resolves the same-line debt overlaps raised in review by revising our edits, so no landing-order dependency is needed.

The helper still exits 2 because existing conflicts with main prevent complete comparisons for #5021, #7275, #8650, #9156, #9162, #9293, #9297, #9302, #9383, #12642, #13253, #13256 (shared CMake file) and #14212 (shared debt file). Each shared-file patch was inspected manually. Three-way merges of those files using this head have exactly the same conflict hunks as merges using unmodified main; this PR adds no conflict hunks. The CMake edits register unrelated targets or configure macOS linking, with no FileWrapper references; #14212 changes debt formatting/counts and its pre-existing conflict hunks do not contain our new entry.

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

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Progress report (ba62780 → ed8d036)

📈 System libraries: 26.25% (+0.01%, +4 implemented functions)

✅ 4 implemented
Library Name
libwebrtc _ZN6webrtc11FileWrapper5CloseEv_nid_postfix
libwebrtc _ZN6webrtc11FileWrapper5FlushEv_nid_postfix
libwebrtc _ZN6webrtc11FileWrapper5WriteEPKvm_nid_postfix
libwebrtc _ZN6webrtc11FileWrapperC1EOS0__nid_postfix

Changed libraries (implemented exports)

Library Before After Change
libwebrtc 27/412 (6.55%) 31/412 (7.52%) +0.97%

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — changes requested

The implementation and focused tests look coherent on source inspection, but the PR's own overlap report leaves required landing-order coordination unresolved.

What I ran

Reviewed head df83dac6c54f75d1a55ad77bdd31a65b9302576c against PR base 5d3ad2112f60f35d463dc2c9d96d1c9d35871015; the merge preview against current main 8c91f25b3924a8419096aa368ce44043a5894558 was clean. Environment: Linux x86_64, Python 3.11.2, GCC 12.2.0, Git 2.39.5. I did not build or run CTest.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14246
python3 tools/pr_abi_audit.py --base 5d3ad2112f60f35d463dc2c9d96d1c9d35871015 --head df83dac6c54f75d1a55ad77bdd31a65b9302576c
python3 tools/pr_test_quality.py --root /marc/AnyPS5 core/libs/CMakeLists.txt core/libs/prx/libwebrtc/Export.cpp core/libs/prx/libwebrtc/include/Api.hpp core/libs/prx/libwebrtc/include/FileWrapper.hpp core/libs/prx/libwebrtc/libwebrtc.hpp core/libs/prx/libwebrtc/src/FileWrapper.cpp core/libs/tests/GuestWebrtcFileWrapper.cpp docs/dev/debt/libwebrtc.md
python3 tools/pr_stack_check.py 14246 --repo boykopovar/AnyPS5
python3 tools/pr_overlap.py --branch refs/review/pr-14246 --repo boykopovar/AnyPS5 --jobs 8
gh pr view 14246 --repo boykopovar/AnyPS5 --json state,headRefOid,updatedAt,statusCheckRollup

Results

Check Result
Diff check, conventions and PR template Passed in precheck.
ABI audit Passed with warnings: the four new FileWrapper symbols each have a declaration and definition; the 60 warnings concern the existing NID-bound libwebrtcUnknown00–59 exports. This lexical check does not certify binary ABI.
Test-quality heuristic One possible-unregistered-test warning; manually confirmed GuestWebrtcFileWrapper.cpp is registered in core/libs/CMakeLists.txt. The heuristic is a false positive here.
Merge preview Clean against current main 8c91f25b3924a8419096aa368ce44043a5894558.
Hosted CI Eligibility, conventions, portability, intake, labels and report passed; Windows was in progress. Linux and specialized jobs were skipped.
Author-reported tests The description reports a Linux Release build, seven focused CTests passing, and mutation checks from before the rebase. I did not independently run them; the mutation checks are explicitly from before the rebase.
Local build and CTest Not run.
Open-PR overlap check The local helper could not complete because it failed parsing the GitHub response. The PR description's own scan reports shared CMake/debt metadata edits with open #14087, #14095, #14116, #14120, #14129, #14148 and #14232, while stating that no order agreement is claimed. I verified those PRs remain open.
Raw output excerpts

Precheck conventions output:

All conventions checks passed.

ABI audit summary:

ABI audit: passed_with_warnings

Test-quality heuristic output for the changed C++ test:

core/libs/tests/GuestWebrtcFileWrapper.cpp:1: possible-unregistered-cpp-test: Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage.
Heuristic findings require manual interpretation.

Overlap-helper error:

pr_overlap: Invalid \\uXXXX escape: line 1 column 1193051 (char 1193050)

Findings

Blocking

The PR's description says its overlap scan found shared CMake/debt metadata edits with open PRs #14087, #14095, #14116, #14120, #14129, #14148 and #14232, and explicitly says no landing-order agreement is claimed. CONTRIBUTING.md requires the authors of PRs that change the same lines to agree which lands first and declare that order with Depends on. The checklist currently says Depends on: none. Please coordinate the order with the affected authors and update the checklist (or revise the changes so the overlap no longer applies).

Non-blocking

No source-level defect was established in this pass. The test-registration heuristic warning is resolved by the registration visible in the changed CMake file.

Sources

Not verified

I did not build or run the focused CTests or the negative controls. The reported focused tests are author-provided, and the mutation checks predate this rebase. Hosted Windows was still running; Linux and specialized jobs were skipped. No PS5 or title behavior was tested.

To get this to a good state

Agree and record the landing order for the reported open overlaps, then update Depends on and rerun the overlap check. I will recheck the exact new head and rerun the applicable no-build checks.

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5021 core/libs/CMakeLists.txt
PR 7275 core/libs/CMakeLists.txt
PR 8650 core/libs/CMakeLists.txt
PR 9019 core/libs/CMakeLists.txt
PR 9156 core/libs/CMakeLists.txt
PR 9162 core/libs/CMakeLists.txt
PR 9293 core/libs/CMakeLists.txt
PR 9297 core/libs/CMakeLists.txt
PR 9302 core/libs/CMakeLists.txt
PR 9383 core/libs/CMakeLists.txt
PR 9536 core/libs/CMakeLists.txt
PR 9571 core/libs/CMakeLists.txt
PR 12130 core/libs/CMakeLists.txt
PR 12642 core/libs/CMakeLists.txt
PR 13253 core/libs/CMakeLists.txt
PR 13255 core/libs/CMakeLists.txt
PR 13256 core/libs/CMakeLists.txt
PR 14212 docs/dev/debt/libwebrtc.md
PR 14213 core/libs/CMakeLists.txt
PR 14264 core/libs/CMakeLists.txt
PR 14299 core/libs/CMakeLists.txt

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants