AEC stands for Acoustic Echo Cancellation.
AEC addresses the problem of the microphone capturing sound from the speakers (acoustic echo), especially in scenarios without headsets. When a remote participant’s voice plays through the local speakers and gets picked up by the local microphone, AEC removes this echo before sending audio to the remote side.
How AEC works in WebRTC
The AEC algorithm in libWebRTC:
- Captures the reference signal being played through the speakers
- Estimates the acoustic path from speakers to microphone (room impulse response)
- Generates a model of the expected echo
- Subtracts this modeled echo from the microphone signal
This process happens in real time with minimal added latency.
In some cases, AEC is disabled in WebRTC by the applications for certain reasons. In other cases, AEC is implemented by the device itself without any need of WebRTC to intervene (iPhone devices for example).
Challenges
AEC performance depends on the acoustic environment:
- Room size and surfaces: Hard surfaces create stronger echoes
- Speaker-to-mic distance: Closer proximity makes echo cancellation harder
- Non-linear distortion: Cheap speakers introduce distortion that complicates echo modeling
- Multiple speakers: Conference rooms with multiple speakers are particularly challenging
- Device variability: WebRTC is unaware of the device in advance – position of the speaker and the microphone, their type and make, etc. This means it needs an algorithm that dynamically figures out the acoustic characteristics so it can factor them in
Related audio processing
AEC works alongside other audio processing in WebRTC:
- AGC (Automatic Gain Control) – normalizes volume levels
- VAD (Voice Activity Detection) – detects speech vs. silence
- Noise Suppression – removes background noise


