summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>2015-10-30 11:18:47 +0100
committerVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>2015-11-09 16:18:19 +0100
commit7e9ee7f66d490ab11e0c1ba64bca97b71554b80d (patch)
tree20f4e034353af29b47b154e60a0c4595f2dc0d08
parentc20318d1982a3b071f633e2cb3473e0699851d62 (diff)
downloadgst-vaapi-7e9ee7f66d490ab11e0c1ba64bca97b71554b80d.tar.gz
vaapivideocontext: refactor context category debug
Refactor the extraction GST_CAT_CONTEXT logging using a only once initializator, so we could get the debug category from different code paths, safely. Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com> https://bugzilla.gnome.org/show_bug.cgi?id=757598
-rw-r--r--gst/vaapi/gstvaapivideocontext.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/gst/vaapi/gstvaapivideocontext.c b/gst/vaapi/gstvaapivideocontext.c
index 183e12a3..296fb1e5 100644
--- a/gst/vaapi/gstvaapivideocontext.c
+++ b/gst/vaapi/gstvaapivideocontext.c
@@ -39,6 +39,19 @@ G_DEFINE_BOXED_TYPE (GstVaapiDisplay, gst_vaapi_display,
(GBoxedCopyFunc) gst_vaapi_display_ref,
(GBoxedFreeFunc) gst_vaapi_display_unref);
+static void
+_init_context_debug (void)
+{
+#ifndef GST_DISABLE_GST_DEBUG
+ static volatile gsize _init = 0;
+
+ if (g_once_init_enter (&_init)) {
+ GST_DEBUG_CATEGORY_GET (GST_CAT_CONTEXT, "GST_CONTEXT");
+ g_once_init_leave (&_init, 1);
+ }
+#endif
+}
+
GstContext *
gst_vaapi_video_context_new_with_display (GstVaapiDisplay * display,
gboolean persistent)
@@ -79,6 +92,7 @@ context_pad_query (const GValue * item, GValue * value, gpointer user_data)
return FALSE;
}
+ _init_context_debug ();
GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, pad, "context pad peer query failed");
return TRUE;
}
@@ -118,8 +132,7 @@ gst_vaapi_video_context_prepare (GstElement * element)
GstQuery *query;
GstMessage *msg;
- if (!GST_CAT_CONTEXT)
- GST_DEBUG_CATEGORY_GET (GST_CAT_CONTEXT, "GST_CONTEXT");
+ _init_context_debug ();
/* 1) Check if the element already has a context of the specific
* type, i.e. it was previously set via
@@ -170,6 +183,7 @@ gst_vaapi_video_context_propagate (GstElement * element,
context = gst_vaapi_video_context_new_with_display (display, FALSE);
+ _init_context_debug ();
GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, element,
"posting `have-context' (%p) message with display (%p)",
context, display);