feat(libSceAvPlayer): read progressive media over HTTP #10957

Merged
AZLisme merged 8 commits from upstream-pr/10957 into main 2026-11-02 07:54:54 +00:00
AZLisme commented 2026-10-25 11:21:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by AZLisme on 2026-10-25T11:21:10Z.


What

Add progressive HTTP media support to AvPlayer through a reusable libSceHttp client, as requested by the maintainer. Both libSceAvPlayer variants dynamically link the shared provider. Eight canonical extern "C" / APS5_VABI helpers use _nid_postfix names so the real NID patcher can patch imports from our libraries. The provider owns handle allocation and destruction; its implementation stays private.

AvPlayer keeps the FFmpeg AVIO adapter and catches both read and seek exceptions before returning through FFmpeg. The shared client preserves redirects, range and framing checks, representation validators, caching, independent handles, reopen and start/stop behavior. Existing Sony sceHttp* request/context APIs remain unchanged. No third-party code is added.

Debt records the remaining plaintext-HTTP, eager initial-response buffering, blocking DNS and console-equivalence limits.

The Windows build follow-up b27b2a83311db49b72e9ffaa9d1b0360c5f16711 adds a MinGW-only native-unwind compile option to the host-only module ownership probe. Production sources, the eight helper signatures, provider/adapter behavior and fixture assertions are unchanged; no guest-runtime unwind setting is changed.

Follow-up dbdc41e773010bc23ad743e793731149d3c71a50 gives the six existing private ForTest_nid_no_patch host helpers canonical C linkage. Their actual exported names now end in _nid_no_patch, so normal provider patching and the fixture’s preserved imports agree. This is a general linkage correction, with no per-name patcher exception. Namespace call sites, production function bodies, fixture assertions and the eight canonical HTTP helper signatures remain unchanged.

Tested

2026-11-01: maintainer head 02049a75d21b retains this topic and merges cleanly with fixed main 26fa1212b82f. Windows CI compiled/linked the HTTP/AvPlayer providers and fixtures, then exceeded its 45-minute job limit while building guest tests. CTest never ran. Earlier runtime results retain their original inputs; a collaborator CI rerun and re-review are required before merge.

Current-head upstream Windows job 122459254778, run 40580762434 attempt 1, succeeds for dbdc41e773010bc23ad743e793731149d3c71a50 merged onto main 4a6005955ff169db8d66fc43ede7ac0cc426ee4a. It links 27 selected host test targets, including avplayer_http_patched_modules_tests.exe; HTTP/AvPlayer libraries also compile, link and patch as dependencies. The full build, explicit library build, CTest and skip-validator steps were skipped. This automatic job supplies build/link evidence, with no runtime-test result.

Corrected source, qualified Linux composition: private product c13e5db7a961eb29d313ff88591cecd09101bbde on frozen main e0cd1259a95e6dfaf97f8f73e74410bbc5d8d199 contains the nine owned topics, still-open #9448, this private HTTP fix and the exact proposed #11985 fixture projection. The paired control b4506efc625689282c290ac3dc53c8805d52edce is main plus that same fixture projection, not bare main. These are private QA sources, not actual prerequisite merges or standalone dbdc validation.

The normal-root Linux Release lane passes 76 selected CTests: 10 HTTP/AvPlayer, 65 public-header checks and one projected debt-fixture test, with zero failures or skips. Seven objects recompiled and three outputs relinked; 392 unchanged QA objects were qualified for reuse. Actual normal/native providers, before and after real NID patching, export all six plain helper names; normal and patched player executables import those same names. The patched HTTP path passes all 16 owner bindings, client body checks and regular player network/decode. The repository-pinned prebuilt FFmpeg package remains outside any new source-build or instrumentation claim. This Linux ELF proof does not identify the old Windows loader’s first missing import or establish a native Windows fix.

Native Windows, corrected controlled compositions: run 40566638846, attempt 1 uses harness 57804c82f6ea and frozen source inputs. Union job 122409555324 tested product c13e5db7a961, containing the exact dbdc41e77301 correction. The full normal build, patched libraries, source-before/after checks, full CTest, expected-skip validator and final job gate passed. Full CTest: 1,853 passed, zero failures, 832 expected skips (2,685 cases). All 112 required focused tests passed without skips, comprising 47 functional tests and 65 public-header checks. All ten HTTP/AvPlayer tests passed. The patched-module fixture verified all 16 HTTP provider-owner bindings, both AvPlayer consumers, the patched client body and regular patched player HTTP/decode behavior; the prior player launch failure is resolved in this composition.

Control job 122409556161 tested b4506efc6256, frozen main plus the exact proposed #11985 test-fixture change: 1,837 passed, zero failures, 832 expected skips (2,669 cases), including all 65 header checks. This is a fixture-applied control, not bare main. All 2,669 common case outcomes agree; the union's sixteen additional cases pass. Compared with the prior failed run, test names and expected-skip names are unchanged; the shared debt-fixture failure passes in both cases and the patched HTTP failure passes in the union. Artifact ZIP digests and sealed evidence manifests were verified. These results establish the controlled compositions above, without claiming standalone PR/current-main execution, actual prerequisite merges, console validation or a new ASan run.

Earlier Windows QA found a failing patched-player regression. Run 40549933171, attempt 1, union job 122350610019, tested the private composition 54c6a452cc948273a9de6d9d9a12089547672c6b on main e0cd1259a95e6dfaf97f8f73e74410bbc5d8d199, containing this exact b27b2a83311d head, still-open #9448 and the other eight owned topics (frozen inputs). This is composition-specific evidence.

Normal build, patched libraries, source verification and all 65 public-header tests passed. HTTP coverage passed 9/10: avplayer_http_patched_modules verified all 16 provider-owner rows and the patched client, then its patched player exited 0xc0000139. The full suite reported 1,851 passes, two failures and 832 expected skips; skip validation passed. The second failure, conventions_debt_length, also failed on the main baseline and is addressed by open #11985.

Captured PE exports and source rules show six private C++ test-helper names being renamed to NIDs while the executable's imports are preserved. The exact first failing executable import was not captured. The C-linkage correction above passes the controlled Linux and native Windows validation described above. The failed run remains historical evidence, with its original source and scope preserved.

Windows run 40485913793, attempt 1, job 122127573914, tested 3043f029726e with main 3fea2a937ba9fbab2f06c51691fe0c5763659aa3 and failed while linking the host module probe with unresolved __gxx_personality_v0. CTest did not run in that Windows job. The three-line MinGW override above selects the host compiler's native unwinding for this pure-host executable. Windows run 40491012301, attempt 1 passes configure, registration and all selected host-only compile/link targets for b27b2a83311d on the same main 3fea2a937ba9 and WinLibs GCC 15.2 toolchain. The previously failing module probe compiles and links successfully. CTest was skipped, so this verifies the link fix without adding Windows runtime or header-test results.

For b27b2a83311d, normal-root Linux reconfiguration and registration checks passed; the selected target build had no work. Selected compile/link commands, the complete compile database, 234 objects, 435 compiler inputs, 671 system/generated inputs and 22 artifacts match the qualified 3043 build. One current avplayer_http_patched_modules CTest passed without skips or failures, including 16 provider-owner bindings and real NID-patched client and regular AvPlayer HTTP decode. The earlier Release/header and ASan suites below were not rerun; their execution remains on 3043, with the Linux-inactive build change and explicit equivalence checks recorded separately.

Linux, source 3043f029726e on base aebeaa53f54d, normal-root GCC 16.2.1 / CMake 4.4.4 builds: all 10 focused Release tests and all 65 public-header checks passed with zero failures or skips. All 10 focused ASan tests also passed with leak detection enabled. Changed backend/header consumers were rebuilt; retained objects were checked against unchanged compiler inputs. The repository-pinned FFmpeg package is prebuilt and is outside the ASan instrumentation claim.

Tests exercise payloads, fixed/chunked/close framing, ranges, cache and seek behavior, validators, reopen, handle isolation and synchronized cancellation during open/read. The module fixture stages six normally built modules and applies the normal export-list/NID-patcher commands. Both AvPlayer variants import all eight helpers from the HTTP provider; both provider-ownership checks pass. Patched direct-client and regular AvPlayer loopback/decode scenarios pass. Coverage is the selected six-module closure.

Earlier maintainer Linux/Windows CI applies to fd13526ec6a6 with main 0a570f617d85; it remains historical. The controlled native Windows validation above passes; applicable full maintainer CI and re-review remain pending. Manual overlap review found independent AvPlayer changes in #1601/#7412/#7622 and guest HTTP transport work in #9834/#11134; preserve their distinct CMake/debt changes if they land first.

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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5004247101 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10957). Originally posted by [AZLisme](https://github.com/AZLisme) on 2026-10-25T11:21:10Z. --- ### What Add progressive HTTP media support to AvPlayer through a reusable `libSceHttp` client, as [requested by the maintainer](https://github.com/boykopovar/AnyPS5/pull/10957#issuecomment-6436836129). Both `libSceAvPlayer` variants dynamically link the shared provider. Eight canonical `extern "C"` / `APS5_VABI` helpers use `_nid_postfix` names so the real NID patcher can patch imports from our libraries. The provider owns handle allocation and destruction; its implementation stays private. AvPlayer keeps the FFmpeg AVIO adapter and catches both read and seek exceptions before returning through FFmpeg. The shared client preserves redirects, range and framing checks, representation validators, caching, independent handles, reopen and start/stop behavior. Existing Sony `sceHttp*` request/context APIs remain unchanged. No third-party code is added. Debt records the remaining plaintext-HTTP, eager initial-response buffering, blocking DNS and console-equivalence limits. The Windows build follow-up `b27b2a83311db49b72e9ffaa9d1b0360c5f16711` adds a MinGW-only native-unwind compile option to the host-only module ownership probe. Production sources, the eight helper signatures, provider/adapter behavior and fixture assertions are unchanged; no guest-runtime unwind setting is changed. Follow-up `dbdc41e773010bc23ad743e793731149d3c71a50` gives the six existing private `ForTest_nid_no_patch` host helpers canonical C linkage. Their actual exported names now end in `_nid_no_patch`, so normal provider patching and the fixture’s preserved imports agree. This is a general linkage correction, with no per-name patcher exception. Namespace call sites, production function bodies, fixture assertions and the eight canonical HTTP helper signatures remain unchanged. ### Tested 2026-11-01: maintainer head `02049a75d21b` retains this topic and merges cleanly with fixed main `26fa1212b82f`. [Windows CI](https://github.com/boykopovar/AnyPS5/actions/runs/41291698419/job/124804981538) compiled/linked the HTTP/AvPlayer providers and fixtures, then exceeded its 45-minute job limit while building guest tests. CTest never ran. Earlier runtime results retain their original inputs; a collaborator CI rerun and re-review are required before merge. [Current-head upstream Windows job 122459254778](https://github.com/boykopovar/AnyPS5/actions/runs/40580762434/job/122459254778), run `40580762434` attempt 1, succeeds for `dbdc41e773010bc23ad743e793731149d3c71a50` merged onto main `4a6005955ff169db8d66fc43ede7ac0cc426ee4a`. It links 27 selected host test targets, including `avplayer_http_patched_modules_tests.exe`; HTTP/AvPlayer libraries also compile, link and patch as dependencies. The full build, explicit library build, CTest and skip-validator steps were skipped. This automatic job supplies build/link evidence, with no runtime-test result. **Corrected source, qualified Linux composition:** private product `c13e5db7a961eb29d313ff88591cecd09101bbde` on frozen main `e0cd1259a95e6dfaf97f8f73e74410bbc5d8d199` contains the nine owned topics, still-open #9448, this private HTTP fix and the exact proposed #11985 fixture projection. The paired control `b4506efc625689282c290ac3dc53c8805d52edce` is main plus that same fixture projection, **not bare main**. These are private QA sources, not actual prerequisite merges or standalone `dbdc` validation. The normal-root Linux Release lane passes **76 selected CTests: 10 HTTP/AvPlayer, 65 public-header checks and one projected debt-fixture test**, with zero failures or skips. Seven objects recompiled and three outputs relinked; 392 unchanged QA objects were qualified for reuse. Actual normal/native providers, before and after real NID patching, export all six plain helper names; normal and patched player executables import those same names. The patched HTTP path passes all 16 owner bindings, client body checks and regular player network/decode. The repository-pinned prebuilt FFmpeg package remains outside any new source-build or instrumentation claim. This Linux ELF proof does not identify the old Windows loader’s first missing import or establish a native Windows fix. **Native Windows, corrected controlled compositions:** [run 40566638846, attempt 1](https://github.com/AZLisme/AnyPS5/actions/runs/40566638846) uses harness `57804c82f6ea` and [frozen source inputs](https://github.com/AZLisme/AnyPS5/blob/57804c82f6eac5a26fddce23575214a7b9fbcc5e/.github/qa/current-library-frozen-inputs.json). Union job `122409555324` tested product `c13e5db7a961`, containing the exact `dbdc41e77301` correction. The full normal build, patched libraries, source-before/after checks, full CTest, expected-skip validator and final job gate passed. Full CTest: **1,853 passed, zero failures, 832 expected skips** (2,685 cases). All 112 required focused tests passed without skips, comprising 47 functional tests and 65 public-header checks. All ten HTTP/AvPlayer tests passed. The patched-module fixture verified all 16 HTTP provider-owner bindings, both AvPlayer consumers, the patched client body and regular patched player HTTP/decode behavior; the prior player launch failure is resolved in this composition. Control job `122409556161` tested `b4506efc6256`, frozen main plus the exact proposed #11985 test-fixture change: **1,837 passed, zero failures, 832 expected skips** (2,669 cases), including all 65 header checks. This is a fixture-applied control, not bare main. All 2,669 common case outcomes agree; the union's sixteen additional cases pass. Compared with the prior failed run, test names and expected-skip names are unchanged; the shared debt-fixture failure passes in both cases and the patched HTTP failure passes in the union. Artifact ZIP digests and sealed evidence manifests were verified. These results establish the controlled compositions above, without claiming standalone PR/current-main execution, actual prerequisite merges, console validation or a new ASan run. Earlier Windows QA found a failing patched-player regression. [Run 40549933171, attempt 1](https://github.com/AZLisme/AnyPS5/actions/runs/40549933171), union job `122350610019`, tested the private composition `54c6a452cc948273a9de6d9d9a12089547672c6b` on main `e0cd1259a95e6dfaf97f8f73e74410bbc5d8d199`, containing this exact `b27b2a83311d` head, still-open #9448 and the other eight owned topics ([frozen inputs](https://github.com/AZLisme/AnyPS5/blob/e84a07ef45a412964217efd2c561164b99c6d974/.github/qa/current-library-frozen-inputs.json)). This is composition-specific evidence. Normal build, patched libraries, source verification and all 65 public-header tests passed. HTTP coverage passed 9/10: `avplayer_http_patched_modules` verified all 16 provider-owner rows and the patched client, then its patched player exited `0xc0000139`. The full suite reported 1,851 passes, two failures and 832 expected skips; skip validation passed. The second failure, `conventions_debt_length`, also failed on the main baseline and is addressed by open #11985. Captured PE exports and source rules show six private C++ test-helper names being renamed to NIDs while the executable's imports are preserved. The exact first failing executable import was not captured. The C-linkage correction above passes the controlled Linux and native Windows validation described above. The failed run remains historical evidence, with its original source and scope preserved. [Windows run 40485913793, attempt 1](https://github.com/boykopovar/AnyPS5/actions/runs/40485913793), job `122127573914`, tested `3043f029726e` with main `3fea2a937ba9fbab2f06c51691fe0c5763659aa3` and failed while linking the host module probe with unresolved `__gxx_personality_v0`. CTest did not run in that Windows job. The three-line MinGW override above selects the host compiler's native unwinding for this pure-host executable. [Windows run 40491012301, attempt 1](https://github.com/boykopovar/AnyPS5/actions/runs/40491012301/job/122144698466) passes configure, registration and all selected host-only compile/link targets for `b27b2a83311d` on the same main `3fea2a937ba9` and WinLibs GCC 15.2 toolchain. The previously failing module probe compiles and links successfully. CTest was skipped, so this verifies the link fix without adding Windows runtime or header-test results. For `b27b2a83311d`, normal-root Linux reconfiguration and registration checks passed; the selected target build had no work. Selected compile/link commands, the complete compile database, 234 objects, 435 compiler inputs, 671 system/generated inputs and 22 artifacts match the qualified `3043` build. One current `avplayer_http_patched_modules` CTest passed without skips or failures, including 16 provider-owner bindings and real NID-patched client and regular AvPlayer HTTP decode. The earlier Release/header and ASan suites below were not rerun; their execution remains on `3043`, with the Linux-inactive build change and explicit equivalence checks recorded separately. Linux, source `3043f029726e` on base `aebeaa53f54d`, normal-root GCC 16.2.1 / CMake 4.4.4 builds: all 10 focused Release tests and all 65 public-header checks passed with zero failures or skips. All 10 focused ASan tests also passed with leak detection enabled. Changed backend/header consumers were rebuilt; retained objects were checked against unchanged compiler inputs. The repository-pinned FFmpeg package is prebuilt and is outside the ASan instrumentation claim. Tests exercise payloads, fixed/chunked/close framing, ranges, cache and seek behavior, validators, reopen, handle isolation and synchronized cancellation during open/read. The module fixture stages six normally built modules and applies the normal export-list/NID-patcher commands. Both AvPlayer variants import all eight helpers from the HTTP provider; both provider-ownership checks pass. Patched direct-client and regular AvPlayer loopback/decode scenarios pass. Coverage is the selected six-module closure. Earlier [maintainer Linux/Windows CI](https://github.com/boykopovar/AnyPS5/actions/runs/40452627814) applies to `fd13526ec6a6` with main `0a570f617d85`; it remains historical. The controlled native Windows validation above passes; applicable full maintainer CI and re-review remain pending. Manual overlap review found independent AvPlayer changes in #1601/#7412/#7622 and guest HTTP transport work in #9834/#11134; preserve their distinct CMake/debt changes if they land first. <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> ### 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: <!-- #PR, or none --> none - [x] Fixes: <!-- issue it closes as Fixes #N, or none --> none - [x] Unblocks: <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> none - [x] GPUs tested: <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> n/a - [x] AI-assisted: <!-- yes / no --> yes
MarcZX10 commented 2026-10-25 12:08:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T12:08:27Z.

Review: COMMENTED


Reviewed exact head d4a68788b98c1bb6a734e655d51adc8cb5c5cff0. I traced request framing, range and ignored-range handling, content-range validation, validators, redirects, chunk decoding, cache offsets, AVIO seek/read and stop propagation. The 200 response path correctly keeps cacheStart = 0 and validates the full representation length before serving bytes requested from a nonzero offset; the 206 path requires exact requested start and body/range-length agreement. The new tests cover both cases plus chunking, redirects, cancellation/restart and callback priority. Local git diff --check and python3 tools/check_conventions.py --base upstream/main --head refs/review/10957 passed. Hosted eligibility, intake, conventions, labels and report checks pass; product build jobs were skipped. The 5/5 Linux runtime results are author-reported; I have not independently run them, and Windows/macOS/PS5 execution remains unverified.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5643140404 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10957#pullrequestreview-5643140404). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T12:08:27Z. **Review:** COMMENTED --- Reviewed exact head `d4a68788b98c1bb6a734e655d51adc8cb5c5cff0`. I traced request framing, range and ignored-range handling, content-range validation, validators, redirects, chunk decoding, cache offsets, AVIO seek/read and stop propagation. The 200 response path correctly keeps `cacheStart = 0` and validates the full representation length before serving bytes requested from a nonzero offset; the 206 path requires exact requested start and body/range-length agreement. The new tests cover both cases plus chunking, redirects, cancellation/restart and callback priority. Local `git diff --check` and `python3 tools/check_conventions.py --base upstream/main --head refs/review/10957` passed. Hosted eligibility, intake, conventions, labels and report checks pass; product build jobs were skipped. The 5/5 Linux runtime results are author-reported; I have not independently run them, and Windows/macOS/PS5 execution remains unverified.
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!10957
No description provided.