简体   繁体   中英

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.

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);

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.

假设您的 AEC 处于活动状态并正在运行,我建议验证您的 AEC 是否支持回声路径

您需要将AcousticEchoCanceler附加到您正在创建的 AudioRecord 实例。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM