Repository navigation
Description
Upstream report: obsproject/obs-studio#13836, "Multiple PipeWire screen capture sources cause severe render/compositor lag, even when disabled" (Hyprland 0.56, xdg-desktop-portal-hyprland 1.4.1, PipeWire 1.6.8; a second user on the same stack adds that sources in other scenes, disabled or not, cause it too). Every Screen Capture (PipeWire) source keeps its screencast running whether or not it is shown, so the compositor copies a full frame for each one on every refresh. Deleting the sources brings the frame rate back. Disabling them often does not, because a disabled source only stops streaming if it was shown first.
Location
plugins/linux-pipewire/pipewire.cline 1496,obs_pipewire_connect_stream(): every stream is connected withPW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_MAP_BUFFERS, so it starts active.obs_pipewire_stream_hide()(line 1538) is the only call that pauses a stream. The screencast source calls it from its.hidecallback (screencast-portal.cline 1135), and libobs calls.hideonly when a showing source stops showing (libobs/obs-source.cline 1412).- The portal session finishes asynchronously, after the scene collection has loaded. A source that is disabled or sits in a scene that is not live has never been shown, so it never gets a hide, and its stream stays active until the user shows and hides it once.
- Our reconnect (plugins: Reconnect Linux capture after PipeWire restarts #109) already handles this, but only for a stream that replaces a lost one (
screencast-portal.cline 295):if (capture->reconnect.active && capture->obs_pw_stream && !obs_source_showing(capture->source)) obs_pipewire_stream_hide(...). The first connect is upstream behaviour and has no such check.
Reproduced in 0.1.0-beta.20261014
The released AppImage, on a private nested Hyprland 0.56.2 with xdg-desktop-portal-hyprland and its own PipeWire and WirePlumber (one 1920x1080 headless output at 60 Hz with a clock window on it). A picker script answers the portal. The scene collection has scene Live (current, a colour source, CapLive, and CapDisabled with its item disabled) and scene Other (not live, CapOther). All three are Screen Capture (PipeWire) sources of the same output. Frames per screencast are counted from the portal's verbose log, CPU from /proc over 10 s.
| 0.1.0-beta.20261014 | |
|---|---|
| xdph screencasts running after startup | 3 of 3 (CapLive, CapDisabled, CapOther) |
| frames copied per screencast | ~31 fps each (one run), ~53 fps each (second run) |
| Hyprland / OBS CPU, 3 screencasts running | 24.0% / 24.9% (one run), 31.7% / 34.9% (second run) |
| after CapDisabled is enabled and disabled once | its screencast suspended, 0 fps; CapOther's still running |
| Other made live and back | only the showing source's screencast runs: Hyprland 14.5%, OBS 13.1% |
So the hide path works; only a source that was never shown keeps streaming.
Class
Performance / logic error: wasted compositor and OBS work for every screen capture that is not showing, which grows with the number of captures and the refresh rate. No crash and no data loss. A hidden source draws nothing either way.
Proposed fix and failing test
Connect each screencast stream paused (PW_STREAM_FLAG_INACTIVE) unless its source is showing, and let .show start it as it already does. The source keeps what libobs last told it (show or hide) under a small lock, so a show that races the connect cannot be lost: .show/.hide run on the video thread, the stream is connected on the main loop. A reconnect (#109) uses the same path, which replaces its separate hide. Restore tokens, the portal session and when the picker appears do not change.
RED: test_pipewire_screencast_resume (fake ScreenCast portal on a private bus, a producer stream on a private PipeWire) gets three cases. Its fake compositor links every capture stream, and the test counts the frames each stream takes.
- A capture in a scene that is not live and one disabled in a live scene get no frames while a third capture shows. Today each gets 60 frames in 2 s, like the showing one.
- Guard: shown 20 times, such a source gets a new frame each time, and hiding it stops its frames.
- Guard (plugins: Reconnect Linux capture after PipeWire restarts #109): after the monitor goes away and comes back, only the showing capture streams.
The camera source (camera-portal.c line 287) connects the same way. It is not part of this issue: nobody has reported it, and a camera paused before its first show would have to start the device when shown, where today it is already running.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Oct 16, 2026
Claiming: this issue.
The fix stays in
plugins/linux-pipewire(pipewire.{c,h}andscreencast-portal.c):test_pipewire_screencast_resumegets three cases against its fake portal and private PipeWire, with every capture stream linked and the frames each one takes counted. A capture in a scene that is not live and a disabled one must get no frames while another capture shows. Guards: such a source streams again each time it is shown (20 rounds) and stops when hidden, and after a reconnect (plugins: Reconnect Linux capture after PipeWire restarts #109) only the showing capture streams. Today the first case fails (60 frames in 2 s for each hidden source).PW_STREAM_FLAG_INACTIVE) unless its source is showing;.showstarts it. The show/hide state and the stream's active state are kept together under one lock, so a show that races the connect is not lost. The reconnect path uses the same code.rdoupe commentedon Oct 16, 2026
@SkyKingPX you reported this in obsproject/obs-studio#13836: several Screen Capture (PipeWire) sources lag the desktop and OBS, even when they are disabled. Heads-up that it's fixed here in obs-rust: #1111 merged today with a regression test.
Cause: every screen capture's PipeWire stream started active. OBS pauses a stream only when a source that was showing stops showing, so a source that was disabled, or sat in a scene that wasn't live, when OBS started kept streaming, and the compositor copied every frame for it. That's why deleting the sources helped and disabling them often didn't. A source you had shown once and then disabled did pause (the idle
obsnode in your pw-top output). Now a screen capture whose source isn't showing connects with its stream paused, and showing the source starts it.In our release (0.1.0-beta.20261014), on Hyprland 0.56.2 with xdg-desktop-portal-hyprland and three screen captures of one 60 Hz output (one showing, one disabled, one in another scene), all three screencasts ran at about 53 fps each, and the compositor used 31.7% CPU and OBS 34.9%. With the fix, only the showing one runs: 15.1% and 13.9%. Enabling the disabled source brought its picture back within about two frames (35 ms) the first time and within 1-21 ms after that, and disabling it paused its screencast again, 20 of 20 times. Restore tokens still work: no picker after a restart.
Workaround on stock OBS: after OBS starts, show each screen capture once (switch to its scene, or enable and disable it). That pauses its stream until OBS restarts.
It will be in the next obs-rust daily release after 0.1.0-beta.20261014: https://github.com/obs-rust/obs-studio/releases (Windows, macOS and Linux builds; on Arch it's
obs-studio-rust-gitin the AUR). obs-rust is an AI-assisted fork of OBS.We tested in a nested Hyprland session without a GPU-heavy game, so we couldn't reproduce your 350 Hz setup or the ERR counts in pw-top. If you get a chance to try it, a reply here on whether the lag is gone with several screen captures would really help.
linux-pipewire: Keep the streams of hidden screen captures paused (ob…
SkyKingPX commentedon Oct 17, 2026
Nice, thanks!