Repository navigation
Description
Upstream OBS bug, still present in this fork after #820. On #390 the reporter (Surface Pro 5, Intel IPU3 behind libcamera 0.2.0, PipeWire 1.0.5, OBS 32.2.2) picks another resolution in the format list of a streaming "Video Capture Device (PipeWire)" source. OBS then logs [pipewire] Renegotiating stream, Error id:0 ... res:-32 (Broken pipe): connection error and unconnected, every time. #820 stopped renegotiations for a format the stream already has. A real resolution change still renegotiates. shetozz's upstream report obsproject/obs-studio#10399 (stream turns off and the picture freezes after a properties change; stephematician: libcamera logs Camera in Running state trying configure()) describes the same path. The reporter traced it, wrote a patch and tested it on that hardware (#390).
Location
-
plugins/linux-pipewire/camera-portal.cformat_selected()(line 840) restarts the stream (stream_camera(), destroy + create) for a new subtype or pixel format. For a new resolution it renegotiates the running stream instead (line 865):} else if (camera_source->obs_pw_stream) { obs_pipewire_stream_set_resolution(camera_source->obs_pw_stream, &camera_source->resolution.rect); }
-
Same function, line 881: when the camera lists no framerates for the selected format, a framerate kept from before is dropped with
obs_pipewire_stream_set_framerate(camera_source->obs_pw_stream, NULL), which also renegotiates the running stream. -
plugins/linux-pipewire/pipewire.cobs_pipewire_stream_set_resolution()(line 1763) and_set_framerate()(line 1728) signalrenegotiate_format(), which callspw_stream_update_params()on the running stream.
Class
Logic error: a running camera is renegotiated to a new format. On PipeWire's libcamera plugin before 1.4.9 that breaks the stream. With PipeWire 1.0.5 (Ubuntu 24.04 and derivatives) the whole PipeWire daemon crashed in our setup.
How it is reached
A PipeWire camera behind libcamera (IPU3 and other Intel IPU laptops/tablets, Raspberry Pi, ...) on PipeWire before 1.4.9, for example Ubuntu 24.04's 1.0.5 or Debian 13's 1.4.2. The user picks another resolution in the source's "Video Format" list while it streams.
What the old plugin does: port_set_format() in spa/plugins/libcamera calls Camera::configure() on a camera that is still running. libcamera refuses with Camera in Running state trying configure() requiring state between Acquired and Configured, and the plugin closes the camera while requests are still in flight. PipeWire 1.4.9 ("clear buffers when format is changed", "remove format config shortcut") stops the camera before it reconfigures it. On PipeWire 1.6 this does not reproduce.
Second path, same result: a source that kept a framerate setting for a camera that lists no framerates (PipeWire's libcamera plugin lists none, 1.0.5 and 1.4.11 checked). Opening its Properties window drops the framerate on the running stream.
Reproduced in the current release
AppImage v0.1.0-beta.20261014, headless: private Xvfb, dbus-run-session, private HOME, --multi, a fake camera portal on the private bus. Server side: a private PipeWire 1.0.5 daemon, built from the upstream tag, running its own libcamera SPA plugin, with libcamera 0.5.2 (upstream tag) and its software virtual pipeline handler as the camera (NV12, 640x480 and 320x240; no kernel modules). This host gives no access to dma-heaps or udmabuf, so a local test-only patch lets libcamera's buffer allocator hand out plain memfds. That changes where frame memory comes from, not libcamera's camera state machine or the PipeWire plugin. The OBS side uses the AppImage's bundled libpipewire 1.6.2. No session manager: a small script links the camera to each new OBS capture port once, as WirePlumber would.
Steps: the source streams NV12 640x480 from the virtual camera (color bars in the preview). obs-websocket SetInputSettings sets the format setting to 320x240. OpenInputPropertiesDialog then makes the Properties window apply it, which runs format_selected() like a click in the list does.
| Build | After picking 320x240 |
|---|---|
| v0.1.0-beta.20261014 | Renegotiating stream → Error id:0 seq:1100 res:-32 (Broken pipe): connection error → unconnected. Daemon log: Camera in Running state trying configure() requiring state between Acquired and Configured, then the daemon segfaults in the libcamera plugin's requestComplete() (backtrace under gdb). The preview stays on the last frame. |
| current master's plugin in that AppImage | same: Broken pipe, unconnected, daemon crash |
| release, a saved 15 FPS framerate, only opening Properties (no resolution change) | Renegotiating stream → negotiated 640x480 30/1 → Broken pipe → unconnected, daemon crash |
The log lines match the reporter's. Whether their daemon also restarted is not known.
Proposed fix and failing test
Fix (the reporter's approach from #390): a resolution change restarts the stream through stream_camera(), like a subtype or pixel-format change. The obs_pipewire_stream_set_resolution() branch goes away. A framerate kept for a camera that lists none for the format is dropped as part of that restart, not with obs_pipewire_stream_set_framerate(NULL) on the running stream. pipewire.c (shared with screen capture) stays as it is. framerate_selected() stays too, because PipeWire's libcamera plugin lists no framerates and so never reaches it. Cost: a short gap while the new stream links, on every camera, including ones that renegotiated cleanly before.
RED test (cmocka, test_pipewire_camera_resolution_restart, Linux): runs camera-portal.c against a fake camera portal on a private D-Bus bus and a camera node on a private PipeWire daemon (test_pipewire_cursor_hdr.sh). The node plays the old libcamera plugin: YUY2 64x48 or 32x24, one EnumFormat per size, no framerates. It refuses a second format without a clear in between (the stream errors out). Two of three cases fail today: picking 32x24 asks the running camera for the new size in place and renegotiates the running stream, and opening Properties with a kept framerate asks the running camera for a new format. Needs an X display; skips without one.
This still needs confirming on real libcamera hardware.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Oct 16, 2026
Claiming: this issue.
test_pipewire_camera_resolution_restartruns the camera portal against a camera node that, like PipeWire's libcamera plugin before 1.4.9, can't take a new format while it streams. Today a resolution change, and a dropped framerate, renegotiate the running stream, so 2 of 3 cases fail.stream_camera(), and a dropped framerate is handled as part of that restart.PR follows today. The PR says Refs, so this stays open until it is confirmed on real libcamera hardware.
github-actions commentedon Oct 16, 2026
Claim bot: claimed by @rdoupe. It expires after 48 h (8 h on
criticalissues) without a progress comment here or a push, comment or review on a linked PR.test/cmocka: Add failing test for a PipeWire camera resolution change
linux-pipewire: Restart a camera stream for a new resolution
linux-pipewire: Restart a camera stream for a new resolution (obs-rus…
EberhartLeberhart commentedon Oct 17, 2026
Tested #934 on the IPU3 hardware. It holds: no renegotiation, no
-EPIPE, and no error fromlinux-pipewirein the whole session.Surface Pro 5 (Intel IPU3,
ipu3-cio2+ipu3-imgu), ov8865 rear and ov5693 front, libcamera 0.2.0, PipeWire 1.0.5, kernel 6.19.8, Linux Mint 22.3.What was exercised
One source, resolution changed repeatedly from the properties dialog while the stream was running, on both cameras:
Renegotiating stream, 0broken pipe, 0connection errorEvery change goes
paused -> unconnected -> new stream -> Negotiated format -> streaming, which is the path #934 intends. 160x120 and 240x160 are in there on purpose: those are the sizes that killed the stream every single time before.The only errors in the log are unrelated to this plugin — the v4l2 source probing devices at startup, a missing
libnvidia-encode.so.1, the empty format JSON on a freshly added source, and the scratch config directory the test run throws away. The shutdown assertions are the 32.2.2 ones you already identified as fixed by #513.How it was built, so you can judge the result
#934 touches only
camera-portal.c, so rather than build the fork on this machine I applied it to the OBS 32.2.2 tree I already had: #934'sformat_selected()in full, plus #820'sframerate_selected()hunk that it depends on, plus #391's NV12 frame layout.pipewire.ctherefore does not carry #820'srunning_at_itguards. That is not reachable in this test: after #934 the camera source calls neitherobs_pipewire_stream_set_resolution()norobs_pipewire_stream_set_framerate()any more. Saying it anyway so the result is read for what it is.The second case you asked for cannot be reached here
"A camera that had a framerate saved before" does not occur on this hardware, and I could not force it.
camera_source->framerate.setonly ever becomes true inframerate_selected(), which only runs whenhas_frameratesis true. On these cameras it is false: I instrumentedformat_selected()and measuredhas_framerates == 0on every call, for both cameras and every size. Soframerate.setis never true, and #934'snever fires. The branch looks right to me by reading, but this hardware cannot witness it. That is the same gap as #1068: every format label advertises
30 FPSwhileframerate_list()finds no framerates for that format and size.Side observation, below OBS — one fault, three symptoms
Not OBS and not #934, recorded so nobody chases it from this end. Below 768x600 the IPU3 pipeline handler picks the sensor's binned mode, and that mode runs three times too fast. Measured with
cam, no OBS and no PipeWire, same scene back to back:8279 / 2743 = 3.02, exactly the frame-rate factor: at 90 fps the exposure cannot exceed ~11 ms. Analogue gain is already pinned at its maximum 16.0 in both modes, so nothing compensates. Hence one fault with three faces: three times the frame rate, a capped exposure, and a picture dark enough to read as black at the small sizes. OBS receiving three times the frames it negotiated is the stutter I mentioned earlier.
(Also: 800x600 does not exist on this sensor — libcamera adjusts it to 768x600.)
From my side #933 can close.
zackees commentedon Oct 17, 2026
Thank you @EberhartLeberhart, that's exactly the coverage we couldn't do without the hardware: 14 rebuilds across both IPU3 cameras, including 160x120 and 240x160, with no renegotiation or EPIPE. Closing as fixed by #934. If it comes back on a later build, reopen this.