[FFmpeg-devel] [PATCH 1/2] avutil/internal: Add ff_elog()

Michael Niedermayer michael at niedermayer.cc
Wed Feb 22 20:16:46 EET 2017


This enables the extra error messages in case of DEBUG or high assrtion levels.
High assertion levels imply slow checks in inner loops so any extra error should
be insignificant.
Is it preferred to have a separate switch for ff_elog() so it doesnt depend on
DEBUG/assertion level ?

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavutil/internal.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavutil/internal.h b/libavutil/internal.h
index 7780a9a791..208f8f474f 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -262,6 +262,12 @@ void avpriv_request_sample(void *avc,
 #   define ff_dlog(ctx, ...) do { if (0) av_log(ctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0)
 #endif
 
+#if defined(DEBUG) || ASSERT_LEVEL > 1
+#   define ff_elog(ctx, ...) av_log(ctx, AV_LOG_ERROR, __VA_ARGS__)
+#else
+#   define ff_elog(ctx, ...) do { if (0) av_log(ctx, AV_LOG_ERROR, __VA_ARGS__); } while (0)
+#endif
+
 // For debuging we use signed operations so overflows can be detected (by ubsan)
 // For production we use unsigned so there are no undefined operations
 #ifdef CHECKED
-- 
2.11.0



More information about the ffmpeg-devel mailing list