diff --git a/media_driver/linux/common/ddi/media_libva.cpp b/media_driver/linux/common/ddi/media_libva.cpp index 2b605009082..deabcc28090 100755 --- a/media_driver/linux/common/ddi/media_libva.cpp +++ b/media_driver/linux/common/ddi/media_libva.cpp @@ -3039,7 +3039,12 @@ VAStatus DdiMedia_MapBufferInternal ( if ((nullptr != buf->pSurface) && (Media_Format_CPU != buf->format)) { - DDI_CHK_RET(DdiMedia_MediaMemoryDecompress(mediaCtx, buf->pSurface),"MMD unsupported!"); + VAStatus tmpRet = DdiMedia_MediaMemoryDecompress(mediaCtx, buf->pSurface); + if (tmpRet != VA_STATUS_SUCCESS) + { + DdiMediaUtil_UnLockMutex(&mediaCtx->BufferMutex); + } + DDI_CHK_RET(tmpRet,"MMD unsupported!"); } *pbuf = DdiMediaUtil_LockBuffer(buf, flag); @@ -3804,6 +3809,10 @@ VAStatus DdiMedia_QuerySurfaceError( //&& surface->curStatusReport.decode.status == CODECHAL_STATUS_SUCCESSFUL) // get the crc value whatever the status is { CodechalDecode *decoder = dynamic_cast(decCtx->pCodecHal); + if (decoder == nullptr) + { + DdiMediaUtil_UnLockMutex(&mediaCtx->SurfaceMutex); + } DDI_CHK_NULL(decoder, "nullptr codechal decoder", VA_STATUS_ERROR_INVALID_CONTEXT); if (decoder->GetStandard() != CODECHAL_AVC) { diff --git a/media_driver/linux/common/ddi/media_libva_common.cpp b/media_driver/linux/common/ddi/media_libva_common.cpp index 734540b8989..2d3b1b716ab 100644 --- a/media_driver/linux/common/ddi/media_libva_common.cpp +++ b/media_driver/linux/common/ddi/media_libva_common.cpp @@ -413,7 +413,7 @@ PDDI_MEDIA_SURFACE DdiMedia_ReplaceSurfaceWithNewFormat(PDDI_MEDIA_SURFACE surfa surfaceElement->pSurface = dstSurface; DdiMediaUtil_UnLockMutex(&mediaCtx->SurfaceMutex); - + DdiMediaUtil_UnLockMutex(&mediaCtx->SurfaceMutex); return dstSurface; }