webrtc_transceiver: Add encoding-params(2) to caps in case of OPUS codec 25/281425/3 accepted/tizen/unified/20220920.160554
authorSangchul Lee <sc11.lee@samsung.com>
Fri, 16 Sep 2022 13:14:24 +0000 (22:14 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Tue, 20 Sep 2022 01:23:18 +0000 (10:23 +0900)
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 <sc11.lee@samsung.com>
packaging/capi-media-webrtc.spec
src/webrtc_transceiver.c

index 0b901b90ef998ad372f94e930517811bb092d120..96e56f50f0f160eb1185bcff7945f11253422640 100644 (file)
@@ -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
index 4790989998bcf85f23cf9b64c01794b398c94917..582a2804aacf118643bbc06d17ff37ee612287f4 100644 (file)
@@ -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)