Enums are added as below.
- WEBRTC_BUNDLE_POLICY_NONE
- WEBRTC_BUNDLE_POLICY_MAX_BUNDLE
Functions are added as below.
- webrtc_set_bundle_policy()
- webrtc_get_bundle_policy()
[Version] 0.3.45
[Issue Type] API
Change-Id: Ie3a66548f4f0300023ab24a23b84312cd6c888f8
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
WEBRTC_ICE_CONNECTION_STATE_CLOSED, /**< Closed */
} webrtc_ice_connection_state_e;
+/**
+ * @brief Enumeration for WebRTC bundle policy.
+ * @since_tizen 7.0
+ * @remarks It corresponds with the RTCIceTransportPolicy enum described in https://www.w3.org/TR/webrtc/#rtcbundlepolicy-enum.
+ */
+typedef enum {
+ WEBRTC_BUNDLE_POLICY_NONE, /**< None */
+ WEBRTC_BUNDLE_POLICY_MAX_BUNDLE, /**< Max-bundle */
+} webrtc_bundle_policy_e;
+
/**
* @brief Enumeration for WebRTC ICE transport policy.
* @since_tizen 6.5
*/
int webrtc_foreach_turn_server(webrtc_h webrtc, webrtc_turn_server_cb callback, void *user_data);
+/**
+ * @brief Sets a bundle policy.
+ * @since_tizen 7.0
+ * @param[in] webrtc WebRTC handle
+ * @param[in] policy The bundle policy
+ * @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.
+ * @see webrtc_get_bundle_policy()
+ */
+int webrtc_set_bundle_policy(webrtc_h webrtc, webrtc_bundle_policy_e policy);
+
+/**
+ * @brief Gets the bundle policy.
+ * @since_tizen 7.0
+ * @remarks The default value is #WEBRTC_BUNDLE_POLICY_MAX_BUNDLE.
+ * @param[in] webrtc WebRTC handle
+ * @param[out] policy The bundle policy
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #WEBRTC_ERROR_NONE Successful
+ * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see webrtc_set_bundle_policy()
+ */
+int webrtc_get_bundle_policy(webrtc_h webrtc, webrtc_bundle_policy_e *policy);
+
/**
* @brief Sets a ICE transport policy that represents which candidates the ICE Agent is allowed to use.
* @since_tizen 6.5
webrtc_gst_s gst;
unsigned int payload_types;
+ webrtc_bundle_policy_e bundle_policy;
+
gchar *stun_server_url;
GList *turn_server_urls;
Name: capi-media-webrtc
Summary: A WebRTC library in Tizen Native API
-Version: 0.3.44
+Version: 0.3.45
Release: 0
Group: Multimedia/API
License: Apache-2.0
#define _WEBRTC_PRIVILEGE_CAMERA "http://tizen.org/privilege/camera"
#define _WEBRTC_PRIVILEGE_RECORDER "http://tizen.org/privilege/recorder"
+typedef struct {
+ const char *str;
+ GstWebRTCBundlePolicy gst_policy;
+} bundle_policy_s;
+
+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 },
+};
+
int webrtc_set_error_cb(webrtc_h webrtc, webrtc_error_cb callback, void *user_data)
{
webrtc_s *_webrtc = (webrtc_s*)webrtc;
return WEBRTC_ERROR_NONE;
}
+int webrtc_set_bundle_policy(webrtc_h webrtc, webrtc_bundle_policy_e policy)
+{
+ g_autoptr(GMutexLocker) locker = NULL;
+ webrtc_s *_webrtc = (webrtc_s*)webrtc;
+
+ RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
+ RET_VAL_IF(policy > WEBRTC_BUNDLE_POLICY_MAX_BUNDLE, WEBRTC_ERROR_INVALID_PARAMETER, "invalid policy(%d)", policy);
+
+ locker = g_mutex_locker_new(&_webrtc->mutex);
+
+ RET_VAL_IF(_webrtc->state != WEBRTC_STATE_IDLE, WEBRTC_ERROR_INVALID_STATE, "the state should be IDLE");
+
+ g_object_set(G_OBJECT(_webrtc->gst.webrtcbin), "bundle-policy", __bundle_policies[policy].gst_policy, NULL);
+
+ _webrtc->bundle_policy = policy;
+
+ LOG_INFO("webrtc[%p] policy[%s]", webrtc, __bundle_policies[policy].str);
+
+ return WEBRTC_ERROR_NONE;
+}
+
+int webrtc_get_bundle_policy(webrtc_h webrtc, webrtc_bundle_policy_e *policy)
+{
+ webrtc_s *_webrtc = (webrtc_s*)webrtc;
+
+ RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
+ RET_VAL_IF(policy == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "policy is NULL");
+
+ g_mutex_lock(&_webrtc->mutex);
+
+ *policy = _webrtc->bundle_policy;
+
+ LOG_INFO("webrtc[%p] policy[%d]", webrtc, _webrtc->bundle_policy);
+
+ g_mutex_unlock(&_webrtc->mutex);
+
+ return WEBRTC_ERROR_NONE;
+}
+
int webrtc_set_ice_transport_policy(webrtc_h webrtc, webrtc_ice_transport_policy_e policy)
{
g_autoptr(GMutexLocker) locker = NULL;
[GST_WEBRTC_ICE_CONNECTION_STATE_CLOSED] = { "CLOSED", WEBRTC_ICE_CONNECTION_STATE_CLOSED },
};
+typedef struct {
+ const char *str;
+ int policy;
+} bundle_policy_info_s;
+
+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_BUNDLE] = { "MAX-BUNDLE", WEBRTC_BUNDLE_POLICY_MAX_BUNDLE },
+};
+
//LCOV_EXCL_START
static const char *__get_error_string(webrtc_error_e error)
{
}
g_free(webrtcbin_name);
+ if (_bundle_policy_info[webrtc->ini.general.bundle_policy].policy == -1) {
+ LOG_ERROR("bundle policy[%s] is not supported yet", _bundle_policy_info[webrtc->ini.general.bundle_policy].str);
+ goto error;
+ }
+
g_object_set(G_OBJECT(webrtc->gst.webrtcbin),
"bundle-policy", webrtc->ini.general.bundle_policy,
"latency", webrtc->ini.general.jitterbuffer_latency,
"netsim", webrtc->ini.general.network_simulator,
NULL);
+ webrtc->bundle_policy = _bundle_policy_info[webrtc->ini.general.bundle_policy].policy;
+
if (webrtc->ini.general.stun_server) {
webrtc->stun_server_url = g_strdup(webrtc->ini.general.stun_server);
g_object_set(G_OBJECT(webrtc->gst.webrtcbin), "stun-server", webrtc->stun_server_url, NULL);