How to control WebRTC-based AEC and AGC in the latest version of google webrtc?

267 Views Asked by At

Previously, WebRTC-based control over Acoustic Echo Cancellation and Automatic Gain Control was available via static methods in the WebRtcAudioUtils class of the Google's WebRTC for Android:

WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true);
WebRtcAudioUtils.setWebRtcBasedAutomaticGainControl(true);

However, I saw that in recent versions, WebRtcAudioUtils has been moved to a different package and also its access has been reduced from public to package-private and we are not able to control AEC and AGC through Webrtc anymore.

Can someone help me understand if this is still available through some other methods and how to still have WebRTC-based control over AEC and AGC in the latest versions?

I tried enabling hardware AEC and AGC through JavaAudioDeviceModule, but sound still gets picked-up from the local mic and echo occurs. Also, I tried setting MediaConstraints when creating audio source on peer connection, with all the parameters I could find, but the same problem still occurs:

MediaConstraints mediaConstraints = new MediaConstraints();
mediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair("echoCancellation", "true"));
mediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair("googEchoCancellation", "true"));
mediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair("googEchoCancellation2", "true"));
mediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair("autoGainControl", "true"));
mediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair("googAutoGainControl", "true"));
mediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair("googAutoGainControl2", "true"));

Seems like the audio quality was the best when WebRTC-based control over AEC and AGC via WebRtcAudioUtils was enabled, and hardware control for AEC and AGC was disabled, so is there any way to still have this control in the latest versions as with the WebRtcAudioUtils?

0

There are 0 best solutions below