mediafoundation: return adjusted LTR frame (need to remove one for short term)

Reviewed-by: Yubo Xie <yuboxie@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37479>
This commit is contained in:
Pohsiang (John) Hsu 2025-09-18 15:22:25 -07:00 committed by Marge Bot
parent c3ca12af11
commit 04192362e5

View file

@ -675,7 +675,14 @@ CDX12EncHMFT::GetParameterValues( const GUID *Api, VARIANT **Values, ULONG *Valu
}
else if( *Api == CODECAPI_AVEncVideoLTRBufferControl )
{
*ValuesCount = m_EncoderCapabilities.m_uiMaxHWSupportedLongTermReferences + 1;
// reserve one dpb spot for short term reference frame.
// when m_EncoderCapabilities.m_uiMaxHWSupportedLongTermReferences = m_EncoderCapabilities.m_uiMaxHWSupportedDPBCapacity, we subtract one.
ULONG numSupportedLTR = m_EncoderCapabilities.m_uiMaxHWSupportedLongTermReferences;
if( numSupportedLTR > 0 && numSupportedLTR == m_EncoderCapabilities.m_uiMaxHWSupportedDPBCapacity )
{
numSupportedLTR -= 1;
}
*ValuesCount = numSupportedLTR + 1;
CHECKNULL_GOTO( *Values = (VARIANT *) CoTaskMemAlloc( ( *ValuesCount ) * sizeof( VARIANT ) ), E_OUTOFMEMORY, done );
for( ULONG i = 0; i < *ValuesCount; i++ )
{