GNOME Bugzilla – Bug 751538
info: gst_debug_log_default() function can't be removed before gst_init()
Last modified: 2016-03-26 11:48:44 UTC
Created attachment 306162 [details] [review]
Patch to only add the default logger in gst_init if no loggers have been added yet.
When trying to only use external logging functions, the user might try to add its own log handler and remove the default logging function before gst_init (e.g. see http://cgit.freedesktop.org/gstreamer/cerbero/tree/data/ndk-build/gstreamer_android-1.0.c.in#n482). However, because gst_init (i.e. _priv_gst_debug_init, gstinfo.c) unconditionally adds the gst_debug_log_default function to the list of active loggers, the default log handlers is still being added and additionally used later on.
This could be partially worked around by removing gst_debug_log_default after gst_init (notice, though that removal of log functions might be racy, see 751440), but that would still cause logging during gst_init to be logged to the default logger.
I have attached a patch for a simple solution for this use case: Only add the default log function during gst_init if no log function has been added by the user yet.
Created attachment 322693 [details] [review]
[alternative patch] info: make it possible to remove default log handler before gst_init()
I'd rather do something like this, which doesn't break current behaviour.
looks good :)
Author: Tim-Philipp Müller <firstname.lastname@example.org>
Date: Mon Feb 29 19:04:16 2016 +0000
info: make it possible to remove default log handler before gst_init()
Make sure it's not even added then, so that we never output
anything via the default log handler then.