WebRTC AEC on Android

I am developing a SIP softphone application for Android and am facing the problem of echo cancellation. I tried to solve it with Speex without success. So, my next snapshot is WebRTC AEC (Acoustic Echo Cancellation), but I cannot find documentation on how to use it.

In my application, audio is controlled using the AudioTrack and AudioRecord classes in Java, but the sockets that send and receive are in C code (integrated with JNI). WebRTC is a megaproject, and I only want to integrate the AEC module.

Does anyone know which files I need to include, which flags the compiler needs, what function the call invokes, etc.? I have CSipSimple code that also uses WebRTC (but for other uses as well) and I cannot find a simple and correct way to enable and use it.

Thanks.

+4
source share
3 answers

You will need the following files:

aec/modules/audio_processing/aec/aec_core_sse2.c aec/modules/audio_processing/aec/aec_core.c aec/modules/audio_processing/aec/aec_rdft_sse2.c aec/modules/audio_processing/aec/aec_rdft.c aec/modules/audio_processing/aec/aec_resampler.c aec/modules/audio_processing/aec/echo_cancellation.c aec/modules/audio_processing/utility/ring_buffer.c aec/modules/audio_processing/utility/delay_estimator.c aec/modules/audio_processing/utility/delay_estimator_wrapper.c aec/system_wrappers/source/cpu_features.cc aec/common_audio/signal_processing/randomization_functions.c 

Using:

 void * aec = 0; int status = WebRtcAecm_Create(&aec); status = WebRtcAecm_Init(aec, 8000 /* sample rate */); // Buffer the far end frames int status = WebRtcAecm_BufferFarend( aec, play_frm, 160 ); // Cancel echo status = WebRtcAecm_Process( aec, (WebRtc_Word16 *)buf, (WebRtc_Word16 *)buf, tmp_frm, 160, echo_tail / tail_factor ); 
+9
source

This does not answer your question, but if you cannot find what you need, webrtc.org , try discuss-webrtc .

0
source

Note. The Android version below is 4.1 (JellyBean)

The answer is probably too late. However, for anyone interested in dbaustista strong> answers , consider the following:

AEC is modeled by the AudioEffect class. Thus, the AEC AudioEffect object must be added to the “chain of effects” RecordThread. I believe that the AEC implementation is built into the libaudioprocessing library. See Additional Notes below.

Library

 /system/etc/audio_effects.conf libraries { ... pre_processing { path /system/lib/soundfx/libaudiopreprocessing.so } } 

Interface

 media/AudioEffect.h 

Example

The following example shows how to add an AudioEffect object to PlaybackThread . Apply the same logic to RecordThread, i.e. add an AEC object to the RecordThread effects chain.

mediaframeworktest / functional / audio / MediaAudioEffectTest.java

  AudioTrack track = new AudioTrack( AudioManager.STREAM_MUSIC, 44100, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT, AudioTrack.getMinBufferSize(44100, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT), AudioTrack.MODE_STREAM); assertNotNull(msg + ": could not create AudioTrack", track); AudioEffect effect = new AudioEffect(AudioEffect.EFFECT_TYPE_ENV_REVERB, AudioEffect.EFFECT_TYPE_NULL, 0, 0); track.attachAuxEffect(effect.getId()); track.setAuxEffectSendLevel(1.0f); 

AEC configuration options

TODO: Add Sample AEC Configuration

0
source

Source: https://habr.com/ru/post/1438875/


All Articles