From c2fa7fd97fe952397770255b0e015fe71f5ca04d Mon Sep 17 00:00:00 2001 From: hamb3r <48532909+hamb3r@users.noreply.github.com> Date: Mon, 5 Oct 2026 03:10:07 +0300 Subject: [PATCH] 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 --- core/libs/prx/libSceAvPlayer/src/Source.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/libs/prx/libSceAvPlayer/src/Source.cpp b/core/libs/prx/libSceAvPlayer/src/Source.cpp index c453be1bf..2b93a2eee 100644 --- a/core/libs/prx/libSceAvPlayer/src/Source.cpp +++ b/core/libs/prx/libSceAvPlayer/src/Source.cpp @@ -32,6 +32,7 @@ constexpr std::uint32_t VideoBufferAlignment = 0x100; constexpr std::uint32_t AudioBufferAlignment = 0x10; constexpr std::uint32_t AudioChunkSamples = 1024; constexpr std::uint32_t AudioMaxChannels = 8; +constexpr std::uint32_t VideoDecodeAheadFrames = 4; constexpr std::size_t VideoPacketLimit = 30; constexpr std::size_t AudioPacketLimit = 8; constexpr std::size_t AudioOnlyPacketLimit = 30; @@ -604,8 +605,8 @@ private: pitch = AlignUp(static_cast(decoder.context->width), VideoPitchAlignment); bufferHeight = AlignUp(static_cast(decoder.context->height), VideoHeightAlignment); decoder.bufferSize = pitch * bufferHeight * 3 / 2; - count = settings.videoBuffers; - decoder.retained = count > 3 ? count - 3 : 0; + count = settings.videoBuffers + VideoDecodeAheadFrames; + decoder.retained = settings.videoBuffers > 3 ? settings.videoBuffers - 3 : 0; texture = true; alignment = VideoBufferAlignment; } else {