Skip to content

bug: linux-pipewire: Wayland screen capture stays frozen after the monitor sleeps or is unplugged (upstream #12063) #398

Closed

Description

@rdoupe

Upstream OBS bug, reported by Tiagoquix in obsproject/obs-studio#12063 (Fedora 42, KDE Plasma, OBS 31.0.3): a Wayland "Screen Capture (PipeWire)" source freezes when the monitor is switched off and does not come back when it is switched on again, until the monitor is selected again. Trackerlist sees the same on Fedora 43 with KDE: their DisplayPort monitor drops off the system when switched off (hotplug detect), and the capture freezes; window capture is unaffected. Both use the replay buffer as an always-on recorder, so a sleeping monitor silently ends their recording. The same freeze after sleep is obsproject/obs-studio#12423, reported by Kangaroux (Pop!_OS 22.04, GNOME, OBS 30.2.3 and 31.0.4) and confirmed by ARoese (Kubuntu 25.10, KDE Plasma 6.4, OBS 32.1.0), and an OBS forum thread ("OBS screen capture freezes after screen lock/unlock (Wayland / PipeWire)", about 1,000 views, two users, one on GNOME on Arch: "for at least a year"). An OBS team member (Fenrirthviti) closed obsproject/obs-studio#12063 as a support request ("Many monitors when turned off will be disconnected ... I don't think there's much we can do about this"). obsproject/obs-studio#12423 is still open. No upstream fix.

Location

The logs in both issues show the stream going to paused with no error when the monitor goes away, then nothing until the user selects the source again (3 hours and 11 hours later):

[pipewire] Stream 0x... state: "streaming" (error: none)
[pipewire] Stream 0x... state: "paused" (error: none)
[pipewire] Stream 0x... state: "unconnected" (error: none)   <- the user reselects the source

In the forum logs (lock and unlock on GNOME) the paused stream then fails with error: no more input formats. That case is already reconnected by #109 (a stream error after streaming); this issue is the one without an error.

The compositor ends the screencast of an output that goes away and destroys its PipeWire stream, so the node OBS is linked to is removed. A stream whose node is removed only pauses. A new screencast is a new node that only a new portal session hands out.

  • plugins/linux-pipewire/reconnect-policy.c lines 36-50, obs_pipewire_stream_state_is_lost(): the reconnection from plugins: Reconnect Linux capture after PipeWire restarts #109 starts only on a stream error after streaming (or a lost daemon connection). A paused stream is not an error, so it never starts.
  • plugins/linux-pipewire/pipewire.c lines 1166-1170: the screencast connection has no registry listener (obs_pipewire_connect_fd(fd, NULL, NULL), screencast-portal.c line 261), so nothing notices the node going away.
  • reconnect-policy.c lines 53-63 and screencast-portal.c lines 742-748: when the reconnection does start, it gives up after 10 failed attempts (OBS_PIPEWIRE_RECONNECT_MAX_ATTEMPTS, about 56 s of backoff). A monitor that is off for longer, and a portal that refuses to start meanwhile, ends it for good.

Class

Capture stops: the source keeps showing its last frame forever, with nothing in the UI to say so. Recordings and replay buffers keep running with a frozen picture.

How it is reached

  1. On a Wayland desktop (KDE Plasma or GNOME), add a "Screen Capture (PipeWire)" source for a monitor.
  2. Switch the monitor off (one that drops off the system, e.g. DisplayPort hotplug detect), unplug it, or suspend the computer. Switch it back on.

The capture stays frozen until the source is selected again.

Reproduced headlessly: the screencast portal source against a fake ScreenCast portal on a private D-Bus bus and a producer stream (the monitor) on a private PipeWire daemon. Destroying the producer stream gives exactly the users' log (paused, no error), and the capture stays frozen after a new producer stream comes back, with no new portal session.

Checked in a private nested Hyprland session with xdg-desktop-portal-hyprland 1.4.1 as well: there, DPMS off keeps the screencast and frames resume on their own (master and the fix alike); removing the output keeps the node but sends no more frames, which this fix cannot see (see below).

Upstream work

None. No upstream PR. Related: obsproject/obs-studio#11570 (KDE, lock screen captured and frozen; ARoese believes it is the same).

Proposed fix and failing test

Fix (plugins/linux-pipewire only):

  • pipewire.c: owners that set a disconnected callback (the screencast portal source) also watch the registry for the removal of the node their stream is connected to, and report it once like a lost connection. The existing reconnection then starts a new portal session with the restore token, keeping the last frame on screen meanwhile.
  • reconnect-policy.c: never give up. Keep the first 10 attempts' fast backoff, then retry every 30 s for as long as the source exists. Cancelling the portal's dialog still ends it.
  • A paused stream alone is not treated as lost: hiding the source pauses it too, and a monitor in DPMS sleep may just stop sending frames.

RED tests:

  • test_pipewire_reconnect (no display, runs in CI): the removed node is reported once and nothing else is; reconnection keeps retrying every 30 s for a day of failures. 2 of 10 fail today.
  • test_pipewire_screencast_resume (private PipeWire and D-Bus, needs Xvfb, skips without): the monitor switched off for 2.5 s while the portal refuses to start, then back; the capture must show the new picture within 15 s and never ask for the source again. Two guards must not reconnect: no frames for 3 s, and a hidden source. 1 of 3 fails today.

Not covered: compositors that keep the node but stop sending frames when an output is removed (xdg-desktop-portal-hyprland here) give OBS nothing to act on short of a no-frame timeout, which would also fire on idle screens.

Activity

  1. rdoupe commented on Oct 12, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: this issue.

    1. RED: test_pipewire_reconnect (2 of 10 failing, no display): removal of the stream's node must count as a lost connection, once; reconnecting must never give up. test_pipewire_screencast_resume (1 of 3 failing): a fake portal and a private PipeWire producer whose node goes away while the "monitor" is off; frames must resume when it comes back, with guards against reconnecting on a hidden source or an idle screen.
    2. GREEN: watch the registry for the stream's node being removed and hand it to the existing reconnect; keep retrying every 30 s after the first 10 fast attempts.
      PR today.
  2. added a commit that references this issue on Oct 12, 2026
    43a0631
  3. rdoupe commented on Oct 12, 2026

    @rdoupe
    CollaboratorAuthor

    @Tiagoquix you reported this in obsproject/obs-studio#12063, so a heads-up: it's fixed here in obs-rust by #399, merged today with a regression test.

    Cause: when a monitor goes to sleep or is unplugged, the compositor ends the screencast and removes its PipeWire node. OBS's stream doesn't get an error when that happens; it just pauses and never receives another frame, so the capture stayed frozen until the source was reselected. That matches the "paused (error: none)" lines Kangaroux and ARoese posted in obsproject/obs-studio#12423, and Trackerlist saw the same with DisplayPort hotplug. On top of that, our earlier reconnect logic gave up after about a minute, so a monitor that was off longer would never have come back anyway. Now OBS notices its stream's node being removed and starts a new screencast with the saved restore token, keeping the last frame on screen meanwhile, and it keeps retrying (every 30 s after the first minute) for as long as the source exists. A paused stream on its own (a hidden source, an idle screen) still isn't treated as lost. The test drives the real screencast source against a fake portal and a private PipeWire stream whose node goes away while the "monitor" is off: before, frames never came back; now they resume about 3.6 s after it returns.

    Not covered: tested against a simulated portal and stream, not on real KDE or GNOME. On Hyprland, removing an output entirely still leaves the capture frozen, because its portal keeps the stream alive with no frames.

    Workaround on stock OBS: after the monitor comes back, open the source's properties and reselect the screen.

    obs-rust is an AI-assisted fork of OBS; on Arch it's obs-studio-rust-git in the AUR.

    If you try it, a short reply here on whether your capture comes back after the monitor sleeps would really help.

  4. Tiagoquix commented on Oct 12, 2026

    @Tiagoquix

    Please take some shame to yourself to mention me in a vibecoded repository with a rewrite of a software that does not need to be rewritten.

    If you expect me to read LLM slop, you are totally wrong.

  5. rdoupe commented on Oct 12, 2026

    @rdoupe
    CollaboratorAuthor

    We agree with you that obsproject/obs-studio#12063 is a real bug and we fixed it.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions