aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthexai <58434170+thexai@users.noreply.github.com>2024-02-13 17:39:37 +0100
committerthexai <58434170+thexai@users.noreply.github.com>2024-02-13 17:39:37 +0100
commitec79fcc1169e5062b616689ec18d6e2fad975b1b (patch)
treeecc14cb58864fe0f8e2f615841eedb1d3acef150
parent18a5d7b662377b2ef40a5dcc9637bda4a9fc1aac (diff)
DXVA: Use at least 8 surfaces for H.264 decoding
-rw-r--r--xbmc/cores/VideoPlayer/DVDCodecs/Video/DXVA.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DXVA.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DXVA.cpp
index 7236b549ff..5bd64499fb 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DXVA.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DXVA.cpp
@@ -29,6 +29,7 @@
#include "utils/SystemInfo.h"
#include "utils/log.h"
+#include <algorithm>
#include <mutex>
#include <Windows.h>
@@ -1376,7 +1377,8 @@ bool CDecoder::Open(AVCodecContext* avctx, AVCodecContext* mainctx, enum AVPixel
break;
case AV_CODEC_ID_H264:
// by specification h264 decoder can hold up to 16 unique refs
- m_refs += avctx->refs ? avctx->refs : 16;
+ // but use 8 at least to avoid potential issues in some rare streams
+ m_refs += std::max(8, avctx->refs ? avctx->refs : 16);
break;
case AV_CODEC_ID_VP9:
m_refs += 8;