From: Sangchul Lee Date: Wed, 10 Jan 2024 08:13:25 +0000 (+0900) Subject: webrtc_transceiver: Fix unwanted payload type number order X-Git-Tag: accepted/tizen/8.0/unified/20240112.155130~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=235e2f510be1ebcd1d8bdeb589b8b2bcc4a8f024;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_transceiver: Fix unwanted payload type number order This patch fixes the issue where there is another media source added before the null source, the payload type number gets reversed because the payload type number of the null source type was obtained when calling webrtc_media_source_set_transceiver_codec() whereas other source type get it when calling webrtc_start(). [Version] 0.4.32 [Issue Type] Bug fix Change-Id: Ib438dc280c843ddf8652d114a4ced23319f73b71 Signed-off-by: Sangchul Lee --- diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 40a9658b..2b53668e 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: 0.4.31 +Version: 0.4.32 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_transceiver.c b/src/webrtc_transceiver.c index afaf10c7..6224c6fd 100644 --- a/src/webrtc_transceiver.c +++ b/src/webrtc_transceiver.c @@ -426,6 +426,12 @@ int _add_transceiver(webrtc_gst_slot_s *source, webrtc_media_type_e media_type, g_signal_emit_by_name(source->webrtc->gst.webrtcbin, "add-transceiver", GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_RECVONLY, caps, &trans, NULL); gst_object_unref(trans); + + if (source->av[av_idx].pt >= MIN_DYNAMIC_PAYLOAD_TYPE && !source->av[av_idx].pt_set_by_api) + _return_payload_type(source->webrtc, source->av[av_idx].pt); + + if ((_set_payload_type(source->webrtc, source, av_idx, payload_info->gst_media_type)) != WEBRTC_ERROR_NONE) + return WEBRTC_ERROR_INVALID_OPERATION; } else { g_object_set(G_OBJECT(source->av[av_idx].transceiver), "codec-preferences", caps, NULL); } @@ -659,14 +665,6 @@ int _set_transceiver_codec(webrtc_s *webrtc, unsigned int source_id, webrtc_medi source->av[av_idx].codec = payload_info->encoding_name; - if (source->type == WEBRTC_MEDIA_SOURCE_TYPE_NULL) { - if (source->av[av_idx].pt >= MIN_DYNAMIC_PAYLOAD_TYPE) - _return_payload_type(webrtc, source->av[av_idx].pt); - - if ((ret = _set_payload_type(webrtc, source, av_idx, payload_info->gst_media_type)) != WEBRTC_ERROR_NONE) - return ret; - } - /* FIXME: to utilize 'codec-preferences' of trans object, we need to re-create and re-link elements again */ LOG_INFO("webrtc[%p] source_id[%u] media_type[%d] codec[%s]", webrtc, source_id, media_type, payload_info->encoding_name);