From: Sangchul Lee Date: Fri, 16 Sep 2022 13:14:24 +0000 (+0900) Subject: webrtc_transceiver: Add encoding-params(2) to caps in case of OPUS codec X-Git-Tag: accepted/tizen/unified/20220920.160554^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3f1f840d1d8e323d61bf31f4c9a0c219676a04c2;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_transceiver: Add encoding-params(2) to caps in case of OPUS codec It represents channels. In case of gst to gst, it worked fine without it. But in case of gst to web, it does not work(web API failure). It is also mandatory according to RFC7587, so it is added. These codes are related to OPUS media of 'recvonly' in offer description. [Version] 0.3.242 [Issue Type] Improvement / Compatibility Change-Id: I57596fbb5b9b7c99efe856e5127de36d89ef6d88 Signed-off-by: Sangchul Lee --- diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 0b901b90..96e56f50 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.3.241 +Version: 0.3.242 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_transceiver.c b/src/webrtc_transceiver.c index 47909899..582a2804 100644 --- a/src/webrtc_transceiver.c +++ b/src/webrtc_transceiver.c @@ -180,14 +180,23 @@ void _update_transceivers_fec(webrtc_s *webrtc, bool is_offer) //LCOV_EXCL_START static GstCaps *__make_transceiver_caps_with_pt(rtp_payload_info_s *payload_info, int payload_type) { + GstCaps *caps; + RET_VAL_IF(payload_info == NULL, NULL, "payload_info is NULL"); - return gst_caps_new_simple("application/x-rtp", + caps = gst_caps_new_simple("application/x-rtp", "media", G_TYPE_STRING, payload_info->media_type, "encoding-name", G_TYPE_STRING, payload_info->encoding_name, "clock-rate", G_TYPE_INT, payload_info->clock_rate, "payload", G_TYPE_INT, payload_type, NULL); + + if (payload_info->codec == WEBRTC_TRANSCEIVER_CODEC_OPUS) + gst_caps_set_simple(caps, + "encoding-params", G_TYPE_STRING, "2", + NULL); + + return caps; } static int __update_transceiver_with_pt(webrtc_gst_slot_s *source, webrtc_media_type_e media_type, rtp_payload_info_s *payload_info) @@ -375,13 +384,22 @@ void _check_and_add_recvonly_transceiver(webrtc_gst_slot_s *source) static GstCaps *__make_transceiver_caps(rtp_payload_info_s *payload_info) { + GstCaps *caps; + RET_VAL_IF(payload_info == NULL, NULL, "payload_info is NULL"); - return gst_caps_new_simple("application/x-rtp", + caps = gst_caps_new_simple("application/x-rtp", "media", G_TYPE_STRING, payload_info->media_type, "encoding-name", G_TYPE_STRING, payload_info->encoding_name, "clock-rate", G_TYPE_INT, payload_info->clock_rate, NULL); + + if (payload_info->codec == WEBRTC_TRANSCEIVER_CODEC_OPUS) + gst_caps_set_simple(caps, + "encoding-params", G_TYPE_STRING, "2", + NULL); + + return caps; } int _add_transceiver(webrtc_gst_slot_s *source, webrtc_media_type_e media_type, rtp_payload_info_s *payload_info)