From: Sangchul Lee Date: Mon, 1 Jul 2024 02:37:16 +0000 (+0900) Subject: webrtc_internal: Add webrtc_set_bundle_policy_max_compat() X-Git-Tag: accepted/tizen/7.0/unified/20240702.164434~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=54f132ba295cdfcbb73e2b39648f3f5de98515fc;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_internal: Add webrtc_set_bundle_policy_max_compat() [Version] 0.3.303 [Issue Type] Internal API Change-Id: I22f27c83598b34eb51d46675493ba807dbf39799 Signed-off-by: Sangchul Lee --- diff --git a/include/webrtc_internal.h b/include/webrtc_internal.h index 00e446e1..fb0cffe5 100644 --- a/include/webrtc_internal.h +++ b/include/webrtc_internal.h @@ -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. diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 68b033b3..e0241e26 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.3.302 +Version: 0.3.303 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc.c b/src/webrtc.c index 51ae42c7..ad309b60 100644 --- a/src/webrtc.c +++ b/src/webrtc.c @@ -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) diff --git a/src/webrtc_internal.c b/src/webrtc_internal.c index 3a96eda9..3246995e 100644 --- a/src/webrtc_internal.c +++ b/src/webrtc_internal.c @@ -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 diff --git a/src/webrtc_private.c b/src/webrtc_private.c index 98933ab9..21089309 100644 --- a/src/webrtc_private.c +++ b/src/webrtc_private.c @@ -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 }, };