From: Sangchul Lee Date: Fri, 27 Aug 2021 08:40:02 +0000 (+0900) Subject: webrtc_source: Use fixed payload id for particular codecs X-Git-Tag: submit/tizen/20210901.024939~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F79%2F263179%2F3;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_source: Use fixed payload id for particular codecs 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 --- diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index f9e01af3..3b309c64 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.2.87 +Version: 0.2.88 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_source.c b/src/webrtc_source.c index 1302bea5..4a5c8cab 100644 --- a/src/webrtc_source.c +++ b/src/webrtc_source.c @@ -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;