From e49fe1ad8d7b158e51755dccfec03e65a7f26a28 Mon Sep 17 00:00:00 2001 From: Sangchul Lee Date: Thu, 6 Feb 2025 17:47:07 +0900 Subject: [PATCH] webrtc_source_private: Fix caps for OPUS codec opus selection menu is also added to webrtc_test for testing webrtc_media_packet_source_set_format(). [Version] 1.1.46 [Issue Type] Bug fix Change-Id: Ia932a134b15554e99fe917705835c8b086f9cc06 Signed-off-by: Sangchul Lee --- packaging/capi-media-webrtc.spec | 2 +- src/webrtc_source_private.c | 8 ++++++-- test/webrtc_test.c | 13 +++++++++---- test/webrtc_test_menu.c | 2 +- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 8c4026f5..57e083cb 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: 1.1.45 +Version: 1.1.46 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_source_private.c b/src/webrtc_source_private.c index f9af92b6..22ad6845 100644 --- a/src/webrtc_source_private.c +++ b/src/webrtc_source_private.c @@ -123,8 +123,12 @@ GstCaps *_get_caps_from_encoded_audio_media_type(const char *media_type, int cha "channels", G_TYPE_INT, channels, NULL); - if (!strcmp(media_type, MEDIA_TYPE_AUDIO_OPUS) || - !strcmp(media_type, MEDIA_TYPE_AUDIO_VORBIS)) + if (!strcmp(media_type, MEDIA_TYPE_AUDIO_OPUS)) + return gst_caps_new_simple(media_type, + "channel-mapping-family", G_TYPE_INT, 0, + NULL); + + if (!strcmp(media_type, MEDIA_TYPE_AUDIO_VORBIS)) return gst_caps_new_simple(media_type, NULL, NULL); LOG_ERROR_IF_REACHED("invalid media_type(%s)", media_type); diff --git a/test/webrtc_test.c b/test/webrtc_test.c index 8384ac89..232ac446 100644 --- a/test/webrtc_test.c +++ b/test/webrtc_test.c @@ -658,9 +658,11 @@ static int __create_formats(media_format_mimetype_e type, media_format_h *format if (type & MEDIA_FORMAT_AUDIO) { ret = media_format_set_audio_mime(*format, type); - ret |= media_format_set_audio_channel(*format, AUDIO_CHANNEL); - ret |= media_format_set_audio_samplerate(*format, AUDIO_SAMPLERATE); - ret |= media_format_set_audio_bit(*format, 16); + if (type != MEDIA_FORMAT_OPUS) { + ret |= media_format_set_audio_channel(*format, AUDIO_CHANNEL); + ret |= media_format_set_audio_samplerate(*format, AUDIO_SAMPLERATE); + ret |= media_format_set_audio_bit(*format, 16); + } if (ret != MEDIA_FORMAT_ERROR_NONE) { g_print("failed to set audio format\n"); goto error; @@ -710,9 +712,12 @@ static void _webrtc_media_packet_source_set_format(int index, unsigned int sourc type = MEDIA_FORMAT_PCM_S16LE; break; case 4: - type = MEDIA_FORMAT_H264_SP; + type = MEDIA_FORMAT_OPUS; break; case 5: + type = MEDIA_FORMAT_H264_SP; + break; + case 6: type = MEDIA_FORMAT_VP8; break; default: diff --git a/test/webrtc_test_menu.c b/test/webrtc_test_menu.c index 16b2d17f..9804a8c8 100644 --- a/test/webrtc_test_menu.c +++ b/test/webrtc_test_menu.c @@ -475,7 +475,7 @@ void display_menu_webrtc_media_source(void) if (get_appdata()->input_count == 0) g_print("*** input source id.\n"); else if (get_appdata()->input_count == 1) - g_print("*** input media format.(1:I420 2:NV12 3:PCM_S16LE 4:H264 5:VP8)\n"); + g_print("*** input media format.(1:I420 2:NV12 3:PCM_S16LE 4:OPUS 5:H264 6:VP8)\n"); break; case CURRENT_STATUS_START_PUSHING_PACKET_TO_MEDIA_PACKET_SOURCE: g_print("*** input media packet source id to start pushing packet.\n"); -- 2.34.1