msdkallocator_d3d: add gst_msdk_frame_free callback function

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4088>
This commit is contained in:
Tong Wu 2022-11-17 10:41:10 +08:00 committed by GStreamer Marge Bot
parent abe4d0046a
commit 123c8d14c1

View file

@ -191,6 +191,22 @@ error_alloc:
mfxStatus
gst_msdk_frame_free (mfxHDL pthis, mfxFrameAllocResponse * resp)
{
GstMsdkContext *context = (GstMsdkContext *) pthis;
GstMsdkAllocResponse *cached = NULL;
cached = gst_msdk_context_get_cached_alloc_responses (context, resp);
if (cached) {
if (!g_atomic_int_dec_and_test (&cached->refcount))
return MFX_ERR_NONE;
} else
return MFX_ERR_NONE;
if (!gst_msdk_context_remove_alloc_response (context, resp))
return MFX_ERR_NONE;
g_slice_free1 (resp->NumFrameActual * sizeof (mfxMemId), resp->mids);
return MFX_ERR_NONE;
}