webrtc_internal: Add webrtc_set_bundle_policy_max_compat() 71/313671/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:37:38 +0000 (11:37 +0900)
[Version] 0.3.303
[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 00e446e12409760169757eb9cadbf2c6156791b7..fb0cffe5adb899cfaba1a8b566d47c998ad1fe64 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.
@@ -392,6 +400,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 Creates a signaling server for private network.
index 68b033b3a36086799fe673e9b643aed0f7a05493..e0241e267eab2ca5ec851fa182d93e1261e8b913 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.3.302
+Version:    0.3.303
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 51ae42c722815892752036c54a993fd53e09c8fe..ad309b60c6496fad0bf2fa364d983b4fbf2feb18 100644 (file)
@@ -36,6 +36,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 3a96eda9b425d5bbc3b71b3a87a8ee0098f4792d..3246995e47be52acbc927bbdadcfdfe60b36d830 100644 (file)
@@ -280,4 +280,23 @@ 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 == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
+
+       locker = g_mutex_locker_new(&_webrtc->mutex);
+
+       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;
+}
 //LCOV_EXCL_STOP
index 98933ab9ef57f4a5129eda8714767f259a39259d..21089309e256d56240eb0792e40c7b68b6fe9606 100644 (file)
@@ -90,7 +90,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 },
 };