voelin-media: capture chosen applications' audio, and everything but ours
Screen-share audio took the default sink's monitor on Linux, so viewers heard the TeamSpeak voices we play, and there was no way to share one application's sound only. capture::playback::start_playback(filter, source) now captures what applications play into a mixer source, with PlaybackFilter::AllButSelf (everything except our process and its descendants) or App(Pid | Name), and audio_apps() lists the applications that play, updated live: - Linux: a LinkManager (capture/pipewire_links.rs) watches the PipeWire registry for Stream/Output/Audio nodes and their clients, and links the output ports of every selected stream through the link-factory into a capture stream of ours that the session manager leaves unlinked (node.autoconnect = false). PipeWire sums the links, so one capture stream carries any number of applications; links follow streams as they come and go, and a restarted application is matched by name again. Our own streams are recognised by process id (node, client, or socket credentials; /proc parent chain); loopback and filter outputs (node.link-group) are skipped because their sources are captured directly. This depends on no session-manager policy, adds no sink, and leaves the user's routing and volumes alone. - Windows: WASAPI process loopback per capture, exclude mode on our process tree for everything, include mode on the chosen process tree (for a name, one capture per matching audio session's process, matched again every two seconds); sessions of all playback devices for the list; the owner of an HWND for window audio. Only type-checked (x86_64-pc-windows-gnu). - Platform providers (Android) get start_input / stop_input / apps. - X11: window_pid() reads _NET_WM_PID, so a shared window's audio can be selected automatically. tests/pipewire_apps.rs runs a private PipeWire, WirePlumber and D-Bus (skipped without them) with two tone players in other processes and one in ours, and checks by frequency that desktop audio has both players and not us, that name and pid captures have only their application, that a new player is linked live, a quit one dropped, and a restarted one matched again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
This commit is contained in:
10 files changed
+2138
-60
No files matched your search
Generated
+2
@@ -9182,10 +9182,12 @@ dependencies = [
|
||||
"thiserror 2.0.21",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
"wasapi",
|
||||
"wayland-client",
|
||||
"wayland-protocols",
|
||||
"wayland-protocols-wlr",
|
||||
"windows 0.62.2",
|
||||
"windows-capture",
|
||||
"x11rb",
|
||||
"yuv",
|
||||
|
||||
Reference in new issue
Block a user