From 3540dcf4d98120c0596eabbec3025dfce322585a Mon Sep 17 00:00:00 2001 From: He Junyan Date: Sun, 16 Aug 2020 01:57:15 +0800 Subject: [PATCH] plugin: allocator: No need to ref allocator when create mem. We do not need to ref the allocator when creating GstVaapiVideoMemory kind memory, and then release it in _free(). The framework already does it for us. Part-of: --- gst/vaapi/gstvaapivideomemory.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gst/vaapi/gstvaapivideomemory.c b/gst/vaapi/gstvaapivideomemory.c index 48f42ab211..abf9715777 100644 --- a/gst/vaapi/gstvaapivideomemory.c +++ b/gst/vaapi/gstvaapivideomemory.c @@ -367,7 +367,7 @@ gst_vaapi_video_memory_new (GstAllocator * base_allocator, vip = &allocator->image_info; gst_memory_init (&mem->parent_instance, GST_MEMORY_FLAG_NO_SHARE, - gst_object_ref (allocator), NULL, GST_VIDEO_INFO_SIZE (vip), 0, + base_allocator, NULL, GST_VIDEO_INFO_SIZE (vip), 0, 0, GST_VIDEO_INFO_SIZE (vip)); mem->proxy = NULL; @@ -607,7 +607,6 @@ gst_vaapi_video_allocator_free (GstAllocator * allocator, GstMemory * base_mem) gst_vaapi_video_memory_reset_image (mem); gst_vaapi_surface_proxy_replace (&mem->proxy, NULL); gst_vaapi_video_meta_replace (&mem->meta, NULL); - gst_object_unref (GST_MEMORY_CAST (mem)->allocator); g_mutex_clear (&mem->lock); g_slice_free (GstVaapiVideoMemory, mem); }