WebRTC AEC on Android

10,249

You'll 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

Usage:

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
);
Share:
10,249
dbautista
Author by

dbautista

Updated on July 08, 2022

Comments

  • dbautista
    dbautista almost 2 years

    I'm developing a SIP softphone app for Android, and facing the echo cancellation problem. I've tried to solve it using Speex with no success. So my next shot is WebRTC AEC (Acoustic Echo Cancellation), but I cannot find any documentation about how to use it.

    In my app, the audio is managed with AudioTrack and AudioRecord classes in Java, but the sockets that sends and receive are in a C code (integrated with JNI). WebRTC is a mega-project, and I only want to integrate the AEC module.

    Does someone know which files I have to include, which flags does the compiler need, which function calls to do, and so on? I have the CSipSimple code, which also uses the WebRTC (but for other uses too) and I can't find out the easy and proper way to include and use it.

    Thanks.

  • junglecat
    junglecat over 11 years
    I never got Speex Echo Cancellation working very well (lot's of noise). See my answer on how to include the AEC from WebRTC.
  • Keo Malope
    Keo Malope over 11 years
    Thanks. Side note: SSE2 is for x86 architectures. If working on ARM based platform, you'd have to use aec"m" source files. Better still, you could link against the already integrated "libaudiopreprocessing"
  • umerk44
    umerk44 about 9 years
    i am using some thing like this AudioSource audioSource = factory.createAudioSource(new MediaConstraints()); localMS.addTrack(factory.createAudioTrack("ARDAMSa0", audioSource)); i have created audiosource using Peerconnectionfactory and added that in mediastream track. So how can i use your code in that scenario ?