Add webrtc_get_local_description() and webrtc_get_remote_description() 84/315884/1
authorSangchul Lee <sc11.lee@samsung.com>
Fri, 9 Aug 2024 00:45:58 +0000 (09:45 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Fri, 9 Aug 2024 00:46:43 +0000 (09:46 +0900)
[Version] 1.1.22
[Issue Type] API

Change-Id: Ifee7174a06158b57d8dd0b0883c68bf9bf050300
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
include/webrtc.h
include/webrtc_internal.h
packaging/capi-media-webrtc.spec
src/webrtc.c
src/webrtc_internal.c

index f76006c4a6512d3c1eac8c5f913f5b85280222f8..5131a17b0b5b9a8244cd78ba096d0bef2b8c6c42 100644 (file)
@@ -2513,9 +2513,27 @@ int webrtc_create_answer_async(webrtc_h webrtc, bundle *options, webrtc_session_
  * @see webrtc_create_answer_async()
  * @see webrtc_set_signaling_state_change_cb()
  * @see webrtc_get_signaling_state()
+ * @see webrtc_get_local_description()
  */
 int webrtc_set_local_description(webrtc_h webrtc, const char *description);
 
+/**
+ * @brief Gets the local session description.
+ * @since_tizen 9.0
+ * @remarks @a description is a JSON string.\n
+ *          It will be {"sdp":{"type":"offer or answer","sdp":"..."}}.\n
+ *          The @a description should be released using free() if the value is not NULL.
+ * @param[in] webrtc       WebRTC handle
+ * @param[out] description The local session description
+ * @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_local_description()
+ */
+int webrtc_get_local_description(webrtc_h webrtc, char **description);
+
 /**
  * @brief Sets the session description of the remote peer's current offer or answer.
  * @since_tizen 6.5
@@ -2534,9 +2552,27 @@ int webrtc_set_local_description(webrtc_h webrtc, const char *description);
  * @see webrtc_state_changed_cb()
  * @see webrtc_set_signaling_state_change_cb()
  * @see webrtc_get_signaling_state()
+ * @see webrtc_get_remote_description()
  */
 int webrtc_set_remote_description(webrtc_h webrtc, const char *description);
 
+/**
+ * @brief Gets the remote session description.
+ * @since_tizen 9.0
+ * @remarks @a description is a JSON string.\n
+ *          It should be {"sdp":{"type":"offer or answer","sdp":"..."}}.\n
+ *          The @a description should be released using free() if the value is not NULL.
+ * @param[in] webrtc       WebRTC handle
+ * @param[out] description The remote session description
+ * @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_remote_description()
+ */
+int webrtc_get_remote_description(webrtc_h webrtc, char **description);
+
 /**
  * @brief Adds a new ICE candidate from the remote peer over its signaling channel.
  * @since_tizen 6.5
index 3481ca56bb812fbec0640e225ffeec5acbf84fe5..f7660705c4e1d79761319653a32760f7c16fccdd 100644 (file)
@@ -478,42 +478,6 @@ int webrtc_media_source_get_type(webrtc_h webrtc, unsigned int source_id, webrtc
  */
 int webrtc_null_source_set_media_type(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type);
 
-/**
- * @internal
- * @brief Gets the local session description.
- * @since_tizen 8.0
- * @remarks @a description is a JSON string.\n
- *          It will be {"sdp":{"type":"offer or answer","sdp":"..."}}.\n
- *          The @a description should be released using free() if the value is not NULL.
- * @param[in] webrtc       WebRTC handle
- * @param[out] description The local session description
- * @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_local_description()
- */
-int webrtc_get_local_description(webrtc_h webrtc, char **description);
-
-/**
- * @internal
- * @brief Gets the remote session description.
- * @since_tizen 8.0
- * @remarks @a description is a JSON string.\n
- *          It should be {"sdp":{"type":"offer or answer","sdp":"..."}}.\n
- *          The @a description should be released using free() if the value is not NULL.
- * @param[in] webrtc       WebRTC handle
- * @param[out] description The remote session description
- * @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_remote_description()
- */
-int webrtc_get_remote_description(webrtc_h webrtc, char **description);
-
 /**
  * @internal
  * @brief Sets the probability of RTP packet dropping.
index 3761ee12becdab0f6a071805d97fc7344c0ca61b..d5b9f3d64ec47437d1a2b2e5c22a3e6664eec996 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    1.1.21
+Version:    1.1.22
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index e9db0c90035692dd57beefeb1d7b0a27a7de20fa..d20fed62fba94fe8bdb597f840e5d3416d967796 100644 (file)
@@ -1722,6 +1722,26 @@ int webrtc_set_local_description(webrtc_h webrtc, const char *description)
        return _webrtcbin_set_session_description(webrtc, description, false);
 }
 
+int webrtc_get_local_description(webrtc_h webrtc, char **description)
+{
+       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(description == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "description is NULL");
+
+       locker = g_mutex_locker_new(&_webrtc->mutex);
+
+       if (_webrtc->local_desc)
+               *description = strdup(_webrtc->local_desc);
+       else
+               *description = NULL;
+
+       LOG_INFO("webrtc[%p] description: %s", _webrtc, *description);
+
+       return WEBRTC_ERROR_NONE;
+}
+
 int webrtc_set_remote_description(webrtc_h webrtc, const char *description)
 {
        g_autoptr(GMutexLocker) locker = NULL;
@@ -1739,6 +1759,26 @@ int webrtc_set_remote_description(webrtc_h webrtc, const char *description)
        return _webrtcbin_set_session_description(webrtc, description, true);
 }
 
+int webrtc_get_remote_description(webrtc_h webrtc, char **description)
+{
+       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(description == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "description is NULL");
+
+       locker = g_mutex_locker_new(&_webrtc->mutex);
+
+       if (_webrtc->remote_desc)
+               *description = strdup(_webrtc->remote_desc);
+       else
+               *description = NULL;
+
+       LOG_INFO("webrtc[%p] description: %s", _webrtc, *description);
+
+       return WEBRTC_ERROR_NONE;
+}
+
 int webrtc_add_ice_candidate(webrtc_h webrtc, const char *candidate)
 {
        g_autoptr(GMutexLocker) locker = NULL;
index 4a1268ba7bf56866084f1972bbb476bc5a64b7c6..0a6338149f03bd5a39615bcd6cf9dba0d59ddd59 100644 (file)
@@ -470,46 +470,6 @@ int webrtc_null_source_set_media_type(webrtc_h webrtc, unsigned int source_id, w
        return WEBRTC_ERROR_NONE;
 }
 
-int webrtc_get_local_description(webrtc_h webrtc, char **description)
-{
-       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(description == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "description is NULL");
-
-       locker = g_mutex_locker_new(&_webrtc->mutex);
-
-       if (_webrtc->local_desc)
-               *description = strdup(_webrtc->local_desc);
-       else
-               *description = NULL;
-
-       LOG_INFO("webrtc[%p] description: %s", _webrtc, *description);
-
-       return WEBRTC_ERROR_NONE;
-}
-
-int webrtc_get_remote_description(webrtc_h webrtc, char **description)
-{
-       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(description == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "description is NULL");
-
-       locker = g_mutex_locker_new(&_webrtc->mutex);
-
-       if (_webrtc->remote_desc)
-               *description = strdup(_webrtc->remote_desc);
-       else
-               *description = NULL;
-
-       LOG_INFO("webrtc[%p] description: %s", _webrtc, *description);
-
-       return WEBRTC_ERROR_NONE;
-}
-
 int webrtc_util_strip_description(const char *origin_description, char **description)
 {
        g_autoptr(JsonParser) parser = NULL;