Use fixed framesize when processing pcm 13/304413/2 accepted/tizen/unified/20240119.154725 accepted/tizen/unified/toolchain/20240311.065401 accepted/tizen/unified/x/20240205.063728
authorJaechul Lee <jcsing.lee@samsung.com>
Wed, 17 Jan 2024 04:46:17 +0000 (13:46 +0900)
committerJaechul Lee <jcsing.lee@samsung.com>
Wed, 17 Jan 2024 04:51:45 +0000 (13:51 +0900)
aec-webrtc and ns-rnnoise use fixed framesize and fixed minor things.

[Version] 0.0.21
[Issue Type] Update

Change-Id: I2474fa5acce75db0cdef742808357533a5d3752d
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
README.md
packaging/libaudio-effect.spec
src/plugin_aec_webrtc.cpp
src/plugin_ns_rnnoise.c
test/meson.build

index 0764a9568f57800312e2942d5d6b065be55f0526..2bda9ecd638253e4b939ee93ab156f14f21eec81 100644 (file)
--- a/README.md
+++ b/README.md
@@ -3,8 +3,8 @@ Additional audio pre-process methods.
 
 ## How to build
  * local : meson build [-Dtestsuite=enabled]  && ninja -C build clean && ninja -C build/
-   e.g) meson build -Dtestsuite=enabled -Damplify=enabled -Dagc-speex=enabled -Dns-rnnoise=enabled -Dns-srid=enabled -Drefcopy=enabled -Daec-speex=enabled -Daec-webrtc=enabled && ninja -C build clean && ninja -C build/
-   e.g) meson build -Db_sanitize=address -Db_coverage=true -Dtestsuite=enabled -Damplify=enabled && ninja -C build clean && ninja -C build/
+   e.g) meson setup build -Dtestsuite=enabled -Damplify=enabled -Dagc-speex=enabled -Dns-rnnoise=enabled -Dns-srid=enabled -Drefcopy=enabled -Daec-speex=enabled -Daec-webrtc=enabled && ninja -C build clean && ninja -C build/
+   e.g) meson setup build -Db_sanitize=address -Db_coverage=true -Dtestsuite=enabled -Damplify=enabled && ninja -C build clean && ninja -C build/
  * GBS : gbs build -A aarch64 --include-all
 
 ## How to test
index f30e4374586d4c69212563cfdd70feb637da1294..20c288c8ec042e6112ba29d69b6f001893f440e2 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libaudio-effect
 Summary:    audio effect library
-Version:    0.0.20
+Version:    0.0.21
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index ea2b4e4b8234523ea8ea75bf42875b26805c4896..dcd226e2bd8617c077baf281b717aa7ed6574fa7 100644 (file)
@@ -24,7 +24,7 @@
 #include <audio_effect_util.h>
 #include <audio_effect_log.h>
 
-#define FIXED_FRAME_SIZE_MSEC 10
+#define FRAME_SIZE_MSEC 10
 #define CHANNELS_MAX 2
 
 using namespace webrtc;
@@ -59,33 +59,16 @@ static void deallocate_stream_buffer(struct userdata *u);
 static void *aec_webrtc_create(int rate, int channels, audio_effect_format_e format, size_t frames)
 {
        struct userdata *u;
-       size_t fixed_bytes, request_bytes;
        Config config;
 
        u = (struct userdata *)calloc(1, sizeof(struct userdata));
        if (!u)
                return NULL;
 
-       fixed_bytes = audio_effect_util_msec_to_bytes(FIXED_FRAME_SIZE_MSEC, rate, channels, format);
-       request_bytes = frames * audio_effect_util_get_frame_size(format, channels);
-
-       if (fixed_bytes > request_bytes) {
-               LOG_ERROR("frames should be bigger than %dms. frames(%zu) request_bytes(%zu)",
-                                               FIXED_FRAME_SIZE_MSEC, frames, request_bytes);
-               goto fail;
-       }
-
-       if (request_bytes % fixed_bytes) {
-               LOG_ERROR("request_bytes(%zu) should be multiples of fixed_bytes(%zu)",
-                                               frames, request_bytes);
-               goto fail;
-       }
-
        u->rate = rate;
        u->channels = channels;
-
-       u->fixed_bytes = fixed_bytes;
-       u->fixed_frames = fixed_bytes / audio_effect_util_get_frame_size(format, channels);
+       u->fixed_bytes = audio_effect_util_msec_to_bytes(FRAME_SIZE_MSEC, rate, channels, format);
+       u->fixed_frames = u->fixed_bytes / audio_effect_util_get_frame_size(format, channels);
 
        config.Set<ExperimentalNs>(new ExperimentalNs(false));
        config.Set<Intelligibility>(new Intelligibility(false));
@@ -231,7 +214,7 @@ static audio_effect_plugin_info_s aec_webrtc_desc = {
                .destroy = aec_webrtc_destroy,
        },
        .constraint = {
-               .frames_msec = FIXED_FRAME_SIZE_MSEC,
+               .frames_msec = FRAME_SIZE_MSEC,
                .min_rate = 8000,
                .max_rate = 48000,
                .min_channels = 1,
index 423e16f442ca6376c59b140f139f02eb8b83518a..c4a0e3b3941d2af1d4017fc94f2729d27a17cbb5 100644 (file)
@@ -214,9 +214,6 @@ static void *ns_rnnoise_create(int rate, int channels, audio_effect_format_e for
        struct userdata *u;
        int i;
 
-       if (frames != get_framesize_ms(rate, FIXED_FRAME_SIZE_MSEC))
-               LOG_WARN("Not support rate(%d), frames(%zu).", rate, frames);
-
        u = (struct userdata *)calloc(1, sizeof(struct userdata));
 
        u->rate = rate;
index ad0897c366d2aa09a8f5d6336945448e42e5be73..67d951994add381edc28a1f9c78bedc044913821 100644 (file)
@@ -6,8 +6,8 @@ resource_file_list = [ [ 'SPEECH_FILE_NAME', 'speech.raw' ],
                         [ 'NOISE_48K_FILE_NAME', 'noise_48k_1ch.raw' ],
                         [ 'NOISE_441K_MONO_FILE_NAME', 'noise_441k_1ch.raw' ],
                         [ 'NOISE_441K_STEREO_FILE_NAME', 'noise_441k_2ch.raw' ],
-                        [ 'AEC_REFERENCE_FILE_NAME', 'rec.raw' ],
-                        [ 'AEC_RECORDING_FILE_NAME', 'ref.raw' ],
+                        [ 'AEC_RECORDING_FILE_NAME', 'rec.raw' ],
+                        [ 'AEC_REFERENCE_FILE_NAME', 'ref.raw' ],
                         [ 'AEC_REFERENCE_COPY_5CH_FILE_NAME', 'rec_refcopy_5ch.raw' ] ]
 
 cdata = configuration_data()