GNOME Bugzilla – Bug 772921
debug log categories registered later can not be filtered for
Last modified: 2016-12-30 11:38:34 UTC
In the base libs we lazily create debug log categories: https://cgit.freedesktop.org/gstreamer/gst-plugins-base/tree/gst-libs/gst/audio/audio.c#n35 The downside of this is that e.g. GST_DEBUG="audio:5" won't work, but GST_DEBUG="audio*:5" works (although it will show too much). Some options I can see is to try to re-eval the filter expr, when a new cat is registered. From gstinfo.c: _priv_gst_debug_init() env = g_getenv ("GST_DEBUG"); if (env) { gst_debug_set_threshold_from_string (env, FALSE); } Or we use library constructors. This would need some work to make it cross platform though.
Re-eval filter expression when new cat is registered seems fine to me? Constructors sound painful.
Created attachment 342554 [details] [review] re-eval GST_DEBUG env var for late categories This become a little more complicated. Repro: GST_DEBUG="audio:5" gst-launch audiotestsrc num-buffers=2 ! audioresample ! autoaudiosink after the patch you see the debug log messages. Since we use this pattern in 20 places, it is probably a good idea to fix it. ../gst-plugins-bad/gst-libs/gst/codecparsers/gstjpegparser.c ../gst-plugins-bad/gst-libs/gst/codecparsers/gstvc1parser.c ../gst-plugins-bad/gst-libs/gst/codecparsers/gstmpeg4parser.c ../gst-plugins-base/gst-libs/gst/video/video-info.c ../gst-plugins-base/gst-libs/gst/video/video-color.c ../gst-plugins-base/gst-libs/gst/video/video-resampler.c ../gst-plugins-base/gst-libs/gst/video/video-converter.c ../gst-plugins-base/gst-libs/gst/video/gstvideometa.c ../gst-plugins-base/gst-libs/gst/video/video-overlay-composition.c ../gst-plugins-base/gst-libs/gst/video/video-blend.c ../gst-plugins-base/gst-libs/gst/video/video-chroma.c ../gst-plugins-base/gst-libs/gst/video/video-scaler.c ../gst-plugins-base/gst-libs/gst/audio/audio-channels.c ../gst-plugins-base/gst-libs/gst/audio/audio-channel-mixer.c ../gst-plugins-base/gst-libs/gst/audio/audio-converter.c ../gst-plugins-base/gst-libs/gst/audio/audio.c ../gst-plugins-base/gst-libs/gst/audio/audio-info.c ../gst-plugins-base/gst-libs/gst/tag/licenses.c ../gst-plugins-base/gst-libs/gst/tag/lang.c ../gst-plugins-base/gst-libs/gst/tag/id3v2.c
> This become a little more complicated. Can you describe the problem so we don't have to apply the patch to reproduce it? :) I take it it's related to the lazy-registered debug categories?
Created attachment 342619 [details] [review] re-eval GST_DEBUG env var for late categories