Functions have been added as below.
- webrtc_get_local_description()
- webrtc_get_remote_description()
[Version] 0.4.43
[Issue Type] Internal API
Change-Id: Ifb481b4b005a40145e959d31e3d2ccc3bb6c23f1
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
*/
int webrtc_media_source_active_transceiver_encoding(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, const char *rid, bool active);
+/**
+ * @internal
+ * @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);
+
+/**
+ * @internal
+ * @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);
+
/**
* @internal
* @brief Sets the probability of RTP packet dropping.
gchar *desc_offer;
gchar *desc_answer;
+ gchar *local_desc;
+ gchar *remote_desc;
webrtc_data_recovery_type_s data_recovery_types[MAX_MLINE_NUM];
Name: capi-media-webrtc
Summary: A WebRTC library in Tizen Native API
-Version: 0.4.42
+Version: 0.4.43
Release: 0
Group: Multimedia/API
License: Apache-2.0
return _active_transceiver_encoding(webrtc, source_id, media_type, rid, active);
}
+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_set_rtp_packet_drop_probability(webrtc_h webrtc, bool sender, float probability)
{
webrtc_s *_webrtc = (webrtc_s *)webrtc;
g_free(webrtc->desc_answer);
webrtc->desc_answer = NULL;
}
+ if (webrtc->local_desc) {
+ g_free(webrtc->local_desc);
+ webrtc->local_desc = NULL;
+ }
+ if (webrtc->remote_desc) {
+ g_free(webrtc->remote_desc);
+ webrtc->remote_desc = NULL;
+ }
}
int _gst_pipeline_set_state(webrtc_s *webrtc, GstState state)
LOG_DEBUG("[%s] signal is emitted", is_remote ? "set-remote-description" : "set-local-description");
+ if (is_remote) {
+ g_free(webrtc->remote_desc);
+ webrtc->remote_desc = g_strdup(description);
+ } else {
+ g_free(webrtc->local_desc);
+ webrtc->local_desc = g_strdup(description);
+ }
end:
g_free(sdp);
g_free(type);