From: Jaechul Lee Date: Mon, 24 Jul 2023 06:07:03 +0000 (+0900) Subject: webrtc_private: Change to use effect_method API X-Git-Tag: accepted/tizen/unified/20230727.173034^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8183700ac02292bb7ee4858406521c4a1d37f0bf;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_private: Change to use effect_method API AEC APIs in sound-manager have been changed. [Version] 0.4.16 [Issue Type] Feature Change-Id: Idd9a9988b80aa47e72639e14724d40ce0a4406b7 Signed-off-by: Jaechul Lee --- diff --git a/include/webrtc_private.h b/include/webrtc_private.h index 19116c77..1efae2d0 100644 --- a/include/webrtc_private.h +++ b/include/webrtc_private.h @@ -302,6 +302,8 @@ typedef enum { #define SIGNALING_MESSAGE_PREFIX_ICE_CANDIDATE "ICE_CANDIDATE" #define SIGNALING_MESSAGE_PREFIX_ERROR "ERROR" +#define STREAM_NO_REFERENCE_DEVICE 0 + typedef enum { MEDIA_TYPE_AUDIO = 0x01, MEDIA_TYPE_VIDEO = 0x02, diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 8298e48f..aecd121c 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.4.15 +Version: 0.4.16 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_private.c b/src/webrtc_private.c index 719b42a8..10c39a12 100644 --- a/src/webrtc_private.c +++ b/src/webrtc_private.c @@ -2164,7 +2164,7 @@ int _apply_stream_info(GstElement *element, const char *stream_type, int stream_ GstStructure *structure; g_autofree gchar *prop = NULL; g_autofree gchar *prop_with_aec = NULL; - bool aec = (aec_ref_device_id != SOUND_MANAGER_STREAM_NO_REFERENCE_DEVICE); + bool aec = false; RET_VAL_IF(element == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "element is NULL"); RET_VAL_IF(stream_type == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "stream_type is NULL"); @@ -2172,9 +2172,10 @@ int _apply_stream_info(GstElement *element, const char *stream_type, int stream_ WEBRTC_ERROR_INVALID_OPERATION, "could not find 'stream-properties'"); prop = g_strdup_printf("props,%s=%s, %s=%d", PA_PROP_MEDIA_ROLE, stream_type, PA_PROP_MEDIA_PARENT_ID, stream_index); - if (aec) { + if (aec_ref_device_id > STREAM_NO_REFERENCE_DEVICE) { prop_with_aec = g_strdup_printf("%s, %s=%s, %s=%d", prop, PA_PROP_MEDIA_PREPROCESSOR_METHOD, "webrtc", PA_PROP_MEDIA_ECHO_CANCEL_REFERENCE_DEVICE, aec_ref_device_id); + aec = true; } RET_VAL_IF(!(structure = gst_structure_from_string(aec ? prop_with_aec : prop, NULL)), diff --git a/src/webrtc_sink.c b/src/webrtc_sink.c index 59328adc..7fdde98a 100644 --- a/src/webrtc_sink.c +++ b/src/webrtc_sink.c @@ -319,7 +319,7 @@ static int __build_audiosink(webrtc_s *webrtc, GstElement *decodebin, GstPad *sr if (g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(audiosink)), "stream-properties")) { if (sink->sound_stream_info.type) { ret = _apply_stream_info(audiosink, sink->sound_stream_info.type, sink->sound_stream_info.index, - SOUND_MANAGER_STREAM_NO_REFERENCE_DEVICE); + STREAM_NO_REFERENCE_DEVICE); if (ret != WEBRTC_ERROR_NONE) goto exit; } diff --git a/src/webrtc_source.c b/src/webrtc_source.c index 5a6f4343..db575a64 100644 --- a/src/webrtc_source.c +++ b/src/webrtc_source.c @@ -969,8 +969,8 @@ int _set_sound_stream_info(webrtc_s *webrtc, unsigned int source_id, sound_strea bool available = false; char *stream_type; int stream_index; - int aec_ref_device_id = 0; - sound_acoustic_echo_cancel_type_e aec_type; + int aec_ref_device_id = STREAM_NO_REFERENCE_DEVICE; + sound_effect_method_with_reference_e method; RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); RET_VAL_IF((source = _get_slot_by_id(webrtc->gst.source_slots, source_id)) == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "could not find source"); @@ -982,7 +982,10 @@ int _set_sound_stream_info(webrtc_s *webrtc, unsigned int source_id, sound_strea sound_manager_get_type_from_stream_information(stream_info, &stream_type); sound_manager_get_index_from_stream_information(stream_info, &stream_index); - sound_manager_get_echo_cancel_reference_device(stream_info, &aec_ref_device_id, &aec_type); + + ret = sound_manager_get_effect_method_with_reference(stream_info, &method, &aec_ref_device_id); + if (ret == SOUND_MANAGER_ERROR_NONE) + LOG_INFO("Got effect method information. method[%d], aec_ref_device_id[%d]", method, aec_ref_device_id); ret = sound_manager_is_available_stream_information(stream_info, NATIVE_API_WEBRTC, &available); if (ret != SOUND_MANAGER_ERROR_NONE) { @@ -995,8 +998,8 @@ int _set_sound_stream_info(webrtc_s *webrtc, unsigned int source_id, sound_strea return WEBRTC_ERROR_INVALID_PARAMETER; } - LOG_INFO("webrtc[%p], source_id[%u], stream_info[%p, type:%s, index:%d, aec_ref_device_id:%d, aec_type:%d]", - webrtc, source_id, stream_info, stream_type, stream_index, aec_ref_device_id, aec_type); + LOG_INFO("webrtc[%p], source_id[%u], stream_info[%p, type:%s, index:%d]", + webrtc, source_id, stream_info, stream_type, stream_index); return _apply_stream_info(element, stream_type, stream_index, aec_ref_device_id); } diff --git a/src/webrtc_source_loopback.c b/src/webrtc_source_loopback.c index a9a1efe5..7455f6e6 100644 --- a/src/webrtc_source_loopback.c +++ b/src/webrtc_source_loopback.c @@ -50,7 +50,7 @@ static int __build_loopback_audiosink(webrtc_gst_slot_s *source, GstElement *lin if (g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(audiosink)), "stream-properties")) { if (source->sound_stream_info.type) { ret = _apply_stream_info(audiosink, source->sound_stream_info.type, source->sound_stream_info.index, - SOUND_MANAGER_STREAM_NO_REFERENCE_DEVICE); + STREAM_NO_REFERENCE_DEVICE); if (ret != WEBRTC_ERROR_NONE) goto exit; } diff --git a/test/webrtc_test.c b/test/webrtc_test.c index 85c99882..feb3a986 100644 --- a/test/webrtc_test.c +++ b/test/webrtc_test.c @@ -382,7 +382,7 @@ static void __set_aec_reference_device(sound_stream_info_h stream_info) found = true; - ret = sound_manager_set_echo_cancel_reference_device(stream_info, device, SOUND_ACOUSTIC_ECHO_CANCEL_VOICE_CALL); + ret = sound_manager_set_effect_method_with_reference(stream_info, SOUND_EFFECT_ACOUSTIC_ECHO_CANCEL_WEBRTC, device); if (ret != SOUND_MANAGER_ERROR_NONE) { g_printerr("failed to sound_manager_set_echo_cancel_reference_device()\n"); } else {