Remove loops variable 24/299124/1 accepted/tizen/unified/20231011.153128
authorJaechul Lee <jcsing.lee@samsung.com>
Wed, 20 Sep 2023 08:29:23 +0000 (17:29 +0900)
committerJaechul Lee <jcsing.lee@samsung.com>
Wed, 20 Sep 2023 08:29:23 +0000 (17:29 +0900)
It doesn't need anymore because it performs in processor_holdter on behalf of
this plugin.

[Version] 0.0.13
[Issue Type] Update

Change-Id: I9611e4f401d3282d6d47d4b57d2bb7d2ed32da17
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
packaging/libaudio-effect.spec
src/plugin_aec_webrtc.cpp

index 3a3a57ed04de874f94bc7d18051742dea095c6cd..c822476bd9ad410d000806e3cb54a85a0462bd00 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libaudio-effect
 Summary:    audio effect library
-Version:    0.0.12
+Version:    0.0.13
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index 86605ac7681636fd8b28da29102fd7efe0fe1944..ea2b4e4b8234523ea8ea75bf42875b26805c4896 100644 (file)
@@ -49,7 +49,6 @@ struct userdata {
        size_t frames;
 
        /* Currently, webrtc uses fixed size(10ms) buffer */
-       int loops;
        size_t fixed_bytes;
        size_t fixed_frames;
 };
@@ -87,7 +86,6 @@ static void *aec_webrtc_create(int rate, int channels, audio_effect_format_e for
 
        u->fixed_bytes = fixed_bytes;
        u->fixed_frames = fixed_bytes / audio_effect_util_get_frame_size(format, channels);
-       u->loops = request_bytes / fixed_bytes;
 
        config.Set<ExperimentalNs>(new ExperimentalNs(false));
        config.Set<Intelligibility>(new Intelligibility(false));
@@ -122,7 +120,7 @@ static void *aec_webrtc_create(int rate, int channels, audio_effect_format_e for
 
        allocate_stream_buffer(u, u->fixed_frames, channels);
 
-       LOG_INFO("webrtc processes init");
+       LOG_INFO("webrtc processes init. fixed_frame(%zu) fixed_bytes(%zu)", u->fixed_frames, u->fixed_bytes);
 
        return (void *)u;
 
@@ -142,7 +140,7 @@ static int aec_webrtc_process_reference(void *priv, char *rec, char *ref, char *
        struct userdata *u = (struct userdata *)priv;
        size_t frames;
        size_t float_sample_size;
-
+       int ret;
 
        assert(u);
        assert(rec);
@@ -152,39 +150,32 @@ static int aec_webrtc_process_reference(void *priv, char *rec, char *ref, char *
        frames = u->fixed_frames;
        float_sample_size = audio_effect_util_get_sample_size(AUDIO_EFFECT_FORMAT_FLOAT);
 
-       for (int i = 0; i < u->loops; i++) {
-               int ret;
-
-               audio_effect_util_convert_s16le_to_float(frames * u->channels, (const short *)ref, u->ref_fbuf);
-               audio_effect_util_deinterleave(u->ref_fbuf, (void **)u->ref_dbuf, u->channels, float_sample_size, frames);
-
-               /* reference */
-               ret = u->ap->ProcessReverseStream(u->ref_dbuf, *u->sconfig, *u->sconfig, u->ref_dbuf);
-               if (ret != AudioProcessing::kNoError) {
-                       LOG_ERROR("Failed to process reverse stream");
-                       return -1;
-               }
 
-               u->ap->set_stream_delay_ms(0);
+       audio_effect_util_convert_s16le_to_float(frames * u->channels, (const short *)ref, u->ref_fbuf);
+       audio_effect_util_deinterleave(u->ref_fbuf, (void **)u->ref_dbuf, u->channels, float_sample_size, frames);
 
-               /* capture */
-               audio_effect_util_convert_s16le_to_float(frames * u->channels, (const short *)rec, u->rec_fbuf);
-               audio_effect_util_deinterleave(u->rec_fbuf, (void **)u->rec_dbuf, u->channels, float_sample_size, frames);
+       /* reference */
+       ret = u->ap->ProcessReverseStream(u->ref_dbuf, *u->sconfig, *u->sconfig, u->ref_dbuf);
+       if (ret != AudioProcessing::kNoError) {
+               LOG_ERROR("Failed to process reverse stream");
+               return -1;
+       }
 
-               ret = u->ap->ProcessStream(u->rec_dbuf, *u->sconfig, *u->sconfig, u->out_dbuf);
-               if (ret != AudioProcessing::kNoError) {
-                       LOG_ERROR("Failed to process stream");
-                       return -1;
-               }
+       u->ap->set_stream_delay_ms(0);
 
-               audio_effect_util_interleave((const void **)u->out_dbuf, u->out_fbuf, u->channels, float_sample_size, frames);
-               audio_effect_util_convert_float_to_s16le(frames * u->channels, u->out_fbuf, (short *)out);
+       /* capture */
+       audio_effect_util_convert_s16le_to_float(frames * u->channels, (const short *)rec, u->rec_fbuf);
+       audio_effect_util_deinterleave(u->rec_fbuf, (void **)u->rec_dbuf, u->channels, float_sample_size, frames);
 
-               rec += u->fixed_bytes;
-               ref += u->fixed_bytes;
-               out += u->fixed_bytes;
+       ret = u->ap->ProcessStream(u->rec_dbuf, *u->sconfig, *u->sconfig, u->out_dbuf);
+       if (ret != AudioProcessing::kNoError) {
+               LOG_ERROR("Failed to process stream");
+               return -1;
        }
 
+       audio_effect_util_interleave((const void **)u->out_dbuf, u->out_fbuf, u->channels, float_sample_size, frames);
+       audio_effect_util_convert_float_to_s16le(frames * u->channels, u->out_fbuf, (short *)out);
+
        return 0;
 }