abhishek kumar gupta
abhishek kumar gupta

Reputation: 2289

Acoustic Echo Cancellation on Android not working

We are trying to enable the already implemented echo cancellation technology.

Scenario:

Two android devices are successfully connected and voice is perfectly fine on both devices.

Device-1 activate/deactivate Speakerphone:

AudioManager audioManager = ((AudioManager) getSystemService(AUDIO_SERVICE));
audioManager.setSpeakerphoneOn(false);

Device-2 Hears themselves when they talk (Facing this Issue)

Any help or guidance will be well appreciated.

Upvotes: 2

Views: 4991

Answers (4)

pgcan
pgcan

Reputation: 1219

I have been struggling with Acoustic Echo cancellation issue on Android while testing a video call on my WebRTC based Cordova mobile app. However, there was no echo issue on most of the mobile devices including IOS but there was echo on Samsunng-S10 and Nokia devices.

I also had assumption that WebRTC supports Audio constraints "echoCancellation:true" which by default is enabled. However, this audio constraints doesn't seem to work.

I fixed it by setting Mode in AudioManager

AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
audioManager.setSpeakerphoneOn(true);

Looks like some mobile devices do not start echo cancellation (even if supported) until audio mode is explicitly set to Communication.

Upvotes: 3

marius bardan
marius bardan

Reputation: 5122

You need to attach an AcousticEchoCanceler to the AudioRecord instance you're creating.

Upvotes: 0

Ayyappan
Ayyappan

Reputation: 1265

Some Android Device doesn't support echo cancellation by default. If you are using werbtc, Webrtc provides api to do the echo cancellation. Please use the following code to enable echo cancellation.

WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true);
WebRtcAudioUtils.setWebRtcBasedNoiseSuppressor(true);

Upvotes: 1

Tim
Tim

Reputation: 99

Assuming your AEC is active and running, I recommend to verify that the echo path is supported by your AEC.

Upvotes: 0

Related Questions