2

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.

abhishek kumar gupta
  • 2,189
  • 6
  • 35
  • 56
  • Did you set the mode of AudioManager to 'AudioManager.MODE_IN_COMMUNICATION' (see my answer here: https://stackoverflow.com/a/57013058/3990192)? – Jeyhey Oct 02 '19 at 18:59

4 Answers4

3

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.

Dharman
  • 30,962
  • 25
  • 85
  • 135
pgcan
  • 1,199
  • 14
  • 24
1

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);
Ayyappan
  • 1,275
  • 1
  • 11
  • 25
0

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

Tim
  • 101
  • 2
0

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

marius bardan
  • 4,962
  • 4
  • 29
  • 32