Skip to content

msdk: fix for mfx frame alloc response

Both MSDK and this plugin use mfxFrameAllocResponse for video and DMABuf memory, it is possible that some GST buffers are still in use when calling gst_msdk_frame_free, so add a reference count in the wrapper of mfxFrameAllocResponse (GstMsdkAllocResponse) to make sure the underlying mfx resources are still available if the corresponding buffer pool is in use.

In addtion, currently all allocators for input or output share the same mfxFrameAllocResponse pointer in an element, so it is possible that the content of mfxFrameAllocResponse is updated for a new caps then all GST buffers allocated from an old allocator will use this new content of mfxFrameAllocResponse, which will result in unexpected behavior. In this fix, we save the the content of mfxFrameAllocResponse in the corresponding tructure to avoid such issue

Sample pipeline:

gst-launch-1.0 filesrc location=vp9_multi_resolutions.ivf ! ivfparse ! msdkvp9dec ! msdkvpp ! video/x-raw(memory:DMABuf),format=NV12 ! glimagesink

Merge request reports

Loading