From: Sangchul Lee Date: Thu, 23 Dec 2021 07:07:21 +0000 (+0900) Subject: webrtc_ini: Add new item to set bundle policy and apply it X-Git-Tag: submit/tizen_6.5/20220107.021134^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=00932c9ccdab96daea7fcb01ee7d51742516eb96;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_ini: Add new item to set bundle policy and apply it [general] ; SDP bundle policy (0:none, 1:balanced, 2:max compat, 3:max bundle) bundle policy = 3 Note that 1 and 2 are not supported yet. [Version] 0.2.154 [Issue Type] Improvement Change-Id: I47f72ad12d21399727a398ea74da7e452b5a71ec Signed-off-by: Sangchul Lee --- diff --git a/include/webrtc_private.h b/include/webrtc_private.h index 17dce4c6..f856e276 100644 --- a/include/webrtc_private.h +++ b/include/webrtc_private.h @@ -293,6 +293,7 @@ typedef struct _ini_item_general_s { gchar **gst_excluded_elements; const char *stun_server; int jitterbuffer_latency; + int bundle_policy; } 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 510b04ff..04b557ba 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.153 +Version: 0.2.154 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_ini.c b/src/webrtc_ini.c index 52a656de..ee5aeaaa 100644 --- a/src/webrtc_ini.c +++ b/src/webrtc_ini.c @@ -26,6 +26,7 @@ bool g_verbose = false; #define DEFAULT_VERBOSE_LOG false #define DEFAULT_NICE_VERBOSE false #define DEFAULT_JITTERBUFFER_LATENCY 200 /* ms */ +#define DEFAULT_BUNDLE_POLICY GST_WEBRTC_BUNDLE_POLICY_MAX_BUNDLE /* categories */ #define INI_CATEGORY_GENERAL "general" @@ -53,6 +54,7 @@ bool g_verbose = false; #define INI_ITEM_GST_EXCLUDED_ELEMENTS "gstreamer excluded elements" #define INI_ITEM_STUN_SERVER "stun server" #define INI_ITEM_RTP_JITTERBUFFER_LATENCY "rtp jitterbuffer latency" +#define INI_ITEM_BUNDLE_POLICY "bundle policy" /* items for media source */ #define INI_ITEM_SOURCE_ELEMENT "source element" @@ -219,6 +221,7 @@ static void __dump_ini(webrtc_ini_s *ini) __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); __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); LOG_INFO("[%s]", INI_CATEGORY_MEDIA_SOURCE); __dump_items_of_source(&ini->media_source); @@ -454,6 +457,7 @@ int _load_ini(webrtc_s *webrtc) __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); 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); /* default setting for a media source */ __apply_media_source_setting(ini, &ini->media_source, INI_CATEGORY_MEDIA_SOURCE); diff --git a/src/webrtc_private.c b/src/webrtc_private.c index 99fad14f..99fea4b8 100644 --- a/src/webrtc_private.c +++ b/src/webrtc_private.c @@ -1239,7 +1239,10 @@ int _gst_build_pipeline(webrtc_s *webrtc) } g_free(webrtcbin_name); - g_object_set(G_OBJECT(webrtc->gst.webrtcbin), "bundle-policy", 3, NULL); /* 3 for max-bundle */ + g_object_set(G_OBJECT(webrtc->gst.webrtcbin), + "bundle-policy", webrtc->ini.general.bundle_policy, + "latency", webrtc->ini.general.jitterbuffer_latency, + NULL); if (webrtc->ini.general.stun_server) { webrtc->stun_server_url = g_strdup(webrtc->ini.general.stun_server); @@ -1247,8 +1250,6 @@ int _gst_build_pipeline(webrtc_s *webrtc) LOG_INFO("stun_server[%s]", webrtc->stun_server_url); } - g_object_set(G_OBJECT(webrtc->gst.webrtcbin), "latency", webrtc->ini.general.jitterbuffer_latency, NULL); - _connect_and_append_signal(&webrtc->signals, (GObject *)webrtc->gst.webrtcbin, "on-negotiation-needed", G_CALLBACK(__webrtcbin_on_negotiation_needed_cb), webrtc); _connect_and_append_signal(&webrtc->signals, (GObject *)webrtc->gst.webrtcbin, "on-ice-candidate", G_CALLBACK(__webrtcbin_on_ice_candidate_cb), webrtc); _connect_and_append_signal(&webrtc->signals, (GObject *)webrtc->gst.webrtcbin, "notify::connection-state", G_CALLBACK(__webrtcbin_peer_connection_state_cb), webrtc);