Skip to content

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

Closed
mkrieger95 wants to merge 390 commits into
staging/file-wrapper-v2-basefrom
feat/webrtc-file-wrapper-v2
Closed

mkrieger95 wants to merge 390 commits into
staging/file-wrapper-v2-basefrom
feat/webrtc-file-wrapper-v2

Conversation

@mkrieger95

Copy link
Copy Markdown
Owner

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 6135e61f4538611fc82aeb69dbf73f36221b1aec 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: 394 libraries, 25,378 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 conflict resolution retains the newer upstream source notes and records 381 remaining throwing exports.

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

Overlap check: tools/pr_overlap.py --branch feat/webrtc-file-wrapper-v2 --repo boykopovar/AnyPS5 scanned 1,638 open PRs and exited 2. It found no same exports or same new files among the completed comparisons, but flags shared debt inventory/count and entry-insertion edits with boykopovar#14087, boykopovar#14095, boykopovar#14116, boykopovar#14120, boykopovar#14129, boykopovar#14148 and boykopovar#14232. Older conflicting branches prevented complete automatic comparisons; boykopovar#14212 reformats debt files, and boykopovar#14224 implements RmsLevel, with no FileWrapper changes. The remaining uncomparable CMake patches contain no FileWrapper references. Shared metadata must be reconciled as those PRs land; no code dependency or merge-order agreement is claimed.

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

hugodearaujo and others added 30 commits October 31, 2026 09:25
UnlandedOwnLabel took a queued entry only when it was the caller's own and
fell back to the recorded one otherwise, so an older recorded store of the
waiting queue counted as its newest even when another queue had a newer
queued store of the dword, and an older own queued store won over a newer
recorded store of another queue. It also answered nothing unless every
awaited dword was the queue's own, so an 8-byte wait passed on memory that
the queue's pending reset of one dword was about to change.

The lookup now takes the newest tracked store of each dword, queued or
recorded, by stamp, and reports the value and the dwords whose newest store
is the queue's own and not overwritten. OwnStoreRejects composes what the
wait would read once those stores land (own dwords from the table, the rest
from memory) and keeps the wait only when that value fails the compare, so
the wait's mask and function decide as before and another queue's later
store of a dword still releases it.
…st week

The libraries badge divides implemented by declared functions, so it drops
whenever a pull request declares many throwing exports at once, even while
implementations land daily. The history page now draws the daily change in
implemented functions, and a new badge-week.svg reports the gain over the
last 7 days, linked from the README status row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A firmware 13.42 run of the module refuses a size of 0x100000010, which a
32-bit parameter would cut to 0x10 and accept.
…rkgroups

A direct mesh draw split into layers now pushes the groups per layer in the
upper half of the mesh draw's index word, and the mesh prologue numbers its
group WorkgroupId.x + WorkgroupId.z * stride. A draw in one layer pushes 0,
so its number is WorkgroupId.x whatever the device reports for the other
components, and the mesh program reads NumWorkgroups only where main did.
Layers past an X limit above 65,535 keep at most 65,535 groups so the stride
fits.
…ceNpCheckNpReachability

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… guest module

RELA entries are applied in order, and an R_X86_64_RELATIVE entry writes
relocbase + addend to its target (FreeBSD rtld's reloc_non_plt). Two
symbol-less RELATIVE entries for one target therefore leave the later
addend in place. Guest-module parsing and code analysis refused the pair
as overlapping; now the later entry replaces the earlier one.

PS5MC's sce_module/libc.prx (PPSA99420), the loader companion its build
generates, relocates 0x8058 twice: to 0x80e0, then to 0x82a0. It could
not be converted. Any other overlap, including a RELATIVE entry over a
symbol relocation, is still refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The export throws through NotImplemented_nid_no_patch, so the
parameterless declaration is import-resolution only; the closest signed
sibling takes three arguments, and what the console notifies and whether
a title calls it are unmeasured.
Rejected encodings and allocation failures now return NULL with the error
queue, the old output and the input pointer that firmware 13.42's module and
LibreSSL 4.0.0 leave.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tput

asn1_c2i in LibreSSL 4.0.0 rejects content over INT_MAX bytes before
c2i_ASN1_INTEGER_cbs runs, so the old output stays and nothing is allocated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sceKernelUnlink takes its Windows directory-link path only when
std::filesystem::symlink_status reports a directory, but MinGW's
symlink_status follows the link. A directory symbolic link whose target
is missing therefore looked like a file, went to the file delete, and
failed with EACCES, because Windows removes a directory link only
through RemoveDirectoryW. guest_filesystem stops there on any Windows
host that may create symbolic links.

The directory path is now also taken when the link itself carries both
FILE_ATTRIBUTE_DIRECTORY and FILE_ATTRIBUTE_REPARSE_POINT, which
GetFileAttributesW reports without following the link.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…quest calls as firmware 13.42 does

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
adriadam10 and others added 28 commits November 1, 2026 11:09
perf(agc): trap CPU reads of label readbacks on macOS instead of storing them
…nventory-exports-20261030

feat(rnpsbundle): add named inventory exports
…utputstatus-hdr-flags-zero

fix(videoout): report output status flags 0 with HDR output
test(libSceHttp2): cover sceHttp2SetRequestContentLength ids and deletion
…-descriptor

fix(libkernel): report a host-only descriptor as not open to fcntl and ioctl
…c-build

build(agc): compile Lifecycle, GuestMemory and GuestBufferMemory on macOS
…l-header-manifest

fix(tools): resolve linked public header manifest roots
…fill-keys

perf(agc): read DCC keys from a pending word fill instead of waiting for the GPU
…c-clear-write-order

fix(agc): order DCC clear fills against GPU writes in resident presentation
…it-in-process

test(tools): run NID audit validation cases in process
feat(relinker): validate conversions without writing outputs
…us-queries

docs(agc): list the AgcDriver capture, trace and validation queries as silent stubs
…ta-packets

test(libSceAgc): cover COPY_DATA on the draw and compute queues and the WRITE_DATA size
…dk-layouts

fix(libSceConvertKeycode): apply the SDK rules instead of throwing for layouts 31-39 and Y/Z
test(tools): reach pr_labels RecursionError with probed nesting depth
…r-cleanup

fix(hw-oracle): clean up COMGR handles on errors
feat(libSceNpCommon): implement sceNpUtilParseJid and sceNpUtilJidToNpId
feat(libSceNpCppWebApi): bring up Activities V1 offline
…ected

test(libc): bound UTF-16 length scans with protected pages
fix(build): do not build libSceAddressSanitizer in an ASan or TSan build
…nk-loop

fix(tools): report symlink loops in vulkan_validation_gate paths as setup errors
fix(libkernel): report a 64 KiB st_blksize for directories
…liased

perf(agc): trap label reads of small images inside pending large ones on macOS
…g-native-320-exports

feat(libSceVideoRecording.native): declare 27 callable exports
…on-terminator

feat(relinker): support the end-of-options separator
…ring-to-number

feat(libc): convert wide strings with _WStoull, _WStoll, _WStod, _WStof and _WStold as the console's libc does
docs(libSceRandom): name what the emulators do with a null buffer of size 0
@mkrieger95
mkrieger95 force-pushed the feat/webrtc-file-wrapper-v2 branch from df83dac to ed8d036 Compare November 1, 2026 12:11
@mkrieger95 mkrieger95 closed this Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.