libSceAvPlayer: auto start restarts playback the title already started and releases the frame it holds #2793

Closed
opened 2026-10-10 15:20:09 +00:00 by Yassin6up · 0 comments
Yassin6up commented 2026-10-10 15:20:09 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Yassin6up on 2026-10-10T15:20:09Z.


sceAvPlayerAddSource queues an auto start for a player created with auto start or without an event callback (Player.cpp, autoStartEnabled). If the title enables its streams and calls sceAvPlayerStart before the controller thread runs that auto start, Player::autoStart calls Start on the playing player. Start then goes through stopLocked: Source::Stop releases every video buffer, including the frame the title holds, and the film starts over.

Measured on Linux (Ubuntu 24.04, GCC 13.3, main 8b812318): right after TestUnsyncedVideoKeepsUpWithAudio's own sceAvPlayerStart, 8 texture buffers are released within 100 ms in 15 of 15 runs. Under parallel load guest_avplayer occasionally fails with "video frame is not a texture allocation" (1 of 200 runs), when the test checks a frame the restart has just released.

Fix: commit 4602d35f4 on branch claude/peaceful-fermat-us6v6j of https://github.com/Yassin6up/AnyPS5. It applies cleanly on its own to main 8b812318.

  • Player::autoStart returns unless the player is still ready, and starts it only if it is still ready under the player lock (Start split into Start/startLocked).
  • New TestAutoStartKeepsStartedPlayback: a callback-less player started by the test must release no texture buffer afterwards, and the frame it holds must stay allocated. It fails 5 of 5 runs without the fix ("auto-start restarted playback the title had started") and passes 5 of 5 with it.
  • 200 parallel runs under load with the fix: no texture failures; the only failures left are "enable video failed", the race fixed by Yuva1024's b7dec57a (#2709).
  • TechnicalDebt records that this behaviour is not confirmed on a title. check_conventions.py passes. Windows not tested.

Related: #2709 (commit fa5199cd8 on the same branch makes guest_avplayer failures print their message instead of aborting on Linux).

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5792558282 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2793). Originally posted by [Yassin6up](https://github.com/Yassin6up) on 2026-10-10T15:20:09Z. --- sceAvPlayerAddSource queues an auto start for a player created with auto start or without an event callback (Player.cpp, autoStartEnabled). If the title enables its streams and calls sceAvPlayerStart before the controller thread runs that auto start, Player::autoStart calls Start on the playing player. Start then goes through stopLocked: Source::Stop releases every video buffer, including the frame the title holds, and the film starts over. Measured on Linux (Ubuntu 24.04, GCC 13.3, main 8b812318): right after TestUnsyncedVideoKeepsUpWithAudio's own sceAvPlayerStart, 8 texture buffers are released within 100 ms in 15 of 15 runs. Under parallel load guest_avplayer occasionally fails with "video frame is not a texture allocation" (1 of 200 runs), when the test checks a frame the restart has just released. Fix: commit 4602d35f4 on branch claude/peaceful-fermat-us6v6j of https://github.com/Yassin6up/AnyPS5. It applies cleanly on its own to main 8b812318. - Player::autoStart returns unless the player is still ready, and starts it only if it is still ready under the player lock (Start split into Start/startLocked). - New TestAutoStartKeepsStartedPlayback: a callback-less player started by the test must release no texture buffer afterwards, and the frame it holds must stay allocated. It fails 5 of 5 runs without the fix ("auto-start restarted playback the title had started") and passes 5 of 5 with it. - 200 parallel runs under load with the fix: no texture failures; the only failures left are "enable video failed", the race fixed by Yuva1024's b7dec57a (#2709). - TechnicalDebt records that this behaviour is not confirmed on a title. check_conventions.py passes. Windows not tested. Related: #2709 (commit fa5199cd8 on the same branch makes guest_avplayer failures print their message instead of aborting on Linux). AI-assisted: yes.
Sign in to join this conversation.
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#2793
No description provided.