fix(avplayer): resume the presentation clock when the source restarts after a pause #4652
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4652"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T17:55:51Z.
What
Clock::ResetinlibSceAvPlayerdid not clear thepausedflag thatClock::Pausesets. AftersceAvPlayerPausethe player was restarted bysceAvPlayerStart(which stops and restarts the source from the Pause state), the presentation clock stayed frozen at the start position: the first frame (pts 0) was delivered, every later frame was held back by the default A/V sync (frame timestamp > Now()), so video stood still.Sequence observed in Cult of the Lamb (PPSA06465), cutscene
Update_Video.mp4:SetAvSyncMode(1),Start(T+28879),SetAvSyncMode(0),Start(T+29007),Pause(T+29008),SetLooping(1),JumpToTime(0)(T+29169),Start(T+29278). The failing step is the lastStart, called from the Pause state. Trace (AVPTRC, timestamps in ms after process start): 6 frames pts 0..100 before the pause, then one frame pts 0 at T+29304 after that lastStart, then onlyGetVideoDataExreturning false for 20 s until the user skipped (Stopat T+52247).The fix resets
pausedtogether with the clock inClock::Reset. The new testTestRestartAfterPausedJumpKeepsClockRunning(Start, frame,Pause,SetLooping,JumpToTime(0),Start, expects frames up to pts 200 and a runningCurrentTime) uses the existing synthetic movie inGuestAvPlayer.cppand checks frame delivery andCurrentTime, not real-time pace; it fails without the change and passes with it (results below).Overlap: open #1601 (keep handed-out video frames) changes
Source.cppbut notClock, so it is not a duplicate.git merge-treeof the two heads (a671dc4ed,91f77a455) conflicts incore/libs/tests/GuestAvPlayer.cppanddocs/dev/TechnicalDebt.md;Source.cppmerges. #1601 already conflicts withmain30f961266in those two files on its own, so whichever lands second rebases its test and debt entry. Merged avplayer PRs (#893 jump while paused, #2896 title-started playback) do not cover this.Tested
Windows 10, MinGW Release, built on main
2a5eca11c(not rebuilt on current main: the new3rdparty/libusb-cmakesubmodule is not available here;git merge-treeof the current heada671dc4edagainstmain30f961266shows no conflict),guest_avplayer_tests:ctest -R guest_avplayer(new testTestRestartAfterPausedJumpKeepsClockRunningplus the existing AvPlayer tests): without theClock::Resetchange the run fails with "playback froze after a restart that followed a paused jump"; with the change it passes (4.7 s).python tools/check_conventions.py --base upstream/mainpasses.Tested with the fix in Cult of the Lamb (Windows, extended AvPlayer trace): the cutscene now plays at real-time pace (video position against wall clock 1.00). The title then ends the video itself at a video position of about 22.8 s (it calls
Pause,Stop,Close); the reason is not known and is not changed by this PR.Not recorded: whether this was run on Linux or on a console; the text above names only Windows. The Cult of the Lamb run is described above as it was recorded; a later hand observation on Windows 10 (video stays on one frame without this change, plays with it, then ends early at about the same point as before) is in the comment on this pull request; the early end of the cutscene is not explained and is not part of this change.
Checklist
Based on current
main; no other open PR implements the same functionsOne topic per PR; follow-ups go in a new PR
No comments in code except technical debt
Unimplemented paths throw; silent stubs are listed in TechnicalDebt (n/a, none added)
No notes, investigation
.mdfiles or images added to the repositoryNew third-party code is a submodule built from source (n/a, none added)
Generic behaviour, not specific to one title
Depends on: none
Unblocks: PPSA06465 Cult of the Lamb, cutscene frozen on its first frame (no Game bring-up discussion exists; the video plays now, it still ends early for a reason not established)
AI-assisted: yes
AI-assisted (Claude Code).
🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T14:54:49Z.
Checked the
Clock::Resetchange againstSource::Stop/Start(the source's ownpausedwas already cleared on stop, the clock's wasn't), ranguest_avplayerwith the PR (passes) and withSource.cppreverted (the new test fails as expected), plus the rest of the libs ctest (26/26). Merging once the full Build is green.Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T15:05:50Z.
Observation on Windows 10 (not a CI run): Cult of the Lamb (PPSA06465), watched by hand with the libraries of
main2890f9549and ofmain+ this change (01bd0157b):Update_Video.mp4is opened once. After that open the run with the change logs more texture activity (78 versus 21 lines); the logs contain no AvPlayer lines, so this is only a count, not a frame measurement.The libraries differ in
libSceAvPlayer(andlibSceAvPlayer.native);libSceAgc,libSceAgcDriverandlibSceVideoOutalso differ, probably only in the embedded revision (not checked).AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T15:16:30Z.
Checked
Clock::ResetagainstSource::Stop/Start(the source'spausedwas cleared on stop, the clock's wasn't).guest_avplayerpasses with the PR and fails withSource.cppreverted; the rest of the scoped libs ctest is green (27/27). Merging once the full Build is green.