mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-02 21:48:55 +00:00
info: Don't use GST_DEBUG() in gst_debug_add_log_function() and related functions unconditionally
If GStreamer was not initialized yet this will cause g_warnings().
This commit is contained in:
parent
d86ecaf53e
commit
32d7d5923b
1 changed files with 19 additions and 11 deletions
|
@ -129,6 +129,8 @@
|
||||||
|
|
||||||
#endif /* !GST_DISABLE_GST_DEBUG */
|
#endif /* !GST_DISABLE_GST_DEBUG */
|
||||||
|
|
||||||
|
extern gboolean gst_is_initialized (void);
|
||||||
|
|
||||||
/* we want these symbols exported even if debug is disabled, to maintain
|
/* we want these symbols exported even if debug is disabled, to maintain
|
||||||
* ABI compatibility. Unless GST_REMOVE_DISABLED is defined. */
|
* ABI compatibility. Unless GST_REMOVE_DISABLED is defined. */
|
||||||
#if !defined(GST_DISABLE_GST_DEBUG) || !defined(GST_REMOVE_DISABLED)
|
#if !defined(GST_DISABLE_GST_DEBUG) || !defined(GST_REMOVE_DISABLED)
|
||||||
|
@ -1104,6 +1106,7 @@ gst_debug_add_log_function (GstLogFunction func, gpointer user_data,
|
||||||
__log_functions = g_slist_prepend (list, entry);
|
__log_functions = g_slist_prepend (list, entry);
|
||||||
g_mutex_unlock (&__log_func_mutex);
|
g_mutex_unlock (&__log_func_mutex);
|
||||||
|
|
||||||
|
if (gst_is_initialized ())
|
||||||
GST_DEBUG ("prepended log function %p (user data %p) to log functions",
|
GST_DEBUG ("prepended log function %p (user data %p) to log functions",
|
||||||
func, user_data);
|
func, user_data);
|
||||||
}
|
}
|
||||||
|
@ -1180,6 +1183,7 @@ gst_debug_remove_log_function (GstLogFunction func)
|
||||||
removals =
|
removals =
|
||||||
gst_debug_remove_with_compare_func
|
gst_debug_remove_with_compare_func
|
||||||
(gst_debug_compare_log_function_by_func, (gpointer) func);
|
(gst_debug_compare_log_function_by_func, (gpointer) func);
|
||||||
|
if (gst_is_initialized ())
|
||||||
GST_DEBUG ("removed log function %p %d times from log function list", func,
|
GST_DEBUG ("removed log function %p %d times from log function list", func,
|
||||||
removals);
|
removals);
|
||||||
|
|
||||||
|
@ -1202,6 +1206,8 @@ gst_debug_remove_log_function_by_data (gpointer data)
|
||||||
removals =
|
removals =
|
||||||
gst_debug_remove_with_compare_func
|
gst_debug_remove_with_compare_func
|
||||||
(gst_debug_compare_log_function_by_data, data);
|
(gst_debug_compare_log_function_by_data, data);
|
||||||
|
|
||||||
|
if (gst_is_initialized ())
|
||||||
GST_DEBUG
|
GST_DEBUG
|
||||||
("removed %d log functions with user data %p from log function list",
|
("removed %d log functions with user data %p from log function list",
|
||||||
removals, data);
|
removals, data);
|
||||||
|
@ -1311,6 +1317,7 @@ gst_debug_reset_threshold (gpointer category, gpointer unused)
|
||||||
|
|
||||||
walk = g_slist_next (walk);
|
walk = g_slist_next (walk);
|
||||||
if (g_pattern_match_string (entry->pat, cat->name)) {
|
if (g_pattern_match_string (entry->pat, cat->name)) {
|
||||||
|
if (gst_is_initialized ())
|
||||||
GST_LOG ("category %s matches pattern %p - gets set to level %d",
|
GST_LOG ("category %s matches pattern %p - gets set to level %d",
|
||||||
cat->name, entry->pat, entry->level);
|
cat->name, entry->pat, entry->level);
|
||||||
gst_debug_category_set_threshold (cat, entry->level);
|
gst_debug_category_set_threshold (cat, entry->level);
|
||||||
|
@ -1338,6 +1345,7 @@ for_each_threshold_by_entry (gpointer data, gpointer user_data)
|
||||||
LevelNameEntry *entry = (LevelNameEntry *) user_data;
|
LevelNameEntry *entry = (LevelNameEntry *) user_data;
|
||||||
|
|
||||||
if (g_pattern_match_string (entry->pat, cat->name)) {
|
if (g_pattern_match_string (entry->pat, cat->name)) {
|
||||||
|
if (gst_is_initialized ())
|
||||||
GST_LOG ("category %s matches pattern %p - gets set to level %d",
|
GST_LOG ("category %s matches pattern %p - gets set to level %d",
|
||||||
cat->name, entry->pat, entry->level);
|
cat->name, entry->pat, entry->level);
|
||||||
gst_debug_category_set_threshold (cat, entry->level);
|
gst_debug_category_set_threshold (cat, entry->level);
|
||||||
|
|
Loading…
Reference in a new issue