diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2017-08-11 01:05:12 +0300 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2017-08-11 17:22:40 +0300 |
commit | e7b57278884facb189f44830215c8019ad753fe2 (patch) | |
tree | 19e58c8414dc275884ed85edc9faa4db42d426a0 /decoder | |
parent | 465f06e157379521bcda5a8220e658d9a5a41f14 (diff) |
Cap the number of samples to 127 in the allocator.
DXVA data structures require to store the surface index in 7-bit.
Diffstat (limited to 'decoder')
-rw-r--r-- | decoder/LAVVideo/LAVVideo.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/decoder/LAVVideo/LAVVideo.cpp b/decoder/LAVVideo/LAVVideo.cpp index 97ccee30..936471a0 100644 --- a/decoder/LAVVideo/LAVVideo.cpp +++ b/decoder/LAVVideo/LAVVideo.cpp @@ -514,8 +514,9 @@ HRESULT CLAVVideo::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERT CMediaType &mtOut = m_pOutput->CurrentMediaType(); videoFormatTypeHandler(mtOut, &pBIH); + // try to honor the requested number of downstream buffers, but cap at 127, because the amount needs to fit into 7-bit for DXVA decoding long downstreamBuffers = pProperties->cBuffers; - pProperties->cBuffers = max(pProperties->cBuffers, 2) + m_Decoder.GetBufferCount(); + pProperties->cBuffers = min(max(pProperties->cBuffers, 2) + m_Decoder.GetBufferCount(), 127); pProperties->cbBuffer = pBIH ? pBIH->biSizeImage : 3110400; pProperties->cbAlign = 1; pProperties->cbPrefix = 0; |