mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 23:06:49 +00:00
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
This commit is contained in:
parent
c20318d198
commit
7e9ee7f66d
1 changed files with 16 additions and 2 deletions
|
@ -39,6 +39,19 @@ G_DEFINE_BOXED_TYPE (GstVaapiDisplay, gst_vaapi_display,
|
||||||
(GBoxedCopyFunc) gst_vaapi_display_ref,
|
(GBoxedCopyFunc) gst_vaapi_display_ref,
|
||||||
(GBoxedFreeFunc) gst_vaapi_display_unref);
|
(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 *
|
GstContext *
|
||||||
gst_vaapi_video_context_new_with_display (GstVaapiDisplay * display,
|
gst_vaapi_video_context_new_with_display (GstVaapiDisplay * display,
|
||||||
gboolean persistent)
|
gboolean persistent)
|
||||||
|
@ -79,6 +92,7 @@ context_pad_query (const GValue * item, GValue * value, gpointer user_data)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_init_context_debug ();
|
||||||
GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, pad, "context pad peer query failed");
|
GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, pad, "context pad peer query failed");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -118,8 +132,7 @@ gst_vaapi_video_context_prepare (GstElement * element)
|
||||||
GstQuery *query;
|
GstQuery *query;
|
||||||
GstMessage *msg;
|
GstMessage *msg;
|
||||||
|
|
||||||
if (!GST_CAT_CONTEXT)
|
_init_context_debug ();
|
||||||
GST_DEBUG_CATEGORY_GET (GST_CAT_CONTEXT, "GST_CONTEXT");
|
|
||||||
|
|
||||||
/* 1) Check if the element already has a context of the specific
|
/* 1) Check if the element already has a context of the specific
|
||||||
* type, i.e. it was previously set via
|
* 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);
|
context = gst_vaapi_video_context_new_with_display (display, FALSE);
|
||||||
|
|
||||||
|
_init_context_debug ();
|
||||||
GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, element,
|
GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, element,
|
||||||
"posting `have-context' (%p) message with display (%p)",
|
"posting `have-context' (%p) message with display (%p)",
|
||||||
context, display);
|
context, display);
|
||||||
|
|
Loading…
Reference in a new issue