From: hj kim Date: Thu, 18 Mar 2021 03:44:06 +0000 (+0900) Subject: webrtc_private : remove duplicated code X-Git-Tag: submit/tizen/20210729.023123~111 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=32726c8dd4798f6e2fafee3b19110f79ab0bef80;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_private : remove duplicated code remove simple wrapper functions _webrtcbin_create_offer() and _webrtcbin_create_answer(). [Version] 0.1.130 [Issue Type] Improvement Change-Id: I1d586dd7488e36e8c8a5ab6a996b8b1fd9f782ef --- diff --git a/include/webrtc_private.h b/include/webrtc_private.h index 9045a6dc..6b7a0ae9 100644 --- a/include/webrtc_private.h +++ b/include/webrtc_private.h @@ -502,8 +502,7 @@ void _destroy_tbm_bo_list(webrtc_tbm_s *tbm); void *_get_unused_tbm_bo(webrtc_tbm_s *tbm, unsigned int timeout_sec); void _release_tbm_bo(webrtc_tbm_s *tbm, void *bo); -int _webrtcbin_create_offer(webrtc_s *webrtc, char **offer); -int _webrtcbin_create_answer(webrtc_s *webrtc, char **answer); +int _webrtcbin_create_session_description(webrtc_s *webrtc, bool is_offer, char **desc); int _webrtcbin_set_session_description(webrtc_s *webrtc, const char *description, bool is_remote); int _webrtcbin_add_ice_candidate(webrtc_s *webrtc, const char *candidate); void _webrtcbin_on_data_channel_cb(GstElement *webrtcbin, GObject *data_channel, gpointer user_data); diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index a0a40707..28a0b9a1 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.1.129 +Version: 0.1.130 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc.c b/src/webrtc.c index 1ff9fd5c..f5d93a13 100644 --- a/src/webrtc.c +++ b/src/webrtc.c @@ -742,7 +742,7 @@ int webrtc_create_offer(webrtc_h webrtc, char **offer) LOG_INFO("offer[%p]", offer); - ret = _webrtcbin_create_offer(_webrtc, offer); + ret = _webrtcbin_create_session_description(webrtc, true, offer); g_mutex_unlock(&_webrtc->mutex); @@ -764,7 +764,7 @@ int webrtc_create_answer(webrtc_h webrtc, char **answer) LOG_INFO("answer[%p]", answer); - ret = _webrtcbin_create_answer(_webrtc, answer); + ret = _webrtcbin_create_session_description(webrtc, false, answer); g_mutex_unlock(&_webrtc->mutex); diff --git a/src/webrtc_private.c b/src/webrtc_private.c index 5cf2c295..d88cef4e 100644 --- a/src/webrtc_private.c +++ b/src/webrtc_private.c @@ -1290,7 +1290,7 @@ static void __answer_created_cb(GstPromise *promise, gpointer user_data) LOG_DEBUG_LEAVE(); } -static int _create_session_description(webrtc_s *webrtc, bool is_offer, char **desc) +int _webrtcbin_create_session_description(webrtc_s *webrtc, bool is_offer, char **desc) { GstPromise *promise; gint64 end_time; @@ -1320,24 +1320,6 @@ static int _create_session_description(webrtc_s *webrtc, bool is_offer, char **d return WEBRTC_ERROR_NONE; } -int _webrtcbin_create_offer(webrtc_s *webrtc, char **offer) -{ - RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); - RET_VAL_IF(offer == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "offer is NULL"); - RET_VAL_IF(webrtc->gst.webrtcbin == NULL, WEBRTC_ERROR_INVALID_OPERATION, "webrtcbin is NULL"); - - return _create_session_description(webrtc, true, offer); -} - -int _webrtcbin_create_answer(webrtc_s *webrtc, char **answer) -{ - RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); - RET_VAL_IF(answer == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "answer is NULL"); - RET_VAL_IF(webrtc->gst.webrtcbin == NULL, WEBRTC_ERROR_INVALID_OPERATION, "webrtcbin is NULL"); - - return _create_session_description(webrtc, false, answer); -} - /* Use g_free() to release the sdp and type parameter. */ static int __get_sdp_from_description(const char *description, gchar **sdp, gchar **type) {