webrtc_private : remove duplicated code 10/255410/6
authorhj kim <backto.kim@samsung.com>
Thu, 18 Mar 2021 03:44:06 +0000 (12:44 +0900)
committerhj kim <backto.kim@samsung.com>
Thu, 18 Mar 2021 08:16:55 +0000 (08:16 +0000)
remove simple wrapper functions _webrtcbin_create_offer() and _webrtcbin_create_answer().

[Version] 0.1.130
[Issue Type] Improvement

Change-Id: I1d586dd7488e36e8c8a5ab6a996b8b1fd9f782ef

include/webrtc_private.h
packaging/capi-media-webrtc.spec
src/webrtc.c
src/webrtc_private.c

index 9045a6dc110b9c3d3f6115d1cb15b1fb93ecc09a..6b7a0ae97c37dc4dac089f79383862739e1f9b00 100644 (file)
@@ -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);
index a0a407079049c36cdf8c3c91b491547abef9ed63..28a0b9a1846e232eab3bcede4cc96b8a4974eaa5 100644 (file)
@@ -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
index 1ff9fd5c0b6a62bbbd2b64fbc03538488ac72568..f5d93a1372c1f16aaff75826d927f7bc47834745 100644 (file)
@@ -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);
 
index 5cf2c2952037a2e7a20185a5d9d1483e01f4e2c5..d88cef4ed0c784692afa2a3812340ad901652154 100644 (file)
@@ -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)
 {