Skip to content

Commit

Permalink
Merge pull request xbmc#18980 from thexai/dxva2-memory
Browse files Browse the repository at this point in the history
DXVA2: adjust memory limit for 4K decoding from 3000 MB to 2960 MB
  • Loading branch information
enen92 committed Dec 23, 2020
2 parents 6ba3449 + c56a4b6 commit 877b8b5
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 877b8b5

Please sign in to comment.