From 26b528e5f947151f9df9191f294e1608ea11a564 Mon Sep 17 00:00:00 2001 From: Yalu Zhang <yalu.zhang@iopsys.eu> Date: Wed, 31 Jan 2024 17:01:47 +0100 Subject: [PATCH] Fix a bug that RTP/RTCP log messages are shown even if RTP/RTCP debug is disabled --- include/asterisk/rtp_engine.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/include/asterisk/rtp_engine.h b/include/asterisk/rtp_engine.h index 164cfec764..0f1e081b80 100644 --- a/include/asterisk/rtp_engine.h +++ b/include/asterisk/rtp_engine.h @@ -2907,7 +2907,11 @@ uintmax_t ast_debug_category_ice_id(void); * \param ... String format and any associated arguments */ #define ast_debug_rtp(sublevel, ...) \ - ast_debug_category(sublevel, AST_DEBUG_CATEGORY_RTP, __VA_ARGS__) + do { \ + if (ast_debug_rtp_packet_is_allowed) { \ + ast_debug_category(sublevel, AST_DEBUG_CATEGORY_RTP_PACKET, __VA_ARGS__); \ + } \ + } while (0) /* Allow logging of RTP? */ #define ast_debug_rtp_is_allowed \ @@ -2924,7 +2928,11 @@ uintmax_t ast_debug_category_ice_id(void); * \param ... String format and any associated arguments */ #define ast_debug_rtcp(sublevel, ...) \ - ast_debug_category(sublevel, AST_DEBUG_CATEGORY_RTCP, __VA_ARGS__) + do { \ + if (ast_debug_rtcp_packet_is_allowed) { \ + ast_debug_category(sublevel, AST_DEBUG_CATEGORY_RTCP_PACKET, __VA_ARGS__); \ + } \ + } while (0) /* Allow logging of RTCP? */ #define ast_debug_rtcp_is_allowed \ -- GitLab