test(avplayer): stop the unsynced test racing the player's auto-start #2770

Merged
Yuva1024 merged 1 commit from upstream-pr/2770 into main 2026-10-10 22:59:45 +00:00
Yuva1024 commented 2026-10-10 13:56:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Yuva1024 on 2026-10-10T13:56:03Z.


What

Fixes the enable video failed failure of guest_avplayer reported in #2709.

TestUnsyncedVideoKeepsUpWithAudio built its player with InitData(nullptr), which has no event callback. Player enables auto-start in that case (autoStartEnabled = init.auto_start || callback.event_callback == nullptr), so its controller thread enables the streams and starts playback shortly after sceAvPlayerAddSource, racing the test's own sceAvPlayerEnableStream. When the controller wins, Source::EnableStream sees started == true and returns failure.

The test now passes an Events object, like the other tests that drive the player by hand. It is a two-line, test-only change. No other test in the file combines a missing callback with a manual EnableStream.

I could not test the Linux abort also mentioned in #2709 (std::abort() in the allocator or event callback). It may be a different symptom of the same race, or a separate cause.

Tested

Windows 11 (26200), WinLibs GCC 15.2.0 r7, Release, Ryzen 5 5600G, on main ba2a0a31 (the change applies unchanged to 8b812318).

  • Before: 1 failure (enable video failed) in 220 runs of guest_avplayer_tests, seen only with 6 runs in parallel. With a 60 ms pause before the test's EnableStream it fails 10/10.
  • After: with the same 60 ms pause, 10/10 pass. At normal timing 460/460 pass (100 serial, plus 6 parallel loops of 60).
  • guest_avplayer passes in the full ctest (709/709 on ba2a0a31).
  • python tools/check_conventions.py --base origin/main passes.
  • Not tested on Linux, macOS or a title.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4811709960 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2770). Originally posted by [Yuva1024](https://github.com/Yuva1024) on 2026-10-10T13:56:03Z. --- ### What Fixes the `enable video failed` failure of `guest_avplayer` reported in #2709. `TestUnsyncedVideoKeepsUpWithAudio` built its player with `InitData(nullptr)`, which has no event callback. `Player` enables auto-start in that case (`autoStartEnabled = init.auto_start || callback.event_callback == nullptr`), so its controller thread enables the streams and starts playback shortly after `sceAvPlayerAddSource`, racing the test's own `sceAvPlayerEnableStream`. When the controller wins, `Source::EnableStream` sees `started == true` and returns failure. The test now passes an `Events` object, like the other tests that drive the player by hand. It is a two-line, test-only change. No other test in the file combines a missing callback with a manual `EnableStream`. I could not test the Linux abort also mentioned in #2709 (`std::abort()` in the allocator or event callback). It may be a different symptom of the same race, or a separate cause. ### Tested Windows 11 (26200), WinLibs GCC 15.2.0 r7, Release, Ryzen 5 5600G, on `main` ba2a0a31 (the change applies unchanged to 8b812318). - Before: 1 failure (`enable video failed`) in 220 runs of `guest_avplayer_tests`, seen only with 6 runs in parallel. With a 60 ms pause before the test's `EnableStream` it fails 10/10. - After: with the same 60 ms pause, 10/10 pass. At normal timing 460/460 pass (100 serial, plus 6 parallel loops of 60). - `guest_avplayer` passes in the full `ctest` (709/709 on ba2a0a31). - `python tools/check_conventions.py --base origin/main` passes. - Not tested on Linux, macOS or a title. ### 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](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-10 13:56:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T13:56:12Z.


Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6098225223 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2770#issuecomment-6098225223). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-10T13:56:12Z. --- Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.
adriadam10 commented 2026-10-10 22:59:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T22:59:42Z.


Checked the diff and the cause (Player.cpp:65 turns auto-start on when there is no event callback, racing the test's manual EnableStream). Reproduced on Linux with 6 parallel copies plus busy loops (240 runs): main fails enable video failed 28 times, this PR 0 times. Build and the core/libs ctest pass; merging.

Note: #2709 stays open, since the Linux std::abort on a failing Check (unwinder mismatch between libc.prx and -static-libgcc, see Yassin6up's analysis there) is a separate problem.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6103098551 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2770#issuecomment-6103098551). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-10T22:59:42Z. --- Checked the diff and the cause (`Player.cpp:65` turns auto-start on when there is no event callback, racing the test's manual `EnableStream`). Reproduced on Linux with 6 parallel copies plus busy loops (240 runs): `main` fails `enable video failed` 28 times, this PR 0 times. Build and the core/libs ctest pass; merging. Note: #2709 stays open, since the Linux `std::abort` on a failing `Check` (unwinder mismatch between libc.prx and `-static-libgcc`, see Yassin6up's analysis there) is a separate problem.
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!2770
No description provided.