Skip to content

msdk: fix mfx surface leak

It is possible that an old GstMemory for a buffer is replaced by a new GstMemory and the old memory is freed. Without this patch, the mfx surface associated with the old memory won't be freed, hence the pre-allocated mfx surfaces will be exhausted

Example: gst-launch-1.0 videotestsrc ! msdkh264enc ! msdkh264dec ! 'video/x-raw(memory:DMABuf)' ! fakesink

0:00:00.074985440 25453 0x55ba70a09f20 ERROR default gstmsdkvideomemory.c:77:gst_msdk_video_allocator_get_surface: failed to get surface available 0:00:00.075045590 25453 0x55ba70a09f20 ERROR msdkbufferpool gstmsdkbufferpool.c:270:gst_msdk_buffer_pool_alloc_buffer: failed to create new MSDK memory

Merge request reports