Skip to content

Commit

Permalink
DXVA2: adjust memory limit for 4K decoding from 3000 MB to 2960 MB
Browse files Browse the repository at this point in the history
Change fallback strategy to limit decoder surfaces to 16 instead of exit
  • Loading branch information
thexai committed Dec 23, 2020
1 parent 95ec740 commit c56a4b6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions xbmc/cores/VideoPlayer/DVDCodecs/Video/DXVA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
// which we don't use here
#define FF_API_OLD_SAMPLE_FMT 0

#define LIMIT_VIDEO_MEMORY_4K 2960ull

#include "DXVA.h"

#include "ServiceBroker.h"
Expand Down Expand Up @@ -1221,12 +1223,12 @@ bool CDecoder::Open(AVCodecContext* avctx, AVCodecContext* mainctx, enum AVPixel
}

// Check if available video memory is sufficient for 4K decoding (is need ~3000 MB)
if (avctx->width >= 3840 && m_refs > 16 && videoMem < (3000ull * MB))
if (avctx->width >= 3840 && m_refs > 16 && videoMem < (LIMIT_VIDEO_MEMORY_4K * MB))
{
CLog::LogF(LOGWARNING,
"Current available video memory ({} MB) is insufficient 4K video decoding (DXVA2) "
"using {} surfaces. Fallback to SW decode.", videoMem / MB, m_refs);
return false;
"using {} surfaces. Decoder surfaces has been limited to 16.", videoMem / MB, m_refs);
m_refs = 16;
}

/* On the Xbox 1/S with limited memory we have to
Expand Down

0 comments on commit c56a4b6

Please sign in to comment.