From: Sangchul Lee Date: Tue, 27 Dec 2022 08:01:55 +0000 (+0900) Subject: webrtc_ini: Add new item to enable to conceal private IP address X-Git-Tag: accepted/tizen/7.0/unified/20230111.015131~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=df59a0323ccf40f72425a2075778f3d90cdf0cea;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_ini: Add new item to enable to conceal private IP address Default value is false. If 'conceal private ip' in ini file is set to yes, then hostname for the private IP address will be used in each local ICE candidate. e.g) [general] conceal private ip = yes [Version] 0.3.277 [Issue type] New feature Change-Id: Ida5eb1db00d40661cb32c6501515874a85246328 Signed-off-by: Sangchul Lee --- diff --git a/include/webrtc_private.h b/include/webrtc_private.h index cc863585..08168f3c 100644 --- a/include/webrtc_private.h +++ b/include/webrtc_private.h @@ -339,6 +339,7 @@ typedef struct _ini_item_general_s { const char *stun_server; int jitterbuffer_latency; int bundle_policy; + bool conceal_private_ip; } ini_item_general_s; typedef struct _ini_item_media_source_s { diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index bd0c0934..3171b93f 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.3.276 +Version: 0.3.277 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc.c b/src/webrtc.c index 73e06de2..c082d625 100644 --- a/src/webrtc.c +++ b/src/webrtc.c @@ -110,6 +110,11 @@ int webrtc_create(webrtc_h *webrtc) #endif } + if (_webrtc->ini.general.conceal_private_ip) { + if ((ret = _register_dns_service(_webrtc)) != WEBRTC_ERROR_NONE) + LOG_WARNING("failed to _register_dns_service() but keep going"); + } + if ((ret = _init_convert_thread(_webrtc)) != WEBRTC_ERROR_NONE) goto error; @@ -159,6 +164,9 @@ int webrtc_destroy(webrtc_h webrtc) ret = _gst_pipeline_set_state(_webrtc, GST_STATE_NULL); RET_VAL_IF(ret != WEBRTC_ERROR_NONE, ret, "failed to _gst_pipeline_set_state()"); + if (_webrtc->ini.general.conceal_private_ip) + _unregister_dns_service(_webrtc); + #ifndef TIZEN_TV ret = _destroy_resource_manager(_webrtc); RET_VAL_IF(ret != WEBRTC_ERROR_NONE, ret, "failed to _destroy_resource_manager()"); diff --git a/src/webrtc_ini.c b/src/webrtc_ini.c index ad38011b..49fc7fe0 100644 --- a/src/webrtc_ini.c +++ b/src/webrtc_ini.c @@ -28,6 +28,7 @@ #define DEFAULT_DUMP_PATH "/tmp" #define DEFAULT_JITTERBUFFER_LATENCY 200 /* ms */ #define DEFAULT_BUNDLE_POLICY GST_WEBRTC_BUNDLE_POLICY_MAX_BUNDLE +#define DEFAULT_CONCEAL_PRIVATE_IP false /* categories */ #define INI_CATEGORY_GENERAL "general" @@ -60,6 +61,7 @@ #define INI_ITEM_STUN_SERVER "stun server" #define INI_ITEM_RTP_JITTERBUFFER_LATENCY "rtp jitterbuffer latency" #define INI_ITEM_BUNDLE_POLICY "bundle policy" +#define INI_ITEM_CONCEAL_PRIVATE_IP "conceal private ip" /* items for media source */ #define INI_ITEM_SOURCE_ELEMENT "source element" @@ -242,6 +244,7 @@ static void __dump_ini(webrtc_ini_s *ini) __dump_item(INI_ITEM_STUN_SERVER, INI_ITEM_TYPE_STRING, (void *)ini->general.stun_server); __dump_item(INI_ITEM_RTP_JITTERBUFFER_LATENCY, INI_ITEM_TYPE_INT, &ini->general.jitterbuffer_latency); __dump_item(INI_ITEM_BUNDLE_POLICY, INI_ITEM_TYPE_INT, &ini->general.bundle_policy); + __dump_item(INI_ITEM_CONCEAL_PRIVATE_IP, INI_ITEM_TYPE_BOOL, &ini->general.conceal_private_ip); LOG_INFO("[%s]", INI_CATEGORY_MEDIA_SOURCE); __dump_items_of_source(&ini->media_source); @@ -525,6 +528,7 @@ void _load_ini(webrtc_s *webrtc) ini->general.stun_server = __ini_get_string(ini->dict, INI_CATEGORY_GENERAL, INI_ITEM_STUN_SERVER, NULL); ini->general.jitterbuffer_latency = __ini_get_int(ini->dict, INI_CATEGORY_GENERAL, INI_ITEM_RTP_JITTERBUFFER_LATENCY, DEFAULT_JITTERBUFFER_LATENCY); ini->general.bundle_policy = __ini_get_int(ini->dict, INI_CATEGORY_GENERAL, INI_ITEM_BUNDLE_POLICY, DEFAULT_BUNDLE_POLICY); + ini->general.conceal_private_ip = __ini_get_boolean(ini->dict, INI_CATEGORY_GENERAL, INI_ITEM_CONCEAL_PRIVATE_IP, DEFAULT_CONCEAL_PRIVATE_IP); /* default setting for a media source */ __apply_media_source_setting(ini, &ini->media_source, INI_CATEGORY_MEDIA_SOURCE);