* @param[in] target_bitrate The target bitrate of the encoder
* @param[in] width The video width (video only)
* @param[in] height The video height (video only)
+ * @param[out] ssrc The SSRC (optional, this can be NULL)
* @return @c 0 on success,
* otherwise a negative error value
* @retval #WEBRTC_ERROR_NONE Successful
* @pre Add media source to @a webrtc to get @a source_id by calling webrtc_add_media_source().
* @see webrtc_media_source_remove_transceiver_encoding()
*/
-int webrtc_media_source_add_transceiver_encoding(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, const char *rid, int target_bitrate, int width, int height);
+int webrtc_media_source_add_transceiver_encoding(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, const char *rid, int target_bitrate, int width, int height, int *ssrc);
/**
* @internal
int _set_transceiver_codec(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_codec_e codec);
int _get_transceiver_codec(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_codec_e *codec);
int _foreach_supported_transceiver_codec(webrtc_s *webrtc, webrtc_media_source_type_e source_type, webrtc_media_type_e media_type, webrtc_media_source_supported_transceiver_codec_cb callback, void *user_data);
-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 _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 *ssrc);
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);
Name: capi-media-webrtc
Summary: A WebRTC library in Tizen Native API
-Version: 1.1.16
+Version: 1.1.17
Release: 0
Group: Multimedia/API
License: Apache-2.0
return WEBRTC_ERROR_NONE;
}
-int webrtc_media_source_add_transceiver_encoding(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, const char *rid, int target_bitrate, int width, int height)
+int webrtc_media_source_add_transceiver_encoding(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, const char *rid, int target_bitrate, int width, int height, int *ssrc)
{
g_autoptr(GMutexLocker) locker = NULL;
webrtc_s *_webrtc = (webrtc_s *)webrtc;
locker = g_mutex_locker_new(&_webrtc->mutex);
- return _add_transceiver_encoding(webrtc, source_id, media_type, rid, target_bitrate, width, height);
+ return _add_transceiver_encoding(webrtc, source_id, media_type, rid, target_bitrate, width, height, ssrc);
}
int webrtc_media_source_remove_transceiver_encoding(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, const char *rid)
}
//LCOV_EXCL_START
-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 _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 *ssrc)
{
int ret;
webrtc_gst_slot_s *source;
int av_idx = (media_type == WEBRTC_MEDIA_TYPE_AUDIO) ? AV_IDX_AUDIO : AV_IDX_VIDEO;
- int ssrc;
+ int _ssrc;
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");
if (source->type == WEBRTC_MEDIA_SOURCE_TYPE_NULL)
LOG_DEBUG("NULL source type, skip target_bitrate[%d] width[%d] height[%d] parameters", target_bitrate, width, height);
- ret = _add_source_encoding(source, av_idx, rid, target_bitrate, width, height, &ssrc);
+ ret = _add_source_encoding(source, av_idx, rid, target_bitrate, width, height, &_ssrc);
if (ret != WEBRTC_ERROR_NONE)
return ret;
switch (source->type) {
case WEBRTC_MEDIA_SOURCE_TYPE_AUDIOTEST:
case WEBRTC_MEDIA_SOURCE_TYPE_MIC:
- ret = _build_audiosrc(webrtc, source, source->type == WEBRTC_MEDIA_SOURCE_TYPE_MIC, ssrc);
+ ret = _build_audiosrc(webrtc, source, source->type == WEBRTC_MEDIA_SOURCE_TYPE_MIC, _ssrc);
break;
case WEBRTC_MEDIA_SOURCE_TYPE_VIDEOTEST:
- ret = _build_videotestsrc(webrtc, source, ssrc);
+ ret = _build_videotestsrc(webrtc, source, _ssrc);
break;
case WEBRTC_MEDIA_SOURCE_TYPE_NULL:
return WEBRTC_ERROR_NONE;
return WEBRTC_ERROR_INVALID_PARAMETER;
}
- return _set_transceiver_direction(webrtc, source_id, media_type, WEBRTC_TRANSCEIVER_DIRECTION_SENDONLY);
+ ret = _set_transceiver_direction(webrtc, source_id, media_type, WEBRTC_TRANSCEIVER_DIRECTION_SENDONLY);
+ if (ret == WEBRTC_ERROR_NONE) {
+ if (ssrc)
+ *ssrc = _ssrc;
+ }
+ return ret;
}
int _remove_transceiver_encoding(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, const char *rid)
static void _webrtc_media_source_add_transceiver_encoding(int index, unsigned int source_id, webrtc_media_type_e media_type, const char *rid, int target_bitrate, int w, int h)
{
- int ret = webrtc_media_source_add_transceiver_encoding(g_ad.conns[index].webrtc, source_id, media_type, rid, target_bitrate, w, h);
+ int ssrc;
+ int ret = webrtc_media_source_add_transceiver_encoding(g_ad.conns[index].webrtc, source_id, media_type, rid, target_bitrate, w, h, &ssrc);
RET_IF(ret != WEBRTC_ERROR_NONE, "ret[0x%x]", ret);
- g_print("webrtc_media_source_add_transceiver_encoding() success, source_id[%u], media_type[%s], rid[%s], target_bitrate[%d], [%dx%d]\n",
- source_id, g_webrtc_media_type_str[media_type], rid, target_bitrate, w, h);
+ g_print("webrtc_media_source_add_transceiver_encoding() success, source_id[%u], media_type[%s], rid[%s], target_bitrate[%d], [%dx%d], ssrc[%d]\n",
+ source_id, g_webrtc_media_type_str[media_type], rid, target_bitrate, w, h, ssrc);
}
static void _webrtc_media_source_remove_transceiver_encoding(int index, unsigned int source_id, webrtc_media_type_e media_type, const char *rid)