fix(avplayer): deliver the first paused picture after audio starts #7680

Merged
gohansharma79-svg merged 2 commits from upstream-pr/7680 into main 2026-10-20 13:19:03 +00:00
gohansharma79-svg commented 2026-10-18 22:22:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gohansharma79-svg on 2026-10-18T22:22:23Z.


What

Allow the first video picture to be returned while playback is paused after audio has already established the playback epoch. Previously takeVideo rejected that picture solely because its epoch was not newer than the audio clock, leaving a caller that prepares video this way with no picture. Once a picture has been presented, the existing paused-frame restriction still applies.

Ported from a local Lost Crown bring-up fix, with a standalone synthetic movie regression for both default and no-sync modes. No title-specific paths or IDs are introduced. This does not change the no-sync playback clock policy or claim an FPS gain. The console's exact initial preparation ordering has not been measured; this limitation is recorded in the AvPlayer technical debt.

Tested

Windows x64, GCC 15.2.0 / MinGW, Release. The current-main AvPlayer sources and regression executable were compiled in an external CMake validation harness using the existing FFmpeg static build and existing libc/kernel dependency artifacts; this is not a complete clean build of all upstream targets. No game files are included.

  • Baseline runtime with the new test: fails with first video frame blocked during paused preparation after audio started.

  • Patched runtime: standalone paused-first-video regression passes for both sync modes (1.86 s).

  • Existing AvPlayer playback suite passes (9.34 s), including pause/jump/resume and no-sync clock behavior.

  • Callback-close suite passes (0.80 s).

  • tools/check_conventions.py --base origin/main: passed.

  • Linux and a full clean runtime build have not been tested.

  • Repository overlap checker ran against all open PRs. Its documentation conflict with #7412 was resolved by placing the new note separately. #1601 (frame ownership) and #6044 (test reorganization) already conflict with current main, so their shared-file patches were reviewed manually; they do not implement this paused-first-picture correction.

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; synthetic regression, no claim of unblocking a complete title

  • GPUs tested: n/a (AvPlayer CPU decoding/state change)

  • AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4913345273 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7680). Originally posted by [gohansharma79-svg](https://github.com/gohansharma79-svg) on 2026-10-18T22:22:23Z. --- ### What Allow the first video picture to be returned while playback is paused after audio has already established the playback epoch. Previously `takeVideo` rejected that picture solely because its epoch was not newer than the audio clock, leaving a caller that prepares video this way with no picture. Once a picture has been presented, the existing paused-frame restriction still applies. Ported from a local Lost Crown bring-up fix, with a standalone synthetic movie regression for both default and no-sync modes. No title-specific paths or IDs are introduced. This does not change the no-sync playback clock policy or claim an FPS gain. The console's exact initial preparation ordering has not been measured; this limitation is recorded in the AvPlayer technical debt. ### Tested Windows x64, GCC 15.2.0 / MinGW, Release. The current-main AvPlayer sources and regression executable were compiled in an external CMake validation harness using the existing FFmpeg static build and existing libc/kernel dependency artifacts; this is not a complete clean build of all upstream targets. No game files are included. - Baseline runtime with the new test: fails with `first video frame blocked during paused preparation after audio started`. - Patched runtime: standalone paused-first-video regression passes for both sync modes (1.86 s). - Existing AvPlayer playback suite passes (9.34 s), including pause/jump/resume and no-sync clock behavior. - Callback-close suite passes (0.80 s). - `tools/check_conventions.py --base origin/main`: passed. - Linux and a full clean runtime build have not been tested. - Repository overlap checker ran against all open PRs. Its documentation conflict with #7412 was resolved by placing the new note separately. #1601 (frame ownership) and #6044 (test reorganization) already conflict with current main, so their shared-file patches were reviewed manually; they do not implement this paused-first-picture correction. <!-- 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: none - [x] Fixes: none - [x] Unblocks: none; synthetic regression, no claim of unblocking a complete title - [x] GPUs tested: n/a (AvPlayer CPU decoding/state change) - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-18 22:43:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T22:43:31Z.


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/prx/libSceAvPlayer/CMakeLists.txt
core/libs/tests/GuestAvPlayer.cpp
PR 7412 core/libs/prx/libSceAvPlayer/src/Source.cpp
docs/dev/debt/libSceAvPlayer.md
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6256085906 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7680#issuecomment-6256085906). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-18T22:43:31Z. --- <!-- 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/prx/libSceAvPlayer/CMakeLists.txt`<br>`core/libs/tests/GuestAvPlayer.cpp` | | [PR 7412](https://www.github.com/boykopovar/AnyPS5/pull/7412) | `core/libs/prx/libSceAvPlayer/src/Source.cpp`<br>`docs/dev/debt/libSceAvPlayer.md` |
karimibrahim07 commented 2026-10-19 03:17:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by karimibrahim07 on 2026-10-19T03:17:35Z.

Review: COMMENTED


Windows run of head a7ab0a0b9 in a full in-tree build, since the description lists that as not done. Merged onto main ccbd40240 together with #7669, #7670, #7709 and #7717 (each merge clean, built once). Windows 11 Pro (26300), Ryzen 5 3600, WinLibs GCC 15.2.0 r7, Ninja Release, BUILD_TESTING=ON.

  • guest_avplayer, guest_avplayer_callback_close and the new guest_avplayer_paused_first_video pass, --repeat until-fail:3.
  • Negative control: with main's Source.cpp the new test fails with first video frame blocked during paused preparation after audio started.

Code: presented is reset only in the start path (with clockEpoch = 0) and is set when a picture is handed out. So the new condition only lets one picture through while paused, before the first one since sceAvPlayerStart. After a paused jump presented is still true and the old rule applies, which TestRestartAfterPausedJumpKeepsClockRunning covers. The test's last check, that no second picture comes while paused, pins that down. I have no requests.

Not checked: Linux, and a title (I don't have The Lost Crown).

AI-assisted: yes. I ran the build, the tests and the negative control above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5566546700 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7680#pullrequestreview-5566546700). Originally posted by [karimibrahim07](https://github.com/karimibrahim07) on 2026-10-19T03:17:35Z. **Review:** COMMENTED --- Windows run of head `a7ab0a0b9` in a full in-tree build, since the description lists that as not done. Merged onto `main` `ccbd40240` together with #7669, #7670, #7709 and #7717 (each merge clean, built once). Windows 11 Pro (26300), Ryzen 5 3600, WinLibs GCC 15.2.0 r7, Ninja Release, `BUILD_TESTING=ON`. - `guest_avplayer`, `guest_avplayer_callback_close` and the new `guest_avplayer_paused_first_video` pass, `--repeat until-fail:3`. - Negative control: with `main`'s `Source.cpp` the new test fails with `first video frame blocked during paused preparation after audio started`. **Code:** `presented` is reset only in the start path (with `clockEpoch = 0`) and is set when a picture is handed out. So the new condition only lets one picture through while paused, before the first one since `sceAvPlayerStart`. After a paused jump `presented` is still true and the old rule applies, which `TestRestartAfterPausedJumpKeepsClockRunning` covers. The test's last check, that no second picture comes while paused, pins that down. I have no requests. Not checked: Linux, and a title (I don't have The Lost Crown). AI-assisted: yes. I ran the build, the tests and the negative control above.
adriadam10 commented 2026-10-20 13:19:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-20T13:19:24Z.


Checked the presented guard in takeVideo (only reset at start, so the paused-jump block is unchanged), the new test's registration (working dir, Windows PATH) and the debt note, against current main. Windows run and negative control by @karimibrahim07 cover the test; merged.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6291802919 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7680#issuecomment-6291802919). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-20T13:19:24Z. --- Checked the `presented` guard in `takeVideo` (only reset at start, so the paused-jump block is unchanged), the new test's registration (working dir, Windows PATH) and the debt note, against current main. Windows run and negative control by @karimibrahim07 cover the test; merged.
gohansharma79-svg commented 2026-10-20 13:33:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gohansharma79-svg on 2026-10-20T13:33:03Z.


I have one more pull request

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6292080000 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7680#issuecomment-6292080000). Originally posted by [gohansharma79-svg](https://github.com/gohansharma79-svg) on 2026-10-20T13:33:03Z. --- I have one more pull request
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!7680
No description provided.