Repository navigation
fix(linux): remove unnecessary screen capture from audio loopback handler - #1926
Conversation
…a handler
The setDisplayMediaRequestHandler was calling desktopCapturer.getSources()
to provide a video source that the renderer never uses (it requests
video: false and only consumes audio tracks). On Wayland, this created a
new xdg-desktop-portal ScreenCast session on every launch, showing an
unavoidable screen share dialog because Electron does not persist
PipeWire restore tokens across desktopCapturer sessions.
Simplified the handler to return only { audio: 'loopback' }, which
captures system audio via PipeWire/PulseAudio monitor source without
any portal interaction.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
kgarner7
left a comment
There was a problem hiding this comment.
This capture is necessary to work on macOS and Linux, so this PR is incorrect.
There is a prompt about whether to enable audio capture in Feishin first, although it looks like that can't be toggled from settings.
Linux audio capture doesn't seem to be working, so a better option might be to just disable it.
|
@kgarner7 Thanks for the review! System audio loopback is a brand-new feature added in v1.11.0 (commits 94886a2, ef129e4, 3f300c4 — all from April 5). It does work on Linux — I've tested it on Arch Linux with KDE Plasma 6, Wayland, PipeWire, and Electron 39. The visualizer captures system audio correctly with just The key observation is that the maintainer already set I don't have access to a Mac, so I can't verify macOS behavior. If macOS requires the video source for Chromium's internal audio capture pipeline, I'm happy to make this conditional — skipping desktopCapturer.getSources() only on Linux where PipeWire/PulseAudio loopback works independently of screen capture. |
|
I have no idea how you got it to work on Linux, because I can confirm on my own setup it's just a flatline. Nevertheless, I do see that with just audio loopback macos (probably; at least the visualizer is doing a silly) and windows are working, so I guess this is good enough. |
Problem
On Wayland, Feishin shows an xdg-desktop-portal "Share screen" dialog on every launch. This happens because
setDisplayMediaRequestHandlercallsdesktopCapturer.getSources({ types: ['screen'] }), which creates a new ScreenCast session each time. Electron does not persist PipeWire restore tokens acrossdesktopCapturersessions, so the dialog cannot be suppressed.The video source provided by the handler is unused — the renderer requests
video: false(since ef129e4) and only consumes audio tracks for the visualizer.Changes
desktopCapturer.getSources()call from the display media handlercallback({ audio: 'loopback' })desktopCapturerimportAlternatives considered
desktopCapturer.getSources()still triggers the portal dialogdesktopCapturer.getSources()API does not support storing or re-presenting restore tokens — this is an Electron limitation, not a portal bugTesting