Use tab for spacing.
Add or remove space.
Some set/unset callback functions are moved to it's getter API.
Revise doxygen.
[Version] 0.2.19
[Issue Type] Improvement
Change-Id: Ia9ffa82d93b91b77aa2dfd61e4466297d8da48ac
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
* @since_tizen 6.5
*/
typedef enum {
- WEBRTC_PEER_CONNECTION_STATE_NEW, /**< New */
- WEBRTC_PEER_CONNECTION_STATE_CONNECTING, /**< Connecting */
- WEBRTC_PEER_CONNECTION_STATE_CONNECTED, /**< Connected */
- WEBRTC_PEER_CONNECTION_STATE_DISCONNECTED, /**< Disconnected */
- WEBRTC_PEER_CONNECTION_STATE_FAILED, /**< Failed */
- WEBRTC_PEER_CONNECTION_STATE_CLOSED, /**< Closed */
+ WEBRTC_PEER_CONNECTION_STATE_NEW, /**< New */
+ WEBRTC_PEER_CONNECTION_STATE_CONNECTING, /**< Connecting */
+ WEBRTC_PEER_CONNECTION_STATE_CONNECTED, /**< Connected */
+ WEBRTC_PEER_CONNECTION_STATE_DISCONNECTED, /**< Disconnected */
+ WEBRTC_PEER_CONNECTION_STATE_FAILED, /**< Failed */
+ WEBRTC_PEER_CONNECTION_STATE_CLOSED, /**< Closed */
} webrtc_peer_connection_state_e;
/**
* @since_tizen 6.5
*/
typedef enum {
- WEBRTC_SIGNALING_STATE_STABLE, /**< Stable */
- WEBRTC_SIGNALING_STATE_HAVE_LOCAL_OFFER, /**< Have local offer */
- WEBRTC_SIGNALING_STATE_HAVE_REMOTE_OFFER, /**< Have remote offer */
- WEBRTC_SIGNALING_STATE_HAVE_LOCAL_PRANSWER, /**< Have local provisional answer */
- WEBRTC_SIGNALING_STATE_HAVE_REMOTE_PRANSWER, /**< Have remote provisional answer */
- WEBRTC_SIGNALING_STATE_CLOSED, /**< Closed */
+ WEBRTC_SIGNALING_STATE_STABLE, /**< Stable */
+ WEBRTC_SIGNALING_STATE_HAVE_LOCAL_OFFER, /**< Have local offer */
+ WEBRTC_SIGNALING_STATE_HAVE_REMOTE_OFFER, /**< Have remote offer */
+ WEBRTC_SIGNALING_STATE_HAVE_LOCAL_PRANSWER, /**< Have local provisional answer */
+ WEBRTC_SIGNALING_STATE_HAVE_REMOTE_PRANSWER, /**< Have remote provisional answer */
+ WEBRTC_SIGNALING_STATE_CLOSED, /**< Closed */
} webrtc_signaling_state_e;
/**
* @since_tizen 6.5
*/
typedef enum {
- WEBRTC_ICE_GATHERING_STATE_NEW, /**< New */
- WEBRTC_ICE_GATHERING_STATE_GATHERING, /**< Gathering */
- WEBRTC_ICE_GATHERING_STATE_COMPLETE, /**< Complete */
+ WEBRTC_ICE_GATHERING_STATE_NEW, /**< New */
+ WEBRTC_ICE_GATHERING_STATE_GATHERING, /**< Gathering */
+ WEBRTC_ICE_GATHERING_STATE_COMPLETE, /**< Complete */
} webrtc_ice_gathering_state_e;
/**
*/
int webrtc_unset_error_cb(webrtc_h webrtc);
-/**
- * @brief Sets a callback function to be invoked when the WebRTC state is changed.
- * @since_tizen 6.5
- * @param[in] webrtc WebRTC handle
- * @param[in] callback Callback function pointer
- * @param[in] user_data The user data to be passed to the callback function
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #WEBRTC_ERROR_NONE Successful
- * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
- * @post webrtc_state_changed_cb() will be invoked.
- * @see webrtc_unset_state_changed_cb()
- * @see webrtc_state_changed_cb()
- */
-int webrtc_set_state_changed_cb(webrtc_h webrtc, webrtc_state_changed_cb callback, void *user_data);
-
-/**
- * @brief Unsets the state changed callback function.
- * @since_tizen 6.5
- * @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_OPERATION Invalid operation
- * @see webrtc_set_state_changed_cb()
- */
-int webrtc_unset_state_changed_cb(webrtc_h webrtc);
-
/**
* @brief Creates an instance of WebRTC.
* @since_tizen 6.5
*/
int webrtc_destroy(webrtc_h webrtc);
+/**
+ * @brief Sets a callback function to be invoked when the WebRTC state is changed.
+ * @since_tizen 6.5
+ * @param[in] webrtc WebRTC handle
+ * @param[in] callback Callback function pointer
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #WEBRTC_ERROR_NONE Successful
+ * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
+ * @post webrtc_state_changed_cb() will be invoked.
+ * @see webrtc_unset_state_changed_cb()
+ * @see webrtc_state_changed_cb()
+ * @see webrtc_get_state()
+ */
+int webrtc_set_state_changed_cb(webrtc_h webrtc, webrtc_state_changed_cb callback, void *user_data);
+
+/**
+ * @brief Unsets the state changed callback function.
+ * @since_tizen 6.5
+ * @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_OPERATION Invalid operation
+ * @see webrtc_set_state_changed_cb()
+ */
+int webrtc_unset_state_changed_cb(webrtc_h webrtc);
+
/**
* @brief Gets the WebRTC state.
* @since_tizen 6.5
* otherwise a negative error value
* @retval #WEBRTC_ERROR_NONE Successful
* @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
- * @see #webrtc_state_e
+ * @see webrtc_set_state_changed_cb()
+ * @see webrtc_unset_state_changed_cb()
*/
int webrtc_get_state(webrtc_h webrtc, webrtc_state_e *state);
Name: capi-media-webrtc
Summary: A WebRTC library in Tizen Native API
-Version: 0.2.18
+Version: 0.2.19
Release: 0
Group: Multimedia/API
License: Apache-2.0
return WEBRTC_ERROR_NONE;
}
-int webrtc_set_state_changed_cb(webrtc_h webrtc, webrtc_state_changed_cb callback, void *user_data)
-{
- webrtc_s *_webrtc = (webrtc_s*)webrtc;
-
- RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
- RET_VAL_IF(callback == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "callback is NULL");
-
- g_mutex_lock(&_webrtc->mutex);
-
- LOG_WARNING_IF_CALLBACK_EXISTS(_webrtc->state_changed_cb);
-
- _webrtc->state_changed_cb.callback = callback;
- _webrtc->state_changed_cb.user_data = user_data;
-
- LOG_INFO("callback[%p] user_data[%p]", callback, user_data);
-
- g_mutex_unlock(&_webrtc->mutex);
-
- return WEBRTC_ERROR_NONE;
-}
-
-int webrtc_unset_state_changed_cb(webrtc_h webrtc)
-{
- webrtc_s *_webrtc = (webrtc_s*)webrtc;
-
- RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
-
- g_mutex_lock(&_webrtc->mutex);
-
- RET_VAL_WITH_UNLOCK_IF(_webrtc->state_changed_cb.callback == NULL, WEBRTC_ERROR_INVALID_OPERATION, &_webrtc->mutex, "callback was not set");
-
- LOG_INFO("callback[%p] user_data[%p] is reset to NULL",
- _webrtc->state_changed_cb.callback, _webrtc->state_changed_cb.user_data);
-
- _webrtc->state_changed_cb.callback = NULL;
- _webrtc->state_changed_cb.user_data = NULL;
-
- g_mutex_unlock(&_webrtc->mutex);
-
- return WEBRTC_ERROR_NONE;
-}
-
int webrtc_create(webrtc_h *webrtc)
{
#ifndef TIZEN_TV
return _webrtc_stop(_webrtc);
}
+int webrtc_set_state_changed_cb(webrtc_h webrtc, webrtc_state_changed_cb callback, void *user_data)
+{
+ webrtc_s *_webrtc = (webrtc_s*)webrtc;
+
+ RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
+ RET_VAL_IF(callback == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "callback is NULL");
+
+ g_mutex_lock(&_webrtc->mutex);
+
+ LOG_WARNING_IF_CALLBACK_EXISTS(_webrtc->state_changed_cb);
+
+ _webrtc->state_changed_cb.callback = callback;
+ _webrtc->state_changed_cb.user_data = user_data;
+
+ LOG_INFO("callback[%p] user_data[%p]", callback, user_data);
+
+ g_mutex_unlock(&_webrtc->mutex);
+
+ return WEBRTC_ERROR_NONE;
+}
+
+int webrtc_unset_state_changed_cb(webrtc_h webrtc)
+{
+ webrtc_s *_webrtc = (webrtc_s*)webrtc;
+
+ RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
+
+ g_mutex_lock(&_webrtc->mutex);
+
+ RET_VAL_WITH_UNLOCK_IF(_webrtc->state_changed_cb.callback == NULL, WEBRTC_ERROR_INVALID_OPERATION, &_webrtc->mutex, "callback was not set");
+
+ LOG_INFO("callback[%p] user_data[%p] is reset to NULL",
+ _webrtc->state_changed_cb.callback, _webrtc->state_changed_cb.user_data);
+
+ _webrtc->state_changed_cb.callback = NULL;
+ _webrtc->state_changed_cb.user_data = NULL;
+
+ g_mutex_unlock(&_webrtc->mutex);
+
+ return WEBRTC_ERROR_NONE;
+}
+
int webrtc_get_state(webrtc_h webrtc, webrtc_state_e *state)
{
webrtc_s *_webrtc = (webrtc_s*)webrtc;
ret = _set_video_mute(_webrtc, source_id, mute);
break;
- default :
+ default:
LOG_ERROR_IF_REACHED("media type(%d)", media_type);
ret = WEBRTC_ERROR_INVALID_PARAMETER;
break;
ret = _get_video_mute(_webrtc, source_id, muted);
break;
- default :
+ default:
LOG_ERROR_IF_REACHED("media type(%d)", media_type);
ret = WEBRTC_ERROR_INVALID_PARAMETER;
break;
RET_VAL_WITH_UNLOCK_IF(_webrtc->state != WEBRTC_STATE_IDLE, WEBRTC_ERROR_INVALID_STATE, &_webrtc->mutex, "the state should be IDLE");
- g_signal_emit_by_name (G_OBJECT(_webrtc->gst.webrtcbin), "add-turn-server", turn_server, &ret);
+ g_signal_emit_by_name(G_OBJECT(_webrtc->gst.webrtcbin), "add-turn-server", turn_server, &ret);
RET_VAL_WITH_UNLOCK_IF(!ret, WEBRTC_ERROR_INVALID_PARAMETER, &_webrtc->mutex, "invalid turn server url (%s)", turn_server);
_webrtc->turn_server_urls = g_list_append(_webrtc->turn_server_urls, g_strdup(turn_server));
LOG_DEBUG("free display[%p]", display);
g_free(display);
-}
\ No newline at end of file
+}
RET_VAL_IF(new_pad == NULL, WEBRTC_ERROR_INVALID_OPERATION, "new_pad is NULL");
pad_name = g_strdup_printf("%s_%u", is_src ? "src" : "sink", slot->id);
- if (!(*new_pad =__add_no_target_ghostpad(slot->bin, pad_name, is_src))) {
+ if (!(*new_pad = __add_no_target_ghostpad(slot->bin, pad_name, is_src))) {
LOG_ERROR("failed to add new ghost pad[%s] for bin[%s]", pad_name, GST_ELEMENT_NAME(slot->bin));
g_free(pad_name);
return WEBRTC_ERROR_INVALID_OPERATION;
LOG_DEBUG("type: %s", *type);
LOG_DEBUG("sdp:\n%s", *sdp);
end:
- g_object_unref (parser);
+ g_object_unref(parser);
return ret;
}
desc = gst_webrtc_session_description_new(sdp_type, gst_sdp);
promise = gst_promise_new();
- g_signal_emit_by_name(webrtc->gst.webrtcbin, is_remote? "set-remote-description" : "set-local-description", desc, promise);
+ g_signal_emit_by_name(webrtc->gst.webrtcbin, is_remote ? "set-remote-description" : "set-local-description", desc, promise);
gst_promise_interrupt(promise);
gst_promise_unref(promise);
gst_webrtc_session_description_free(desc);
- LOG_DEBUG("[%s] signal is emitted", is_remote? "set-remote-description" : "set-local-description");
+ LOG_DEBUG("[%s] signal is emitted", is_remote ? "set-remote-description" : "set-local-description");
end:
g_free(sdp);
RET_VAL_IF(webrtc->resource.mgr == NULL, WEBRTC_ERROR_INVALID_PARAMETER,
"resource manager is NULL");
- if(webrtc->resource.release_cb_is_calling) {
+ if (webrtc->resource.release_cb_is_calling) {
LOG_INFO("__resource_release_cb is calling, so skip");
return WEBRTC_ERROR_NONE;
}
*id = _client->id;
return WEBRTC_ERROR_NONE;
-}
\ No newline at end of file
+}
}
#ifndef TIZEN_TV
if (sink->display->type == WEBRTC_DISPLAY_TYPE_OVERLAY && webrtc->ini.resource_acquisition.video_overlay) {
- if ((ret =_acquire_resource_for_type(webrtc, MM_RESOURCE_MANAGER_RES_TYPE_VIDEO_OVERLAY)))
+ if ((ret = _acquire_resource_for_type(webrtc, MM_RESOURCE_MANAGER_RES_TYPE_VIDEO_OVERLAY)))
return ret;
}
#endif
ret = __mute_videosrc(source, mute);
break;
- default :
+ default:
LOG_ERROR_IF_REACHED("type(%d)", source->type);
return WEBRTC_ERROR_INVALID_PARAMETER;
}
g_object_set(G_OBJECT(volume), "mute", mute, NULL);
break;
- default :
+ default:
LOG_ERROR_IF_REACHED("type(%d)", source->type);
return WEBRTC_ERROR_INVALID_PARAMETER;
}
*muted = source->video_muted;
break;
- default :
+ default:
LOG_ERROR_IF_REACHED("type(%d)", source->type);
return WEBRTC_ERROR_INVALID_PARAMETER;
}
g_object_get(G_OBJECT(volume), "mute", muted, NULL);
break;
- default :
+ default:
LOG_ERROR_IF_REACHED("type(%d)", source->type);
return WEBRTC_ERROR_INVALID_PARAMETER;
}