From 07f459caa4e2cd7ed539a0ab1d49bb94308c5b20 Mon Sep 17 00:00:00 2001 From: He Junyan Date: Sat, 15 Feb 2020 01:19:29 +0800 Subject: [PATCH] libs: dmabuf: init the GST_CAT_DEFAULT in type define. To avoid `gst_debug_log_valist: assertion 'category != NULL' failed` if we do not call gst_dmabuf_allocator_new --- gst-libs/gst/allocators/gstdmabuf.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gst-libs/gst/allocators/gstdmabuf.c b/gst-libs/gst/allocators/gstdmabuf.c index fbe5ec3994..3f4eaa9e48 100644 --- a/gst-libs/gst/allocators/gstdmabuf.c +++ b/gst-libs/gst/allocators/gstdmabuf.c @@ -42,7 +42,12 @@ GST_DEBUG_CATEGORY_STATIC (dmabuf_debug); #define GST_CAT_DEFAULT dmabuf_debug -G_DEFINE_TYPE (GstDmaBufAllocator, gst_dmabuf_allocator, GST_TYPE_FD_ALLOCATOR); +#define _do_init \ + GST_DEBUG_CATEGORY_INIT (dmabuf_debug, \ + "dmabuf", 0, "dmabuf memory"); + +G_DEFINE_TYPE_WITH_CODE (GstDmaBufAllocator, gst_dmabuf_allocator, + GST_TYPE_FD_ALLOCATOR, _do_init); static gpointer gst_dmabuf_mem_map (GstMemory * gmem, GstMapInfo * info, gsize maxsize) @@ -127,8 +132,6 @@ gst_dmabuf_allocator_new (void) { GstAllocator *alloc; - GST_DEBUG_CATEGORY_INIT (dmabuf_debug, "dmabuf", 0, "dmabuf memory"); - alloc = g_object_new (GST_TYPE_DMABUF_ALLOCATOR, NULL); gst_object_ref_sink (alloc);