webrtc_media_source_get_transceiver_mid() has been added.
[Version] 0.4.45
[Issue Type] Internal API
Change-Id: Ia69250ac27b46c68e01bbae125ebbbd103d874da
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);
+/**
+ * @brief Gets the transceiver media id of the media source.
+ * @since_tizen 8.0
+ * @remarks The @a mid should be released using free() if the value is not NULL.
+ * @param[in] webrtc WebRTC handle
+ * @param[in] source_id The media source id
+ * @param[in] media_type The media type
+ * @param[out] mid The transceiver media id
+ * @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
+ * @pre Add media source to @a webrtc to get @a source_id by calling webrtc_add_media_source().
+ * @pre Call webrtc_start() before calling this function, otherwise NULL can be set to @a mid.
+ */
+int webrtc_media_source_get_transceiver_mid(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, char **mid);
+
/**
* @internal
* @brief Gets the media type of the media source.
int _add_transceiver_encoding(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, const char *rid, int target_bitrate, int width, int height);
int _remove_transceiver_encoding(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, const char *rid);
int _active_transceiver_encoding(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, const char *rid, bool active);
+int _get_transceiver_mid(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, char **mid);
GstCaps *_make_rtp_caps_with_encoding(webrtc_gst_slot_s *source, bool is_audio);
/* file source */
Name: capi-media-webrtc
Summary: A WebRTC library in Tizen Native API
-Version: 0.4.44
+Version: 0.4.45
Release: 0
Group: Multimedia/API
License: Apache-2.0
return _active_transceiver_encoding(webrtc, source_id, media_type, rid, active);
}
+int webrtc_media_source_get_transceiver_mid(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, char **mid)
+{
+ 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(source_id == 0, WEBRTC_ERROR_INVALID_PARAMETER, "source_id is 0");
+ RET_VAL_IF(mid == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "mid is NULL");
+
+ locker = g_mutex_locker_new(&_webrtc->mutex);
+
+ return _get_transceiver_mid(webrtc, source_id, media_type, mid);
+}
+
int webrtc_media_source_get_type(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e *media_type)
{
webrtc_s *_webrtc = (webrtc_s *)webrtc;
return __active_encoding(source, av_idx, rid, active);
}
+
+int _get_transceiver_mid(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, char **mid)
+{
+ webrtc_gst_slot_s *source;
+ int av_idx = (media_type == WEBRTC_MEDIA_TYPE_AUDIO) ? AV_IDX_AUDIO : AV_IDX_VIDEO;
+
+ RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
+ RET_VAL_IF((source = _get_slot_by_id(webrtc->gst.source_slots, source_id)) == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
+ RET_VAL_IF(mid == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "mid is NULL");
+
+ if (source->av[av_idx].mid)
+ *mid = strdup(source->av[av_idx].mid);
+ else
+ *mid = NULL;
+
+ LOG_INFO("source_id[%u], av_idx[%d], mid[%s]", source->id, av_idx, *mid);
+
+ return WEBRTC_ERROR_NONE;
+}