webrtc_internal: Add webrtc_set_bundle_policy_max_compat() 50/313750/1
authorSangchul Lee <sc11.lee@samsung.com>
Mon, 1 Jul 2024 02:37:16 +0000 (11:37 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Mon, 1 Jul 2024 03:39:14 +0000 (12:39 +0900)
[Version] 1.1.5
[Issue Type] Internal API

Change-Id: I22f27c83598b34eb51d46675493ba807dbf39799
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
include/webrtc_internal.h
packaging/capi-media-webrtc.spec
src/webrtc.c
src/webrtc_internal.c
src/webrtc_private.c

index 3f8484326d0890c1c5816db09839ae17f1505246..9f881d2b58db037f92f503177c41aed8dae4043d 100644 (file)
@@ -76,6 +76,14 @@ typedef enum {
  */
 #define WEBRTC_SNAPSHOT_OPTION_NONE    -1
 
+/**
+ * @internal
+ * @brief Definition for WebRTC bundle policy - 'max-compat'.
+ * @since_tizen 7.0
+ * @remarks It corresponds with the RTCBundlePolicy enum described in https://www.w3.org/TR/webrtc/#rtcbundlepolicy-enum.
+ */
+#define WEBRTC_BUNDLE_POLICY_MAX_COMPAT 2
+
 /**
  * @internal
  * @brief Enumeration for WebRTC signaling message type.
@@ -523,6 +531,19 @@ int webrtc_set_rtp_packet_drop_probability(webrtc_h webrtc, bool sender, float p
  */
 int webrtc_get_rtp_packet_drop_probability(webrtc_h webrtc, bool sender, float *probability);
 
+/**
+ * @brief Sets the 'max-compat' bundle policy.
+ * @since_tizen 7.0
+ * @param[in] webrtc       WebRTC handle
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #WEBRTC_ERROR_NONE    Successful
+ * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WEBRTC_ERROR_INVALID_STATE Invalid state
+ * @pre @a webrtc state must be set to #WEBRTC_STATE_IDLE.
+ */
+int webrtc_set_bundle_policy_max_compat(webrtc_h webrtc);
+
 /**
  * @internal
  * @brief Starts the WebRTC synchronously.
index 7050e31da2b3c40b04895eb8d2bfdf4b241c8dfa..8ba8164c7d7e75f47f977ba90944d3d61ba63f54 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    1.1.4
+Version:    1.1.5
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 71307fb562ee8254a19eceb60ccc6b40c5286f65..644ac136c4f1dd905736cd4553a38e413364ffd9 100644 (file)
@@ -37,6 +37,7 @@ typedef struct {
 static bundle_policy_s __bundle_policies[] = {
        [WEBRTC_BUNDLE_POLICY_NONE] = { "NONE", GST_WEBRTC_BUNDLE_POLICY_NONE },
        [WEBRTC_BUNDLE_POLICY_MAX_BUNDLE] = { "MAX-BUNDLE", GST_WEBRTC_BUNDLE_POLICY_MAX_BUNDLE },
+       [WEBRTC_BUNDLE_POLICY_MAX_COMPAT] = { "MAX-COMPAT", GST_WEBRTC_BUNDLE_POLICY_MAX_COMPAT },
 };
 
 int webrtc_set_error_cb(webrtc_h webrtc, webrtc_error_cb callback, void *user_data)
index b26fc7fc03aa2334ba3492ace6e75611bb1772bc..bd9cb7b14f0d7a3f16e0db02d67ccabe9ef7250b 100644 (file)
@@ -470,6 +470,21 @@ int webrtc_get_rtp_packet_drop_probability(webrtc_h webrtc, bool sender, float *
        return _get_packet_drop_probability(webrtc, sender, probability);
 }
 
+int webrtc_set_bundle_policy_max_compat(webrtc_h webrtc)
+{
+       g_autoptr(GMutexLocker) locker = NULL;
+       webrtc_s *_webrtc = (webrtc_s *)webrtc;
+
+       RET_VAL_IF(_webrtc->state != WEBRTC_STATE_IDLE, WEBRTC_ERROR_INVALID_STATE, "the state should be IDLE");
+
+       /* Until it is released to public header, use the gst value directly. */
+       g_object_set(G_OBJECT(_webrtc->gst.webrtcbin), "bundle-policy", GST_WEBRTC_BUNDLE_POLICY_MAX_COMPAT, NULL);
+
+       LOG_INFO("webrtc[%p] policy[%s]", webrtc, "MAX-COMPAT");
+
+       return WEBRTC_ERROR_NONE;
+}
+
 int webrtc_start_sync(webrtc_h webrtc)
 {
        int ret = WEBRTC_ERROR_NONE;
index 46f33b0def146bdc1cc9bb8c954cf7803bc45b81..016a8d4f43885ee5514804d7ea30c0d3cbb95dd4 100644 (file)
@@ -89,7 +89,7 @@ typedef struct {
 static bundle_policy_info_s _bundle_policy_info[] = {
        [GST_WEBRTC_BUNDLE_POLICY_NONE] = { "NONE", WEBRTC_BUNDLE_POLICY_NONE },
        [GST_WEBRTC_BUNDLE_POLICY_BALANCED] = { "BALANCED", -1 }, /* NOT SUPPORTED */
-       [GST_WEBRTC_BUNDLE_POLICY_MAX_COMPAT] = { "MAX-COMPAT", -1 }, /* NOT SUPPORTED */
+       [GST_WEBRTC_BUNDLE_POLICY_MAX_COMPAT] = { "MAX-COMPAT", WEBRTC_BUNDLE_POLICY_MAX_COMPAT },
        [GST_WEBRTC_BUNDLE_POLICY_MAX_BUNDLE] = { "MAX-BUNDLE", WEBRTC_BUNDLE_POLICY_MAX_BUNDLE },
 };