fix(avplayer): defer loop warnings until frame delivery #5846

Merged
SeifKaroui merged 1 commit from upstream-pr/5846 into main 2026-10-15 21:01:05 +00:00
SeifKaroui commented 2026-10-14 13:43:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SeifKaroui on 2026-10-14T13:43:52Z.


What

With looping enabled, the demuxer can reach EOF and seek to the next pass while the caller is still receiving frames from the previous pass. Queuing SCE_AVPLAYER_ERROR_WAR_LOOPING_BACK there announces the loop before its first frame is delivered.

Record loop epochs during demuxing and queue one warning when either audio or video first delivers that epoch. Pending loop epochs are discarded on seek and restart. The callback remains asynchronous through the existing player event queue.

The regression uses the existing synthetic movie. This was investigated during ASTRONEER (PPSA27623, version 01.015.000) bring-up; the tests demonstrate callback ordering, and do not establish a title compatibility improvement. The delivery boundary follows KytyPS5; exact console callback timing remains unverified and is recorded in docs/dev/debt/libSceAvPlayer.md.

Open #1601 touches AvPlayer buffer retention in the same files. It does not implement this notification change, and this change has no implementation dependency on it.

Tested

Windows x64 25H2, build 26200.9457; WinLibs MinGW-w64 GCC 15.2.0 UCRT/POSIX/SEH; Release, BUILD_TESTING=ON. Base: upstream main at 5a6ad0ed36893e86022929b808ac547672445cd9.

  • guest_avplayer: three consecutive passes, 8.97-9.05 seconds each. Checks three video-only and audio-only wraps, exact warning counts, seek/restart handling, and one shared warning when both audio and video wrap. Existing playback, stream changes, pause, clock, frame lifetime and EOF checks also pass.
  • Unchanged upstream Source.cpp, rebuilt as a separate AvPlayer library and used with the new regression executable: exits 1 at loop warning did not match the playback boundary.
  • Fresh build of relinker, libs and patched_libraries_tests from the isolated checkout: passes.
  • Final ctest --test-dir build-pr-avplayer --output-on-failure -R "^(guest_avplayer|patched_libraries)$": 2/2 pass; playback 9.16 seconds, patched-library loading 0.82 seconds.
  • python tools/check_conventions.py --base upstream/main --title "fix(avplayer): defer loop warnings until frame delivery" --body <description>: passes for the contribution diff and PR description.

Not tested: Linux, console callback timing, or a title run with this isolated patch. No performance claim.

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
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • GPUs tested: n/a (AvPlayer change)
  • AI-assisted: yes (Codex)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4858834279 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5846). Originally posted by [SeifKaroui](https://github.com/SeifKaroui) on 2026-10-14T13:43:52Z. --- ### What With looping enabled, the demuxer can reach EOF and seek to the next pass while the caller is still receiving frames from the previous pass. Queuing `SCE_AVPLAYER_ERROR_WAR_LOOPING_BACK` there announces the loop before its first frame is delivered. Record loop epochs during demuxing and queue one warning when either audio or video first delivers that epoch. Pending loop epochs are discarded on seek and restart. The callback remains asynchronous through the existing player event queue. The regression uses the existing synthetic movie. This was investigated during ASTRONEER (PPSA27623, version 01.015.000) bring-up; the tests demonstrate callback ordering, and do not establish a title compatibility improvement. The delivery boundary follows [KytyPS5](https://github.com/KytyPS5/KytyPS5/blob/a6f4e8e7f456b8697d3102823d3f16400c3e121e/src/libs/avPlayer.cpp#L1038-L1043); exact console callback timing remains unverified and is recorded in `docs/dev/debt/libSceAvPlayer.md`. Open #1601 touches AvPlayer buffer retention in the same files. It does not implement this notification change, and this change has no implementation dependency on it. ### Tested Windows x64 25H2, build 26200.9457; WinLibs MinGW-w64 GCC 15.2.0 UCRT/POSIX/SEH; Release, `BUILD_TESTING=ON`. Base: upstream `main` at `5a6ad0ed36893e86022929b808ac547672445cd9`. - `guest_avplayer`: three consecutive passes, 8.97-9.05 seconds each. Checks three video-only and audio-only wraps, exact warning counts, seek/restart handling, and one shared warning when both audio and video wrap. Existing playback, stream changes, pause, clock, frame lifetime and EOF checks also pass. - Unchanged upstream `Source.cpp`, rebuilt as a separate AvPlayer library and used with the new regression executable: exits 1 at `loop warning did not match the playback boundary`. - Fresh build of `relinker`, `libs` and `patched_libraries_tests` from the isolated checkout: passes. - Final `ctest --test-dir build-pr-avplayer --output-on-failure -R "^(guest_avplayer|patched_libraries)$"`: 2/2 pass; playback 9.16 seconds, patched-library loading 0.82 seconds. - `python tools/check_conventions.py --base upstream/main --title "fix(avplayer): defer loop warnings until frame delivery" --body <description>`: passes for the contribution diff and PR description. Not tested: Linux, console callback timing, or a title run with this isolated patch. No performance claim. ### Checklist - [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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's technical debt file - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: none - [x] GPUs tested: n/a (AvPlayer change) - [x] AI-assisted: yes (Codex)
github-actions[bot] commented 2026-10-15 12:10:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:10:21Z.


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 1601 core/libs/prx/libSceAvPlayer/src/Source.cpp
core/libs/tests/GuestAvPlayer.cpp
PR 6044 core/libs/tests/GuestAvPlayer.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6191716947 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5846#issuecomment-6191716947). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-15T12:10:21Z. --- <!-- pr-overlap --> 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 1601](https://www.github.com/boykopovar/AnyPS5/pull/1601) | `core/libs/prx/libSceAvPlayer/src/Source.cpp`<br>`core/libs/tests/GuestAvPlayer.cpp` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/GuestAvPlayer.cpp` |
adriadam10 commented 2026-10-15 13:39:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T13:39:44Z.


Checked on Linux: build + ctest of AvPlayer/libs (33 tests, all pass). Reverting only the Source.cpp change makes guest_avplayer fail, so the new regression tests exercise the fix: warning counts match the delivery boundary for video-only, audio-only, shared, and are dropped on seek/restart. Debt line is under the right section; merging once the full Build is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6193458836 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5846#issuecomment-6193458836). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-15T13:39:44Z. --- Checked on Linux: build + ctest of AvPlayer/libs (33 tests, all pass). Reverting only the `Source.cpp` change makes `guest_avplayer` fail, so the new regression tests exercise the fix: warning counts match the delivery boundary for video-only, audio-only, shared, and are dropped on seek/restart. Debt line is under the right section; merging once the full Build is green.
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!5846
No description provided.