[Decode] Add more conditons check for AV1 reference frame index
In order to fix memleak issue on VPL AV1,pr is intel-innersource/drivers.gpu.media.sdk.lib#6691, we will not allocate surfaces for 1s frame. Thus need driver need to do change , otherwise it will return invalid parameter for 1st frame
diff --git a/media_driver/linux/common/codec/ddi/media_ddi_decode_av1.cpp b/media_driver/linux/common/codec/ddi/media_ddi_decode_av1.cpp
index 1be4ca2..cf982fe 100644
--- a/media_driver/linux/common/codec/ddi/media_ddi_decode_av1.cpp
+++ b/media_driver/linux/common/codec/ddi/media_ddi_decode_av1.cpp
@@ -227,9 +227,14 @@
if (picParam->ref_frame_map[i] < mediaCtx->uiNumSurfaces)
{
frameIdx = GetRenderTargetID(&m_ddiDecodeCtx->RTtbl, refSurface);
- if (frameIdx == DDI_CODEC_INVALID_FRAME_INDEX) {
- return VA_STATUS_ERROR_INVALID_PARAMETER;
+
+ if ((frameIdx == DDI_CODEC_INVALID_FRAME_INDEX) &&
+ (picParam->pic_info_fields.bits.frame_type != keyFrame) &&
+ (picParam->pic_info_fields.bits.frame_type != intraOnlyFrame))
+ {
+ return VA_STATUS_ERROR_INVALID_PARAMETER;
}
+
picAV1Params->m_refFrameMap[i].FrameIdx = ((uint32_t)frameIdx >= CODECHAL_NUM_UNCOMPRESSED_SURFACE_AV1) ?
(CODECHAL_NUM_UNCOMPRESSED_SURFACE_AV1 - 1) : frameIdx;
}