Echo cancellation using WebRTC-based media constraints

374 views
Skip to first unread message

Sridhar Shanmugam

unread,
Jun 27, 2024, 6:14:37 AM6/27/24
to discuss-webrtc
Hi everyone,

I am currently facing issues with echo cancellation on some Android devices. I'm using the M80 version of the WebRTC Android library. To address this issue, I plan to disable hardware-based AEC and enable WebRTC-based AEC.

The hardware-based AEC is disabled as shown below:
JavaAudioDeviceModule.builder(context)
    .setUseHardwareAcousticEchoCanceler(false)
    .setUseHardwareNoiseSuppressor(false)
    .createAudioDeviceModule()

Now, when enabling WebRTC-based AEC, is it sufficient to set the appropriate media constraints alone when creating the audio track as shown below:
val audioConstraints = MediaConstraints()
audioConstraints.mandatory.add(MediaConstraints.KeyValuePair("googEchoCancellation", "true"))
audioConstraints.mandatory.add(MediaConstraints.KeyValuePair("googNoiseSuppression", "true"))

val audioSource = peerConnectionFactory.createAudioSource(audioConstraints)
val audioTrack = peerConnectionFactory.createAudioTrack("ARDAMSa0", audioSource)

Or do I also need to enable the following properties before creating the audio constraints?
WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true) WebRtcAudioUtils.setWebRtcBasedNoiseSuppressor(true)

Any insights or recommendations would be greatly appreciated.
Thank you!
Reply all
Reply to author
Forward
0 new messages