From: Sangchul Lee Date: Wed, 24 Jul 2024 10:17:06 +0000 (+0900) Subject: webrtc_internal: Add 'ssrc' outparam to webrtc_media_source_add_transceiver_encoding() X-Git-Tag: accepted/tizen/unified/20240727.112747~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ed0e8ea55a16cefde24fe5bd8074d7cceb3e5c8a;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_internal: Add 'ssrc' outparam to webrtc_media_source_add_transceiver_encoding() [Version] 1.1.17 [Issue Type] API Change-Id: I5b2be20c9e2c635edc9612fe64671c22f68eb73d Signed-off-by: Sangchul Lee --- diff --git a/include/webrtc_internal.h b/include/webrtc_internal.h index b3b7be9a..364f2612 100644 --- a/include/webrtc_internal.h +++ b/include/webrtc_internal.h @@ -349,6 +349,7 @@ int webrtc_media_source_get_payload_type(webrtc_h webrtc, unsigned int source_id * @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 @@ -357,7 +358,7 @@ int webrtc_media_source_get_payload_type(webrtc_h webrtc, unsigned int source_id * @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 diff --git a/include/webrtc_private.h b/include/webrtc_private.h index 063c5043..5b9e4da6 100644 --- a/include/webrtc_private.h +++ b/include/webrtc_private.h @@ -761,7 +761,7 @@ int _get_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_ 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); diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 728e7394..29030ca9 100644 --- a/packaging/capi-media-webrtc.spec +++ b/packaging/capi-media-webrtc.spec @@ -1,6 +1,6 @@ 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 diff --git a/src/webrtc_internal.c b/src/webrtc_internal.c index 4135c7a2..0c559567 100644 --- a/src/webrtc_internal.c +++ b/src/webrtc_internal.c @@ -309,7 +309,7 @@ int webrtc_media_source_get_payload_type(webrtc_h webrtc, unsigned int source_id 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; @@ -319,7 +319,7 @@ int webrtc_media_source_add_transceiver_encoding(webrtc_h webrtc, unsigned int s 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) diff --git a/src/webrtc_transceiver.c b/src/webrtc_transceiver.c index e11642bb..e4f0705e 100644 --- a/src/webrtc_transceiver.c +++ b/src/webrtc_transceiver.c @@ -842,12 +842,12 @@ int _get_transceiver_codec(webrtc_s *webrtc, unsigned int source_id, webrtc_medi } //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"); @@ -866,17 +866,17 @@ int _add_transceiver_encoding(webrtc_s *webrtc, unsigned int source_id, webrtc_m 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; @@ -886,7 +886,12 @@ int _add_transceiver_encoding(webrtc_s *webrtc, unsigned int source_id, webrtc_m 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) diff --git a/test/webrtc_test.c b/test/webrtc_test.c index 81cddde0..bad2081a 100644 --- a/test/webrtc_test.c +++ b/test/webrtc_test.c @@ -1225,11 +1225,12 @@ static void _webrtc_media_source_set_payload_type(int index, unsigned int source 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)