Commit Graph
53 Commits
Author SHA1 Message Date
Dean ef995b015c Merge pull request #11772 from nekomancer01/fix/avplayer-video-start
fix(libSceAvPlayer): keep the no-sync clock from following audio pulled early
2026-11-05 08:18:12 +13:00
hyvvs 148261ead8 test(avplayer): allow HTTP transport test CI load margin 2026-11-02 23:30:02 +01:00
Dean 356719a973 Merge pull request #9937 from Longziip/fix/avplayer-frame-sample-aspect
fix(avplayer): report the sample aspect ratio in stream and frame info
2026-11-02 20:59:34 +13:00
Dean Galvin 02049a75d2 Merge main into feat/avplayer-http-source
# Conflicts:
#	docs/dev/debt/libSceAvPlayer.md
2026-11-01 21:09:31 +13:00
Longziip 0b41d81e2e fix(avplayer): follow the firmware sample aspect ratio fallbacks
Stream info reports the stream's sample aspect ratio alone and a frame reports the picture's, falling back to the stream's. Both are 0.0 when no ratio is given, as firmware 13.42 does for H.264.
2026-10-31 20:47:07 +01:00
Longziip ba526365de fix(avplayer): keep the stream aspect ratio in double precision 2026-10-31 20:37:39 +01:00
Longziip 5fdc6dbd42 fix(avplayer): report the sample aspect ratio in video frame info
The video frame info carried width / height in aspect_ratio. A title that
sizes its video quad from the frame value multiplies it by the picture
size again and drew the quad (9/16)^2 too small, so its static overlay
covered a band of the screen instead of all of it. The frame value is now
the stream's sample aspect ratio, 1.0 when the stream gives none, and the
stream info keeps width / height.
2026-10-31 20:37:39 +01:00
alfalfa-starandClaude Opus 5.5 290345261e fix(libSceAvPlayer): report the PS5 audio stream type for players made by sceAvPlayerInit
Crash Bandicoot 4 (PPSA02433) opens its logo movies with sceAvPlayerInit and
enables only streams of type 1 (video) and 2 (audio) from its READY callback,
so the audio track reported as type 0 was never enabled and the logos played
silent. The stream type is a property of the library, not of the init entry
point, so every player now reports audio as type 2.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 15:29:18 +01:00
XairRrR 72b788ba16 fix(libSceAvPlayer): saturate the current time when the clock passes the uint64 range
clockMillis converted the presentation clock, a double, to uint64 without
checking its range. A jump to 0xFFFFFFFFFFFFFFFF stores 2^64 in the clock,
and the conversion of that value is undefined. On x86-64 GCC it yields 0,
so sceAvPlayerCurrentTime reported 0 instead of the stream duration it
clamps every other time to.

The clock now saturates at the largest uint64 before the conversion, and
the duration clamp applies as before.

AI-assisted: yes
2026-10-29 06:18:32 +01:00
nekomancer01andClaude Opus 5.5 6b01c577dd fix(libSceAvPlayer): request 12 decode-ahead frames only in no-sync mode
Default sync mode requests 4 as before. In no-sync mode the player
requests 12 and falls back to 4 when they do not fit the memory
replacement.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 09:22:34 +11:00
xuanzeng dbdc41e773 fix(avplayer): preserve private test helper names when patching 2026-10-28 02:50:38 +08:00
nekomancer01andClaude Opus 5.5 10d2f4b44c fix(libSceAvPlayer): keep the no-sync clock from following audio pulled early
In SCE_AVPLAYER_AV_SYNC_MODE_NONE the clock was rebased forward to every
audio chunk the title pulled more than 50 ms ahead of it. PPSA35399 pulls
audio two to four times faster than it plays, so the clock ran seconds
ahead and the late-frame skip handed out frames past the one the title
asked for next. The title only uploads the frame whose index equals its
own playback index and drops earlier ones, so no frame was ever shown and
the New Game film stayed black.

Audio pulled early no longer moves the clock forward in no-sync mode;
audio that falls behind still pulls it back. Decode-ahead grows from 4 to
12 frames: the title drains every ready frame once per rendered frame at
about 4.5 fps here, and 6 frames per poll stayed below the 30 fps film.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 23:09:54 +11:00
xuanzeng b27b2a8331 fix(avplayer): use native MinGW unwinding for the HTTP probe 2026-10-27 18:36:05 +08:00
xuanzeng 9a01dddadd test(http): bound patched client module dependencies 2026-10-27 17:19:07 +08:00
xuanzeng 17bb16e974 refactor(http): share AvPlayer client through libSceHttp 2026-10-27 17:03:49 +08:00
AZLisme b81104eb5f feat(libSceAvPlayer): stream HTTP file sources with range seeking 2026-10-27 16:29:20 +08:00
Adrià 2f506cacac Merge pull request #9624 from MarrasFederico/feat/avplayer-trick-speed-bandwidth-source
fix(libSceAvPlayer): refuse sceAvPlayerSetTrickSpeed without a source and sceAvPlayerSetAvailableBandwidth after one
2026-10-25 20:52:31 +01:00
boykopovar f38d29fd08 refactor(sdk): add canonical headers for remaining libraries 2026-10-24 23:17:42 +03:00
Dean 2fade7ef4e Merge pull request #8980 from Dragost/fix/libSceAvPlayer-drift-gated-audio-clock-rebase
fix(libSceAvPlayer): gate audio clock rebase by drift threshold
2026-10-25 07:43:44 +13:00
DragostandCursor f3b4b61f4d fix(libSceAvPlayer): reconcile the exhausted audio clock once per epoch
Co-authored-by: Cursor <[email protected]>
2026-10-24 14:33:20 +02:00
DragostandCursor 0415d01996 fix(libSceAvPlayer): reconcile the audio clock when EOF arrives late
The last audio frame can be consumed before the decoder marks EOF, so the in-pull check never sees an exhausted stream. Rebase once EOF is visible with an empty queue, and hold the producer in the test so both orderings stay deterministic.

Co-authored-by: Cursor <[email protected]>
2026-10-23 21:11:23 +02:00
DragostandCursor cd1d2f9ee7 fix(libSceAvPlayer): rebase the clock when the audio stream is exhausted
A fast drain after a seek can finish inside the 50 ms gate, leaving the presentation clock short of the final sample. Linux CI then fails guest_avplayer with clock not at the end.

Co-authored-by: Cursor <[email protected]>
2026-10-23 17:47:43 +02:00
DragostandCursor dc35ea2022 test(libSceAvPlayer): make audio clock drift gating independent of wall time
Control the presentation clock via the test hook, sync the override on Rebase so assertions observe real rebases, and cover both drift directions plus the exact 50 ms boundary.

Co-authored-by: Cursor <[email protected]>
2026-10-23 15:11:40 +02:00
Federico Marras 4746d233b4 Merge remote-tracking branch 'upstream/main' into feat/avplayer-trick-speed-bandwidth-source 2026-10-22 15:14:29 +02:00
Dragost 4c946a2c8d fix(libSceAvPlayer): gate audio clock rebase by drift threshold 2026-10-21 22:15:28 +02:00
Federico Marras b19b1c817e fix(libSceAvPlayer): refuse sceAvPlayerSetTrickSpeed without a source and sceAvPlayerSetAvailableBandwidth after one 2026-10-21 21:21:03 +02:00
boykopovar 024dddc6f4 fix(avplayer): restore extended start position parameters 2026-10-21 21:53:05 +03:00
Dragost 3b40961d5d fix(libSceAvPlayer): allow presenting video frames within sync tolerance 2026-10-21 11:32:33 +02:00
gohansharma79-svg b0a7695b57 fix(avplayer): deliver the first paused picture after audio starts 2026-10-19 03:46:40 +05:30
mrfelekandClaude Opus 5.5 cfa5b9b47c feat(libSceAvPlayer): accept VP9 video and Opus audio streams
Sources whose streams are VP9 or Opus were dropped by IsStreamSupported, so
a WebM movie added with sceAvPlayerAddSource had no streams and the player
reported an error. The bundled FFmpeg already decodes both; their frames go
through the existing NV12 and PCM output paths.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BywPXoZACVi8ALV4JKvuPZ
2026-10-17 17:32:35 +02:00
Leonardo Baldazzi 742aeb4211 fix(avplayer): preserve caller-paced delivery in no-sync mode 2026-10-16 22:35:36 +02:00
Leonardo Baldazzi bd9d10b4ce fix: correct audio-video playback timing and sync 2026-10-16 22:35:30 +02:00
Adrià e576db754f Merge pull request #5944 from Ondra97/codex/fix-avplayer-callback-close
fix(avplayer): close safely from event callbacks
2026-10-16 22:29:32 +02:00
Ondra97 5474b7756d fix(avplayer): close safely from event callbacks 2026-10-14 18:36:15 +02:00
Seif Allah Karoui 86de982f25 fix(avplayer): defer loop warnings until frame delivery
Queue demux loop epochs and report each once when audio or video first delivers that pass. Discard pending loop boundaries on seek and restart. Add playback regressions and record unverified console callback timing.

AI-assisted: yes (Codex).
2026-10-14 14:38:36 +01:00
xXPBSXxandClaude Sonnet 5.5 a671dc4edf fix(avplayer): resume the presentation clock when the source restarts after a pause
Clock::Reset left the paused flag set by Clock::Pause, so a Start issued
from the paused state (stop and restart of the source) kept the clock
frozen at the start position. Only the frame at that position was
delivered; later frames were held back by the default A/V sync.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-12 19:36:06 +02:00
Yassine 5959506bbd test(avplayer): link guest_avplayer with the shared runtime libraries
guest_avplayer_tests imports __cxa_throw from libc.prx, which is loaded
before libstdc++, but -static-libgcc gave it a private copy of
_Unwind_Resume. A failed Check threw through libc.prx's unwinder and the
landing pad of the test function resumed with the private one, so on
Linux every failure aborted in _Unwind_RaiseException_Phase2 instead of
printing its message from main. This is the unexplained Linux abort in
the intermittent guest_avplayer failures.

The test is now linked without the static runtime flags, as the AgcDriver,
Agc and VideoOut tests already are, so the unwinder comes from the same
library as __cxa_throw. A forced Check failure in TestPlayback aborted
before and now prints its message and exits with 1.

(cherry picked from commit fa5199cd8f)
2026-10-12 02:47:43 +00:00
Santhosh Kumar 17827dd9ab fix(filesystem): reject invalid parent traversal on Windows 2026-10-12 01:25:02 +05:30
Roojool 23b65eb553 fix(avplayer): use precise Windows notified waits for EOF polling
Waits on eventCondition go through libkernel's TimedWait::Condition (precise
timed waits on Windows) instead of std::condition_variable::wait_for, as
requested in review.
2026-10-11 11:20:24 +02:00
raghav314andClaude Opus 5.5 aa013f59ac fix(libc): register guest heap blocks without GPU access
AnyPS5's libc heap registered every block with GPU access, so every
address-based build imported or mirrored each malloc block the title had
made. The console's libc.prx maps its heap with protection 3 (CPU read
and write, no GPU bits), so the GPU never sees it there either.

Heap blocks are now registered without GPU access; reallocating keeps the
block's access. The AvPlayer fallback for a title that passes no texture
allocator stands in for that allocator, which hands out memory the GPU
reads, so it allocates through a new GuestHeapAlignForGpu.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-11 07:02:30 +05:30
Yassine 9fc0af0b10 fix(avplayer): do not let auto start restart playback the title started
sceAvPlayerAddSource queues an auto start for a player created with auto
start or without an event callback. When the title enabled its streams
and called sceAvPlayerStart before the controller thread ran it, the auto
start called Start again on the playing player, which stopped it, released
every video buffer, including the frame the title held, and started the
film over. guest_avplayer occasionally caught this as "video frame is not
a texture allocation"; right after the test's own start, 8 texture
buffers were released in 15 of 15 runs.

The auto start now starts the player only while it is still ready, and
checks that under the player lock together with the start.

TestAutoStartKeepsStartedPlayback starts a callback-less player itself and
checks that no texture buffer is released afterwards and that the frame
it holds stays allocated. It fails on every run without the fix.
2026-10-10 17:56:25 +00:00
FaffuandClaude Opus 5.5 068da6a99f fix(avplayer): skip late video frames in no-sync mode while audio drives the clock
In SCE_AVPLAYER_AV_SYNC_MODE_NONE every decoded frame was handed out in
order, so a title that requests video slower than the film's frame rate
fell behind its audio (about 52 s by the end of the PPSA12544 intro).
While the title pulls audio, frames the audio clock has already passed are
now skipped; frames that are not late are handed out as before.

Fixes #1635

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-10 09:42:20 +02:00
AngelandClaude Opus 5.5 b6f42c75d8 fix(avplayer): read the PS5 SceAvPlayerInitDataEx layout
PS5 titles pass a 0x230-byte SceAvPlayerInitDataEx: auto start is the
byte after debug_level at 0x74, nine 0x30-byte thread parameter blocks
fill 0x78-0x228 and the output video frame buffer count is at 0x228.
sceAvPlayerInitEx read both fields at their PS4 offsets: auto start at
0xa8 is the video decoder thread priority and the buffer count at 0xa4
lies in the audio decoder block. PPSA25063 (Poppy Playtime: Chapter 4)
sets every thread priority to 700, so its intro video started on its
own and stopped at once; it writes auto start 0 and starts playback
itself.

With this_size 0x230 or more both fields are read at the PS5 offsets;
smaller structures are read as before. The layout follows KytyPS5,
prosper, SharpProspero and sharpemu and is recorded in TechnicalDebt.

guest_avplayer builds a 0x230-byte structure with auto start 0 and
nonzero thread parameters, then with auto start 1, and checks when
playback starts and how many video buffers are allocated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-09 12:14:01 +02:00
Claude 121d9332b5 build(libs): strip the MinGW static runtime flags once for all libraries
Every library CMakeLists.txt ended with the same block removing -static,
-static-libgcc and -static-libstdc++ from CMAKE_EXE_LINKER_FLAGS on MinGW,
because core/libs/CMakeLists.txt only removed them after adding the library
directories. Remove them before the libc and library directories are added
so each directory inherits the stripped flags, and drop the 52 copies.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017pTZqAyVSZy2FZmaqakPHZ
2026-10-07 10:10:38 +00:00
Claude 5625fe6043 refactor(libSceAvPlayer): build libSceAvPlayer.native from the shared Export.cpp
libSceAvPlayer.native/Export.cpp was a byte-identical copy of
libSceAvPlayer/Export.cpp. Point add_sce_avplayer_library at the guest
directory's Export.cpp, as the Audiodec and Font library functions do, and
remove the copy.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017pTZqAyVSZy2FZmaqakPHZ
2026-10-07 06:19:46 +00:00
MerijnandClaude Opus 5.5 736ba56d85 fix(avplayer): deliver the frame at a jump while paused
A paused player returned no video at all. Unity's video player prepares
a clip by starting it, pausing, jumping to the start and polling
sceAvPlayerGetVideoDataEx until the frame at the jump arrives, and only
then resumes; PPSA12544 waited there forever on a black screen in its
intro cinematic. While paused, the first frame after a jump is now
delivered (the paused clock rebased to it); other frames are still held
until the player resumes. The guest test pauses, jumps and expects that
one frame and nothing after it.

AI-assisted: yes

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-06 15:20:51 +02:00
hamb3r cf10b5e609 fix(avplayer): make decode-ahead buffers optional 2026-10-05 04:58:00 +03:00
hamb3randsaulo benigno c2fa7fd97f fix(avplayer): add decode-ahead buffers for application video output
When an application requests only 2 video buffers and holds one during playback, decode-ahead frames allow the decoder to stay ahead and prevent stalls under SyncModeNone.

Co-Authored-By: saulo benigno <[email protected]>
2026-10-05 03:10:07 +03:00
Dean Galvin b62d02c2af feat(avplayer): decode H.264 and AAC with FFmpeg
Replace the decoder-less AvPlayer with a player that demuxes MP4 sources
with FFmpeg (opened by path or through the title's file replacement),
decodes H.264 and AAC on their own threads, and hands out NV12 frames and
interleaved 16-bit PCM in buffers from the title's allocators, presented
on a media clock that audio drives when it is enabled.

Both libSceAvPlayer and libSceAvPlayer.native are built from the same
sources and link the shared ffmpeg target. The struct size checks stay,
next to the types in SceTypes.hpp. ChangeStream and GetStreamInfoEx are
implemented; Init without allocators, StartEx, SetAvailableBandwidth,
SetLogCallback and negative trick speeds succeed as before and are listed
in TechnicalDebt. HLS sources throw.

guest_avplayer plays an embedded 6 KB MP4 (H.264 plus two AAC tracks).
2026-10-03 08:10:55 +13:00
OverkillLabs e629f37481 feat(libSceAvPlayer): implement full AvPlayer state machine
Replace the stub AvPlayer export set with a general-purpose player state
machine covering the full API surface: sceAvPlayerInit/InitEx/PostInit,
AddSource/AddSourceEx, Start/StartEx, Pause/Resume/Stop/Close, IsActive,
CurrentTime, JumpToTime, SetLooping, SetAvSyncMode, SetTrickSpeed,
SetAvailableBandwidth, StreamCount/EnableStream/DisableStream/ChangeStream/
GetStreamInfo(Ex), and GetVideoData(Ex)/GetAudioData.

No real decoder is wired up: the player tracks lifecycle and timing state
and serves a fixed-length blank clip on a wall-clock media clock, firing
the READY/PLAY/PAUSE/STOP event callbacks a title expects from a real
playback session. This is enough for titles that gate progression on
AvPlayer's polling/event surface rather than on decoded frame content.

The non-native libSceAvPlayer/Export.cpp now forwards to the native
implementation via #include rather than carrying its own duplicate stub
definitions, consistent with how other libSceX/libSceX.native pairs in
this tree share one implementation.
2026-09-28 13:29:23 +03:00