haiyangwu / mediasoup-client-android

mediasoup android client side library https://mediasoup.org
MIT License
179 stars 107 forks source link

AEC is not working in some phone #22

Closed lusfold closed 4 years ago

lusfold commented 4 years ago

AEC is not working on some phones, eg Xiaomi 9. It may be problems with the phone. Do you have any idea about this issue? I've taken lof of research and have no answer yet.

KurdAppDev commented 4 years ago

especially android 10

haiyangwu commented 4 years ago

It's complicated, but you can try to disable build-in AEC and use AEC3.

KurdAppDev commented 4 years ago

could you please tell me how to disable build-in AEC and use AEC3,

I tried all of these and nothing worked

WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true);//true or false

audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair("googEchoCancellation", "true"));
      audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair("googEchoCancellation2", "true"));
      audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair("googDAEchoCancellation", "true"));

      audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair("googTypingNoiseDetection", "true"));

      audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair("googAutoGainControl", "true"));
      audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair("googAutoGainControl2", "true"));

      audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair("googNoiseSuppression", "true"));
      audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair("googNoiseSuppression2", "true"));

      audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair("googAudioMirroring", "false"));
      audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair("googHighpassFilter", "true"));
haiyangwu commented 4 years ago

Recommend trying webrtc official demo and test whether aec works in your phone.

Caerbannog commented 3 years ago

For your information, some other projects are calling setWebRtcBasedAcousticEchoCanceler(false) on specific phone models. This fixes an echo on calls where the speaker is ON. Many Xiaomi models seem to be affected, but it's not limited to this manufacturer. See: signalapp/Signal-Android#7635