webrtc_ini: Add new item to set bundle policy and apply it 23/268923/2 accepted/tizen/6.5/unified/20220107.120707 submit/tizen_6.5/20220107.021134
authorSangchul Lee <sc11.lee@samsung.com>
Thu, 23 Dec 2021 07:07:21 +0000 (16:07 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Thu, 6 Jan 2022 09:26:10 +0000 (18:26 +0900)
[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 <sc11.lee@samsung.com>
include/webrtc_private.h
packaging/capi-media-webrtc.spec
src/webrtc_ini.c
src/webrtc_private.c

index 17dce4c692e2783da657da14972a35e3e46b4dea..f856e27674247ca4ef253147c049bc04ba57b7b6 100644 (file)
@@ -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 {
index 510b04ffafce20b8f43e1a257789cf96577e2ea4..04b557ba5a9445b119125bd749b9c255cdb6cbbd 100644 (file)
@@ -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
index 52a656de8ca349e215755ef6f15b611351421c8e..ee5aeaaa3930deac4e59f50784988ee23f017076 100644 (file)
@@ -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);
index 99fad14f207d3951ad971edfab34bddda47db113..99fea4b81a0a2cd44b496c3c4732657621e469e1 100644 (file)
@@ -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);