Repository navigation
Description
Upstream OBS bug, still present in this fork. shetozz reported in obsproject/obs-studio#10399 (open, Fedora 39, OBS 30.1) that the "Video Capture Device (PipeWire)" source turns off and its picture freezes after a change in its properties, until OBS restarts. stephematician added that on a libcamera camera PipeWire then logs Camera in Running state trying configure() requiring state between Acquired and Configured, i.e. libcamera cannot reconfigure a camera while it streams. On #390 a Surface Pro 5 user (Intel IPU3 behind libcamera 0.2.0, PipeWire 1.0.5) sees the stream drop again and again with nothing changed: [camera-portal] Selected format on a stream that is already streaming, then [pipewire] Renegotiating stream, Error res:-32 (Broken pipe): connection error and unconnected; stutter at 640x480, a frozen picture at 1280x720.
Location
plugins/linux-pipewire/camera-portal.c: the source's property callbacksformat_selected()(line 826) andframerate_selected()(line 770) push the selected size and framerate into the running stream. They run every time the Properties window opens or reloads (obs_source_properties()applies the settings, which calls every modified callback), and the camera portal reloads the window for every PipeWire node that appears or disappears (obs_source_update_properties()inon_registry_global_cb()line 1020 andon_registry_global_remove_cb()line 1043; OBS's own capture stream is such a node).plugins/linux-pipewire/pipewire.cobs_pipewire_stream_set_framerate()(line 1728) andobs_pipewire_stream_set_resolution()(line 1749) renegotiate whenever the value differs from the one the stream was started with, even when the stream has already negotiated exactly that value (a stream started without a framerate negotiates one; asking for that same framerate later renegotiates anyway).framerate_selected()keeps the picked framerate only on the current stream.camera_source->framerateis read from the settings once, inpipewire_camera_create(), so a stream thatstream_camera()(line 254) starts later (the camera came back, the device or pixel format changed) starts without the picked framerate, negotiates the camera's default, and is renegotiated to the picked one on the next Properties reload.
Class
Needless renegotiation of a running stream. Harmless on cameras that renegotiate cleanly (V4L2); on libcamera cameras it breaks the stream (drop, stutter or freeze until OBS restarts).
How it is reached
A PipeWire camera source whose running stream was started without the framerate in its settings: a framerate set while it streams (obs-websocket SetInputSettings, which pipewire_camera_update() does not apply), or a stream restarted after the camera came back or after a pixel format change. Opening its Properties window then renegotiates the stream, and while the window is open every PipeWire node that comes or goes repeats the property pass.
Reproduced in the current release
AppImage v0.1.0-beta.20261014, headless: private Xvfb, dbus-run-session, private HOME, --multi, a private PipeWire 1.6.8 daemon without a session manager, a fake camera portal on the private bus, and a GStreamer videotestsrc camera node (NV12 640x480 at 30 FPS) linked to OBS's capture stream by hand. The camera source was saved with only its device, then given its format and framerate with obs-websocket SetInputSettings; the stream negotiated NV12 640x480 30/1 and streamed.
| Then | Renegotiations of the streaming camera |
|---|---|
Open Properties (OpenInputPropertiesDialog), then 3 other camera nodes come and go (about 175 property passes while the window is open) |
1, on opening: Selected format -> Renegotiating stream -> paused -> negotiated NV12 640x480 30/1 again -> streaming |
List the source's properties 3 times (GetInputPropertiesListPropertyItems, the same callbacks) |
1, on the first |
| Same two runs, with format and framerate already saved at startup (control) | 0 |
The test camera renegotiates cleanly, so here the stream recovers; on libcamera this is where the stream breaks.
Proposed fix and failing test
Fix: obs_pipewire_stream_set_framerate() and _set_resolution() keep the requested value and skip the renegotiation when the stream already runs with it (any real change still renegotiates as before). framerate_selected() also keeps the picked framerate on the source, so a stream started later starts at it instead of being renegotiated to it.
RED test (cmocka, test_pipewire_camera_renegotiate, Linux): runs camera-portal.c against a fake camera portal on a private D-Bus bus and a camera node (YUY2 64x48, 30 or 15 FPS) on a private PipeWire daemon. Two of three cases fail today: opening Properties renegotiates a stream that already runs at the framerate in its settings, and after the user picks 15 FPS and the camera is replugged, the new stream comes back at 30 FPS (and is renegotiated on the next Properties pass). Needs an X display; skips without one.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Oct 15, 2026
Claiming: this issue.
test_pipewire_camera_renegotiaterunscamera-portal.cagainst a fake camera portal and a camera node on a private PipeWire daemon. Opening Properties renegotiates a stream for the framerate it already runs at, and a replugged camera's new stream drops the picked framerate.obs_pipewire_stream_set_framerate()/_set_resolution()skip the renegotiation when the stream already runs with the requested value, andframerate_selected()keeps the picked framerate for the next stream.PR today.
test/cmocka: Add failing test for renegotiating a streaming PipeWire …
linux-pipewire: Do not renegotiate a camera stream for the format it has
linux-pipewire: Do not renegotiate a camera stream for the format it …