webrtc_source: Use fixed payload id for particular codecs 79/263179/3
authorSangchul Lee <sc11.lee@samsung.com>
Fri, 27 Aug 2021 08:40:02 +0000 (17:40 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Tue, 31 Aug 2021 02:49:13 +0000 (11:49 +0900)
This patch enables normal operation with that codecs between
web API and gstreamer webrtc at last.

[Version] 0.2.88
[Issue Type] Improvement

Change-Id: Ib4094ac5814d59632032f649a69e0b45bc5b4b1d
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/capi-media-webrtc.spec
src/webrtc_source.c

index f9e01af36fdd91705f1a653efad7a83f113b0548..3b309c64ab78647c35131e25f4c52e43f87c0c59 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.2.87
+Version:    0.2.88
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 1302bea51c8c755861e99030283a4f0e7980a906..4a5c8cab6d695695cb167184aad4fe2f5d0a5b4d 100644 (file)
@@ -681,6 +681,19 @@ static bool __is_encoded_format_supported(webrtc_media_source_type_e type, webrt
        return ini_source->v_encoded_fmt_support;
 }
 
+static int __get_fixed_payload_id(const gchar *media_type)
+{
+       RET_VAL_IF(media_type == NULL, -1, "media_type is NULL");
+
+       if (!g_strcmp0(media_type, MEDIA_TYPE_AUDIO_MULAW))
+               return 0;
+       if (!g_strcmp0(media_type, MEDIA_TYPE_AUDIO_ALAW))
+               return 8;
+
+       LOG_DEBUG("%s might need to use dynamic id", media_type);
+       return -1;
+}
+
 static unsigned int __get_available_payload_id(webrtc_s *webrtc)
 {
        int bitmask = 0x1;
@@ -807,7 +820,7 @@ static int __create_rest_of_elements(webrtc_s *webrtc, webrtc_gst_slot_s *source
        const gchar *encoder_klass_name;
        gchar *media_type = NULL;
        gchar *encoder_name = NULL;
-       unsigned int payload_id;
+       int payload_id;
        int idx;
 
        RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
@@ -895,8 +908,9 @@ skip_encoder:
                goto error;
        APPEND_ELEMENT(*element_list, capsfilter2);
 
-       if ((payload_id = __get_available_payload_id(webrtc)) == 0)
-               goto error;
+       if ((payload_id = __get_fixed_payload_id(media_type)) == -1)
+               if ((payload_id = __get_available_payload_id(webrtc)) == 0)
+                       goto error;
 
        source->av[idx].payload_id = payload_id;