Commit a6e12de
committed
Add MixingAudioDeviceModule and loopback mixing transport
Introduces infrastructure to mix system-audio loopback into the outgoing
microphone stream during a call, on both Linux and Windows.
New types (in webrtc_create_adm.cpp, anonymous namespace):
LoopbackCollector
Thread-safe mono ring buffer (max 2 s at 48 kHz). Loopback capture
threads call pushSamples(); MixingAudioTransport calls readAndMix()
to saturating-add loopback audio into the mic frame.
DirectLoopbackCapture (Linux only, guarded by WEBRTC_LINUX)
Background std::thread that opens the PulseAudio monitor source via
alcCaptureOpenDevice (stereo preferred, mono fallback), feeds decoded
frames into LoopbackCollector, and stops cleanly on destruction.
findMonitorDevice() prefers the monitor that matches the current
default playback sink.
MixingAudioTransport
webrtc::AudioTransport decorator. When mixing is enabled it copies the
mic buffer, calls LoopbackCollector::readAndMix, then forwards the
blended frame to the inner transport. Disabled path is zero-overhead.
MixingAudioDeviceModule (details namespace)
webrtc::AudioDeviceModule wrapper. Installs MixingAudioTransport in
RegisterAudioCallback(), starts/stops DirectLoopbackCapture (Linux) or
a dedicated loopback ADM + LoopbackAdmTransport (Windows) when
setLoopbackEnabled() is toggled via MixingAudioControl.
New public API (webrtc_create_adm.h):
MixingAudioControl
Shared handle that survives ADM recreation. setLoopbackEnabled() /
loopbackEnabled() let callers toggle mixing at any time; the control
re-applies pending state whenever a new MixingAudioDeviceModule
attaches itself.
MixingAudioDeviceModuleCreator(innerCreator, control)
Returns a creator lambda that wraps any ADM (e.g. the OpenAL ADM)
inside a MixingAudioDeviceModule.1 parent 01e1575 commit a6e12de
2 files changed
Lines changed: 832 additions & 0 deletions
0 commit comments