Skip to content

Linux: add AudioDeviceLoopbackLinux (OpenAL loopback ADM)#25

Closed
paterkleomenis wants to merge 1 commit intodesktop-app:masterfrom
paterkleomenis:linux-loopback-adm
Closed

Linux: add AudioDeviceLoopbackLinux (OpenAL loopback ADM)#25
paterkleomenis wants to merge 1 commit intodesktop-app:masterfrom
paterkleomenis:linux-loopback-adm

Conversation

@paterkleomenis
Copy link
Contributor

@paterkleomenis paterkleomenis commented Feb 22, 2026

Summary

Adds a minimal loopback Audio Device Module for Linux that captures system audio output via the OpenAL Soft capture API, by opening the PulseAudio monitor source exposed as an OpenAL capture device.

This is a focused, self-contained PR. It does not include mixing, mic muting, or playback volume control — those are follow-up PRs.

Changes

New files

  • webrtc/platform/linux/webrtc_loopback_adm_linux.h

  • webrtc/platform/linux/webrtc_loopback_adm_linux.cpp

    Implements AudioDeviceLoopbackLinux (a webrtc::AudioDeviceModule):

    • IsSupported() enumerates ALC_CAPTURE_DEVICE_SPECIFIER to detect whether a PulseAudio monitor source is available.
    • captureLoop() runs on a dedicated std::thread, reads 10 ms stereo-16 chunks via alcCaptureSamples, and delivers them through webrtc::AudioDeviceBuffer to the WebRTC pipeline.
    • Uses the existing desktop-app::external_openal CMake target — no new dependencies.

Modified files

  • webrtc/webrtc_create_adm.cpp / .h

    • CreateLoopbackAudioDeviceModule() now instantiates AudioDeviceLoopbackLinux on Linux (mirrors the existing Windows branch).
    • New LoopbackAudioCaptureSupported() function reports whether loopback capture is available on the current platform.
  • CMakeLists.txt

    • Adds the two new source files.
    • Adds WEBRTC_LINUX compile definition under elseif (LINUX), matching the existing WEBRTC_WIN / WEBRTC_MAC pattern.

Platform

Linux only. Windows and macOS are unaffected.

Follow-up PRs

…iring

Add a minimal loopback Audio Device Module for Linux that captures system
audio output via the OpenAL Soft capture API by opening the PulseAudio
monitor source exposed as an OpenAL capture device.

Changes:
- webrtc/platform/linux/webrtc_loopback_adm_linux.h/.cpp
  New AudioDeviceLoopbackLinux class implementing webrtc::AudioDeviceModule.
  Static IsSupported() enumerates ALC_CAPTURE_DEVICE_SPECIFIER to detect
  whether a PulseAudio monitor device (name containing 'monitor') is
  available. captureLoop() runs on a dedicated std::thread, reads 10 ms
  stereo-16 chunks via alcCaptureSamples and delivers them through
  webrtc::AudioDeviceBuffer to the WebRTC pipeline.

- webrtc/webrtc_create_adm.cpp / .h
  CreateLoopbackAudioDeviceModule() now instantiates
  AudioDeviceLoopbackLinux on Linux (mirrors the existing Windows branch).
  New LoopbackAudioCaptureSupported() function reports whether capture is
  available on the current platform and device configuration.

- CMakeLists.txt
  Add the two new source files.
  Add WEBRTC_LINUX target compile definition under elseif (LINUX), matching
  the existing WEBRTC_WIN / WEBRTC_MAC pattern.
@paterkleomenis
Copy link
Contributor Author

Closing in favour of #22, which has been reopened and updated with this exact same clean single-commit implementation. The reviewer preferred to continue with the original PR rather than opening a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant