Hi I am trying to add VOIP feature to an android Application. For this I need Acoustic Echo Cancellation.
I have seen the official documentation for AcousticEchoCanceler here.
I am using this piece of code for Acoustic Echo Cancellation:
if(AcousticEchoCanceler.isAvailable()) {
echoCanceler = AcousticEchoCanceler.create(mAudioRecord.getAudioSessionId());
echoCanceler.setEnabled(true);
}
But this does not seem to help at all. isAvailable() returns true and echoCanceler objects gets created. If I query echoCanceler.getEnabled() it returns true also.
Even if I make a sample app using AudioRecord and AudioTrack this does not work. I heard a lot of echo.
If I set the source of AudioRecord as:
android.media.MediaRecorder.AudioSource.VOICE_COMMUNICATION
I see the echo gets cancelled in case of Nexus 5(for Android version 5 and 6).
(I am not using AcousticEchoCanceler when I set the source as VOICE_COMMUNICATION) However with same Android version, the same method does not work with Samsung Galaxy S4 and Samsung Note 4 etc devices.
Using echo Cancellation Libraries(like libspeexdsp etc) is NOT possible (as I am working on an existing project).
Please help as soon as possible.
Thank you very much.