webrtc_internal: Add webrtc_set_bundle_policy_max_compat() 83/313683/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 02:50:44 +0000 (11:50 +0900)
[Version] 0.4.57
[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 3543e258739c558e4842a795935535812b09ce3f..3b772a07341bc433712d4330877b8247367ef9e4 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.
@@ -525,6 +533,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 95994e499c9978f1c982b1ec73fdd47946d5583e..1f71f989298dff600076263bd96d6618fb80b824 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.4.56
+Version:    0.4.57
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 3031877176f04e3097046055b93f2fa1e2568ffb..1e7b1a757360e609d1715f5bac7bb2b51209c080 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 97c3871174e489f543ad743122ba70320bacb6e0..2361c29d1dbda25ca53a012740b3d0a13d8f7c2f 100644 (file)
@@ -485,6 +485,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 8cb80386d9e02c8ef449c870bbd1bcfd3ccaf5c3..db9b22f528fcf947be5859fad04e20b2c05145f1 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 },
 };