Linux: add AudioDeviceLoopbackLinux (OpenAL loopback ADM)#22
Conversation
CMakeLists.txt
Outdated
|
|
||
| if (LINUX) | ||
| find_package(PkgConfig REQUIRED) | ||
| pkg_check_modules(PIPEWIRE REQUIRED IMPORTED_TARGET libpipewire-0.3) |
There was a problem hiding this comment.
Why is this change? I don't see pipewire being used anywhere in the code.
There was a problem hiding this comment.
You’re right. This pkg_check_modules(PIPEWIRE ...) in lib_webrtc is not needed.
I added it during local Linux bring-up, but lib_webrtc doesn’t directly use PipeWire symbols.
I’ll drop this and keep PipeWire handling in tg_owt/WebRTC.
|
Squash the commits please |
7894cf9 to
21c5337
Compare
Done. |
|
Is the second commit required for audio capture? If not, please make a separate PR |
e9dfc0e to
21c5337
Compare
|
moved to #24 |
|
Why? That other PR doesn't seem to contain loopback implementation |
What do you mean? |
|
I mean I don't understand why this PR is moved. The other PR doesn't seem complete. |
|
That other PR also mixes multiple features in one commit which is a bad thing. All features must be separate PRs, there's a high chance features adding new UI will be rejected (as per tdesktop's CONTRIBUTING.md). |
is it better now? |
|
I still don't understand why we need a new PR... Why couldn't we continue with this one? |
|
i thought you wanted it to be more clean (so there wouldn't be any reason to be rejected) |
|
Okay... If it was just cleanings, you could force push instead of a new PR |
21c5337 to
d3e7c62
Compare
Enables the desktop share audio flow on Linux within Calls UI and plumbing. - calls_call: add withAudio parameter to toggleScreenSharing, track _screenWithAudio flag, create/destroy SystemAudioCapture when sharing starts with audio, and clean it up in destroyController. - calls_panel / calls_group_panel: use LoopbackAudioCaptureSupported() to report audio support on all platforms; implement chooseSourceUniqueId() so the chooser can handle single-source (Wayland/PipeWire) mode; open the source chooser when audio is supported instead of bypassing it. - desktop_capture_choose_source: add unique-source mode that skips the screen/window list and shows only the audio toggle + start/stop buttons, used on Linux when a single desktop capture source is pre-selected. Depends on desktop-app/lib_webrtc#22 Closes telegramdesktop#26642
d3e7c62 to
e74e30c
Compare
Adds Linux system audio loopback capture support for desktop sharing. This serves as a prerequisite for Linux desktop share audio support in Telegram Desktop. - Added Linux loopback ADM and capture infrastructure (webrtc_loopback_adm_linux, webrtc_loopback_capture_linux, webrtc_system_audio_capture_linux) - Added platform-agnostic SystemAudioCapture interface (webrtc_system_audio_capture) - Wired Linux loopback into webrtc_create_adm (CreateLoopbackAudioDeviceModule, LoopbackAudioCaptureSupported) - Integrated new sources into the build system; removed unused direct PipeWire dependency from CMakeLists
e74e30c to
52faf96
Compare
|
The code is back to what it was... right? What was with the new code, was it completely broken? |
|
The code from pr 24 had replaced the code in pr 22 that was the issue |
|
Maybe I misunderstand something...
Is this right? If yes, what was the reason for this? |
|
I separated the feature changes per your instructions. Unfortunately the force pushing did not go well initially, so the changes of PR 26 ended up being merged in both PRs 24 and 22. This has now been fixed, and each change is separately kept in its own PR (although some changes depend on others, for example PR 24 which depends on 26 touches the same files to make extensions to them, so it also includes the code introduced in 26 but shouldn't conflict is 26 is merged first). Git is a mess and i also don't know how to use it well. |
|
Thank you for your work! Let's test that in this implementation, but then I'd like to improve some things, like remove duplication of hardcoded strings for loopback device detection and maybe some more. |
Enables the desktop share audio flow on Linux within Calls UI and plumbing. - calls_call: add withAudio parameter to toggleScreenSharing, track _screenWithAudio flag, create/destroy SystemAudioCapture when sharing starts with audio, and clean it up in destroyController. - calls_panel / calls_group_panel: use LoopbackAudioCaptureSupported() to report audio support on all platforms; show a GenericBox with audio toggle when a unique desktop capture source is available (PipeWire), then start sharing with the chosen audio setting. Depends on desktop-app/lib_webrtc#22 Closes telegramdesktop#26642
Enables the desktop share audio flow on Linux within Calls UI and plumbing. - calls_call: add withAudio parameter to toggleScreenSharing, track _screenWithAudio flag, create/destroy SystemAudioCapture when sharing starts with audio, and clean it up in destroyController. - calls_panel / calls_group_panel: use LoopbackAudioCaptureSupported() to report audio support on all platforms; show a GenericBox with audio toggle when a unique desktop capture source is available (PipeWire), then start sharing with the chosen audio setting. Depends on desktop-app/lib_webrtc#22 Closes telegramdesktop#26642
Enables the desktop share audio flow on Linux within Calls UI and plumbing. - calls_call: add withAudio parameter to toggleScreenSharing, track _screenWithAudio flag, create/destroy SystemAudioCapture when sharing starts with audio, and clean it up in destroyController. - calls_panel / calls_group_panel: use LoopbackAudioCaptureSupported() to report audio support on all platforms; show a GenericBox with audio toggle when a unique desktop capture source is available (PipeWire), then start sharing with the chosen audio setting. Depends on desktop-app/lib_webrtc#22 Closes telegramdesktop#26642
Enables the desktop share audio flow on Linux within Calls UI and plumbing. - calls_call: add withAudio parameter to toggleScreenSharing, track _screenWithAudio flag, create/destroy SystemAudioCapture when sharing starts with audio, and clean it up in destroyController. - calls_panel / calls_group_panel: use LoopbackAudioCaptureSupported() to report audio support on all platforms; show a GenericBox with audio toggle when a unique desktop capture source is available (PipeWire), then start sharing with the chosen audio setting. Depends on desktop-app/lib_webrtc#22 Closes #26642
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, single-feature 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.hwebrtc/platform/linux/webrtc_loopback_adm_linux.cppImplements
AudioDeviceLoopbackLinux(awebrtc::AudioDeviceModule):IsSupported()enumeratesALC_CAPTURE_DEVICE_SPECIFIERto detect whether a PulseAudio monitor source is available.captureLoop()runs on a dedicatedstd::thread, reads 10 ms stereo-16 chunks viaalcCaptureSamples, and delivers them throughwebrtc::AudioDeviceBufferto the WebRTC pipeline.desktop-app::external_openalCMake target — no new dependencies.Modified files
webrtc/webrtc_create_adm.cpp / .hCreateLoopbackAudioDeviceModule()now instantiatesAudioDeviceLoopbackLinuxon Linux (mirrors the existing Windows branch).LoopbackAudioCaptureSupported()function reports whether loopback capture is available on the current platform.CMakeLists.txtWEBRTC_LINUXcompile definition underelseif (LINUX), matching the existingWEBRTC_WIN/WEBRTC_MACpattern.Platform
Linux only. Windows and macOS are unaffected.
Follow-up PRs
MixingAudioDeviceModuleand loopback mixing transport (depends on this PR)