From: Sangchul Lee Date: Thu, 26 Aug 2021 05:57:06 +0000 (+0900) Subject: webrtc_ini: Add new item for verbose logging X-Git-Tag: submit/tizen/20210827.093546~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aec25abd5a39e064e0ba91c403577a178924b758;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_ini: Add new item for verbose logging [general] verbose log = yes or no LOG_VERBOSE() macro is also added. [Version] 0.2.83 [Issue Type] New feature Change-Id: I84d74b99496e1062445ef49423b6b9a643534286 Signed-off-by: Sangchul Lee --- diff --git a/include/webrtc_private.h b/include/webrtc_private.h index 9c0fbcc3..4f671081 100644 --- a/include/webrtc_private.h +++ b/include/webrtc_private.h @@ -53,6 +53,13 @@ extern "C" { #define FONT_COLOR_CYAN "\033[36m" #define FONT_COLOR_GRAY "\033[37m" +extern bool g_verbose; +#define LOG_VERBOSE(fmt, arg...) \ +do { \ + if (g_verbose) \ + LOGD(FONT_COLOR_RESET""fmt""FONT_COLOR_RESET, ##arg); \ +} while (0) + #define LOG_DEBUG(fmt, arg...) \ do { \ LOGD(FONT_COLOR_RESET""fmt""FONT_COLOR_RESET, ##arg); \ @@ -261,6 +268,7 @@ typedef struct _webrtc_resource_s { typedef struct _ini_item_general_s { bool generate_dot; const char *dot_path; + bool verbose_log; gchar **gst_args; gchar **gst_excluded_elements; const char *stun_server; diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index fc67b278..79ac6372 100644 --- a/packaging/capi-media-webrtc.spec +++ b/packaging/capi-media-webrtc.spec @@ -1,6 +1,6 @@ Name: capi-media-webrtc Summary: A WebRTC library in Tizen Native API -Version: 0.2.82 +Version: 0.2.83 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_ini.c b/src/webrtc_ini.c index af4ef793..5f5c6315 100644 --- a/src/webrtc_ini.c +++ b/src/webrtc_ini.c @@ -17,9 +17,12 @@ #include "webrtc_internal.h" #include "webrtc_private.h" +bool g_verbose = false; + #define WEBRTC_INI_PATH SYSCONFDIR"/multimedia/mmfw_webrtc.ini" #define DEFAULT_GENERATE_DOT true #define DEFAULT_DOT_PATH "/tmp" +#define DEFAULT_VERBOSE_LOG false #define DEFAULT_JITTERBUFFER_LATENCY 200 /* ms */ /* categories */ @@ -41,6 +44,7 @@ /* items for general */ #define INI_ITEM_DOT_PATH "dot path" #define INI_ITEM_DOT_GENERATE "generate dot" +#define INI_ITEM_VERBOSE_LOG "verbose log" #define INI_ITEM_GST_ARGS "gstreamer arguments" #define INI_ITEM_GST_EXCLUDED_ELEMENTS "gstreamer excluded elements" #define INI_ITEM_STUN_SERVER "stun server" @@ -204,6 +208,7 @@ static void __dump_ini(webrtc_ini_s *ini) LOG_INFO("[%s]", INI_CATEGORY_GENERAL); __dump_item(INI_ITEM_DOT_GENERATE, INI_ITEM_TYPE_BOOL, &ini->general.generate_dot); __dump_item(INI_ITEM_DOT_PATH, INI_ITEM_TYPE_STRING, (void *)ini->general.dot_path); + __dump_item(INI_ITEM_VERBOSE_LOG, INI_ITEM_TYPE_BOOL, &ini->general.verbose_log); __dump_item(INI_ITEM_GST_ARGS, INI_ITEM_TYPE_STRINGS, ini->general.gst_args); __dump_item(INI_ITEM_GST_EXCLUDED_ELEMENTS, INI_ITEM_TYPE_STRINGS, ini->general.gst_excluded_elements); __dump_item(INI_ITEM_STUN_SERVER, INI_ITEM_TYPE_STRING, (void *)ini->general.stun_server); @@ -434,6 +439,7 @@ int _load_ini(webrtc_s *webrtc) LOG_INFO("dot file will be stored in [%s]", ini->general.dot_path); g_setenv("GST_DEBUG_DUMP_DOT_DIR", ini->general.dot_path, FALSE); } + ini->general.verbose_log = g_verbose = __ini_get_boolean(ini->dict, INI_CATEGORY_GENERAL, INI_ITEM_VERBOSE_LOG, DEFAULT_VERBOSE_LOG); __ini_read_list(ini->dict, INI_CATEGORY_GENERAL, INI_ITEM_GST_ARGS, &ini->general.gst_args); __ini_read_list(ini->dict, INI_CATEGORY_GENERAL, INI_ITEM_GST_EXCLUDED_ELEMENTS, &ini->general.gst_excluded_elements); ini->general.stun_server = __ini_get_string(ini->dict, INI_CATEGORY_GENERAL, INI_ITEM_STUN_SERVER, NULL);