From b054da4c96c0a8ec5d549f4c1724668b8c56a59d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 23 May 2016 20:11:17 +0300 Subject: [PATCH] eglimage: Ensure that the debug category is always initalized Before the initializer was only run if dmabuf support was used. https://bugzilla.gnome.org/show_bug.cgi?id=766794 --- gst-libs/gst/gl/egl/gsteglimage.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/gst-libs/gst/gl/egl/gsteglimage.c b/gst-libs/gst/gl/egl/gsteglimage.c index 7e6dfd6..9904164 100644 --- a/gst-libs/gst/gl/egl/gsteglimage.c +++ b/gst-libs/gst/gl/egl/gsteglimage.c @@ -65,23 +65,25 @@ #define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274 #endif -GST_DEBUG_CATEGORY_STATIC (GST_CAT_EGL_IMAGE); -#define GST_CAT_DEFAULT GST_CAT_EGL_IMAGE +#ifndef GST_DISABLE_GST_DEBUG +#define GST_CAT_DEFAULT gst_egl_image_ensure_debug_category() -GST_DEFINE_MINI_OBJECT_TYPE (GstEGLImage, gst_egl_image); - -static void -_init_debug (void) +static GstDebugCategory * +gst_egl_image_ensure_debug_category (void) { - static volatile gsize _init = 0; + static gsize cat_gonce = 0; + + if (g_once_init_enter (&cat_gonce)) { + GstDebugCategory *cat = NULL; - if (g_once_init_enter (&_init)) { - GST_DEBUG_CATEGORY_INIT (GST_CAT_EGL_IMAGE, "gleglimage", 0, - "EGLImage wrapper"); + GST_DEBUG_CATEGORY_INIT (cat, "gleglimage", 0, "EGLImage wrapper"); - g_once_init_leave (&_init, 1); + g_once_init_leave (&cat_gonce, (gsize) cat); } + + return (GstDebugCategory *) cat_gonce; } +#endif /* GST_DISABLE_GST_DEBUG */ EGLImageKHR gst_egl_image_get_image (GstEGLImage * image) @@ -174,8 +176,6 @@ _drm_fourcc_from_info (GstVideoInfo * info, int plane) const gint rg_fourcc = DRM_FORMAT_RG88; #endif - _init_debug (); - GST_DEBUG ("Getting DRM fourcc for %s plane %i", gst_video_format_to_string (format), plane); -- 2.7.4