GNOME Bugzilla – Bug 797314
in some cases, no log can be printed
Last modified: 2018-10-22 16:35:56 UTC
Below text is my local modify. It have already been tested in my environment. I can't understand what the code "(level) <= _gst_debug_min)"'s purpose. diff --git a/gst/gstinfo.h b/gst/gstinfo.h index 6816e9e..00c4772 100644 --- a/gst/gstinfo.h +++ b/gst/gstinfo.h @@ -635,7 +635,7 @@ GST_API GstDebugLevel _gst_debug_min; */ #ifdef G_HAVE_ISO_VARARGS #define GST_CAT_LEVEL_LOG(cat,level,object,...) G_STMT_START{ \ - if (G_UNLIKELY ((level) <= GST_LEVEL_MAX && (level) <= _gst_debug_min)) { \ + if (G_UNLIKELY ((level) <= GST_LEVEL_MAX && (level) >= _gst_debug_min)) { \ gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__, \ (GObject *) (object), __VA_ARGS__); \ } \ @@ -643,7 +643,7 @@ GST_API GstDebugLevel _gst_debug_min; #else /* G_HAVE_GNUC_VARARGS */ #ifdef G_HAVE_GNUC_VARARGS #define GST_CAT_LEVEL_LOG(cat,level,object,args...) G_STMT_START{ \ - if (G_UNLIKELY ((level) <= GST_LEVEL_MAX && (level) <= _gst_debug_min)) { \ + if (G_UNLIKELY ((level) <= GST_LEVEL_MAX && (level) >= _gst_debug_min)) { \ gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__, \ (GObject *) (object), ##args ); \ } \ @@ -653,7 +653,7 @@ static inline void GST_CAT_LEVEL_LOG_valist (GstDebugCategory * cat, GstDebugLevel level, gpointer object, const char *format, va_list varargs) { - if (G_UNLIKELY ((level) <= GST_LEVEL_MAX && (level) <= _gst_debug_min)) { + if (G_UNLIKELY ((level) <= GST_LEVEL_MAX && (level) >= _gst_debug_min)) { gst_debug_log_valist (cat, level, "", "", 0, (GObject *) object, format, varargs); } @@ -677,7 +677,7 @@ GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level, * with the other doc chunks below though. */ #define __GST_CAT_MEMDUMP_LOG(cat,object,msg,data,length) G_STMT_START{ \ if (G_UNLIKELY (GST_LEVEL_MEMDUMP <= GST_LEVEL_MAX && \ - GST_LEVEL_MEMDUMP <= _gst_debug_min)) { \ + GST_LEVEL_MEMDUMP >= _gst_debug_min)) { \ _gst_debug_dump_mem ((cat), __FILE__, GST_FUNCTION, __LINE__, \ (GObject *) (object), (msg), (data), (length)); \ } \
Can you provide this as a "git format-patch"-style patch? See https://gstreamer.freedesktop.org/documentation/contribute/index.html#how-to-submit-patches It doesn't look correct however. The comparison should be <= _gst_debug_min because that one is the global maximum (no idea why it is called min!) of all debug category levels that are enabled. How can the problem you observe be reproduced?
Created attachment 373997 [details] [review] Patch for this issue
Comment on attachment 373997 [details] [review] Patch for this issue As written above, this doesn't look correct. The comparison should be <= _gst_debug_min because that one is the global maximum (no idea why it is called min!) of all debug category levels that are enabled. How can the problem you observe be reproduced?
(In reply to Sebastian Dröge (slomo) from comment #1) > Can you provide this as a "git format-patch"-style patch? See > https://gstreamer.freedesktop.org/documentation/contribute/index.html#how-to- > submit-patches > > It doesn't look correct however. The comparison should be <= _gst_debug_min > because that one is the global maximum (no idea why it is called min!) of > all debug category levels that are enabled. > > How can the problem you observe be reproduced? Actually there have a MACRO GST_LEVEL_MAX, I think it means golbal maximum. From code, we can easy find the comment about _gst_debug_min. 617 /* the min debug level, used for quickly discarding debug 618 * messages that fall under the threshold. */ 619 620 GST_API GstDebugLevel _gst_debug_min; It's very easy to reproduce. Just enable gstreamer's debug and set debug level to a vaild value(eg:GST_LEVEL_DEBUG), you will find there is no info printing from your debugging code.
(In reply to Stephen Xiao from comment #4) > (In reply to Sebastian Dröge (slomo) from comment #1) > > Can you provide this as a "git format-patch"-style patch? See > > https://gstreamer.freedesktop.org/documentation/contribute/index.html#how-to- > > submit-patches > > > > It doesn't look correct however. The comparison should be <= _gst_debug_min > > because that one is the global maximum (no idea why it is called min!) of > > all debug category levels that are enabled. > > > > How can the problem you observe be reproduced? > > Actually there have a MACRO GST_LEVEL_MAX, I think it means golbal maximum. Yes, that's fine. If GST_LEVEL_MAX is e.g. WARNING, then that means that everything apart from WARNING and ERROR is compiled out statically. > From code, we can easy find the comment about _gst_debug_min. > > 617 /* the min debug level, used for quickly discarding debug > > 618 * messages that fall under the threshold. */ > > 619 > > 620 GST_API GstDebugLevel _gst_debug_min; It's a bit misnamed. If you enable category A with level WARNING, it will be WARNING. If you then enable category B with level DEBUG it will be DEBUG. Enabling category C with level FIXME does not change anything, enabling category D with level MEMDUMP will change it to MEMDUMP. It's the maximum of any category that is currently enabled. > It's very easy to reproduce. Just enable gstreamer's debug and set debug > level to a vaild value(eg:GST_LEVEL_DEBUG), you will find there is no info > printing from your debugging code. That works fine for me. Can you provide exact steps how to reproduce it? What behaviour do you see, what would you expect instead?
(In reply to Sebastian Dröge (slomo) from comment #5) > (In reply to Stephen Xiao from comment #4) > > (In reply to Sebastian Dröge (slomo) from comment #1) > > > Can you provide this as a "git format-patch"-style patch? See > > > https://gstreamer.freedesktop.org/documentation/contribute/index.html#how-to- > > > submit-patches > > > > > > It doesn't look correct however. The comparison should be <= _gst_debug_min > > > because that one is the global maximum (no idea why it is called min!) of > > > all debug category levels that are enabled. > > > > > > How can the problem you observe be reproduced? > > > > Actually there have a MACRO GST_LEVEL_MAX, I think it means golbal maximum. > > Yes, that's fine. If GST_LEVEL_MAX is e.g. WARNING, then that means that > everything apart from WARNING and ERROR is compiled out statically. > > > From code, we can easy find the comment about _gst_debug_min. > > > > 617 /* the min debug level, used for quickly discarding debug > > > > 618 * messages that fall under the threshold. */ > > > > 619 > > > > 620 GST_API GstDebugLevel _gst_debug_min; > > It's a bit misnamed. If you enable category A with level WARNING, it will be > WARNING. If you then enable category B with level DEBUG it will be DEBUG. > Enabling category C with level FIXME does not change anything, enabling > category D with level MEMDUMP will change it to MEMDUMP. > > It's the maximum of any category that is currently enabled. > > > It's very easy to reproduce. Just enable gstreamer's debug and set debug > > level to a vaild value(eg:GST_LEVEL_DEBUG), you will find there is no info > > printing from your debugging code. > > That works fine for me. Can you provide exact steps how to reproduce it? > What behaviour do you see, what would you expect instead? Oh, thanks to your explation. I just find that the code is right, it's my mistake. : ) _gst_debug_min is a variable not a MACRO. Thanks to your patience again!
Do you observe a problem in practice or was this just a misunderstanding of the code?
(In reply to Sebastian Dröge (slomo) from comment #7) > Do you observe a problem in practice or was this just a misunderstanding of > the code? It's a misunderstanding of the code. BTW, the name "_gst_debug_min" really confused me. Now, it can work fine in my environment too.