Repository navigation
plugins: Reconnect Linux capture after PipeWire restarts - #109
Conversation
|
Thanks, this is a real problem and the manual measurements are convincing. I approved CI so the plugins build on every platform. Before this can merge, the project needs a RED→GREEN automated test for each fix. You offered to factor out a testable piece. Please do, for example:
A cmocka test in |
cc49e76 to
b3ba41e
Compare
|
Thanks for approving CI. I've added the tests:
I also rebased onto current master. The PR description has the details. |
|
The push with the tests needs CI approval again (first-time contributor), when you have a moment. |
|
Approved CI for b3ba41e (run 38084351283). It's running now. I checked the tests locally. I built
Looks right:
Must change before merge:
Not blocking, but worth fixing while you rebase:
Left before merge: the rebase, then green CI on every platform. This touches |
|
Thanks for the thorough check. Pushed 29e0dce:
Each commit still builds without warnings, and the tests go 4 → 7 → 8 → 11 → 12 → 13. clang-format and gersemi are clean. This push will need CI approval again. |
b3ba41e to
29e0dce
Compare
|
Thanks for adding the tests. Verified locally in Tier 2 (Docker, Linux):
The local gate passes; I pushed the stamped head with --force-with-lease (same tree as your 29e0dce). I approved CI and will merge once it's green. |
29e0dce to
1a1166b
Compare
Move the decisions behind recovering from a PipeWire restart into small files without PipeWire, portal or mainloop calls, and test them directly: - linux-pipewire/reconnect-policy.c: whether a core error or a stream state means the connection is lost, and the screencast retry backoff. - linux-pulseaudio/pulse-reconnect.c: when a failed context is replaced and with what backoff, when sources must restart their streams, how long they retry, and the default device while the server has none. The functions are stubs that keep today's behaviour (nothing is reported, retried or restarted, and a server without a default sink dereferences NULL), so 9 of the 13 tests fail. The fixes that follow make them pass. Refs obs-rust#108. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The core error listener only logged when the connection to the PipeWire daemon broke, so its owner kept a dead connection and stream forever. Add a callback that fires once, on the PipeWire thread, when the core reports -EPIPE or a stream that was streaming goes into the error state, plus helpers to check for that and whether a stream has received a frame yet. Errors before a stream ever streamed (no matching format, no target node) would only fail again, so they are not reported. The decisions are obs_pipewire_core_error_is_lost() and obs_pipewire_stream_state_is_lost(); their tests in test_pipewire_reconnect now pass. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
When PipeWire restarts, the screen capture froze until the source was recreated, and the only way to do that by hand, Reload, also threw away the restore token, so the picker came back. On a lost connection, keep the dead stream to draw its last frame, and run the portal session again with the saved restore token. Swap to the new stream on its first frame. Failed attempts back off, and after 10 it gives up and logs a hint. An attempt that gets no session within 3 s is retried, but nothing from SelectSources on is timed out, because the portal may show the picker if the token no longer matches. Cancelling the picker ends the reconnect. Each attempt gets a new cancellable, so a late portal reply cannot act on a session that is gone. Stream pointers are swapped under the graphics lock and a new streams mutex. Sizes are queried under the mutex only, since callers may hold scene locks that the graphics thread takes after the graphics lock. The backoff is obs_pipewire_reconnect_next_delay(); its test in test_pipewire_reconnect now passes. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The context state callback was a noop with a todo to reconnect. After the server restarted, the shared context stayed failed and every audio source, including newly added ones, stayed silent until OBS restarted. Replace a failed context with a PA_CONTEXT_NOFAIL one that waits for the server to come back, and notify registered callbacks once it is ready. Only a connection that was ready once is retried, so a host without a server fails as before. The first retry is immediate; a server that keeps refusing is retried with backoff up to 10 s. While reconnecting, calls that need the server fail right away instead of blocking. Add pulse_call_later() for retries. The decisions are pulse_reconnect_on_failed() and pulse_reconnect_on_ready(); their tests in test_pulse_reconnect now pass. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
pulse_server_info() called strlen() on the default sink name, which is NULL when the server has no default device, e.g. right after it restarted. Move the lookup into pulse_default_device(), which returns NULL then, and keep the current device and log at debug level instead. Its test in test_pulse_reconnect now passes. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Recreate each source's stream when the server connection is back, retrying every 100 ms for up to 10 s until its device reappears, and skip the 500 ms startup delay since audio was already running. The retry limit is pulse_restart_should_retry(); its test in test_pulse_reconnect now passes. Tested by hand on Arch Linux, Hyprland, PipeWire 1.6.8 with pipewire-pulse and xdg-desktop-portal-hyprland 1.4.1. The screencast's reconnect lifecycle is otherwise only covered by the backoff test, since it needs a live daemon and portal. 1. Add a Screen Capture (PipeWire) source with a saved restore token and the default audio sources, and record 1080p60 while a moving 60 fps test pattern is on screen. 2. Mid-recording, run `systemctl --user restart pipewire`. 3. Check the recording with ffmpeg `freezedetect` and `silencedetect`: the screen was frozen for 35 frames (0.58 s) and audio silent for 0.64 s, then both were live again, with no picker. Before this series both stayed dead until OBS restarted. 4. The portal's own buffer bug (fixed in xdph master) sometimes fails the new stream a second later; OBS reconnected again in under 0.1 s. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Local-Gate: v1 tree=629867f49909fa5ff1015989940fbb84f02fdaa8 secs=300 lanes=lint:run,rust-test:run,tier2-linux:run Ci-Attestation: {"at":1791669170,"gate":"rust/all/fmt","host":"linux-x86_64","key":"5a6fe2b880da4d98430ff03ba3f08ce84f2f82184b5c21e8ef225820f4300cdb","lane":"lint","parents":["669f624acc8b5af933115d2f884dba0b71a7947e"],"secs":134,"stamp":"4c42fbfd9193df566ba46423cab8f4e8","tree":"629867f49909fa5ff1015989940fbb84f02fdaa8","v":1,"via":"run"} Ci-Attestation: {"at":1791669170,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"5a6fe2b880da4d98430ff03ba3f08ce84f2f82184b5c21e8ef225820f4300cdb","lane":"lint","parents":["669f624acc8b5af933115d2f884dba0b71a7947e"],"secs":134,"stamp":"4a45bf2926c921acec724940d619330b","tree":"629867f49909fa5ff1015989940fbb84f02fdaa8","v":1,"via":"run"} Ci-Attestation: {"at":1791669170,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"dc69b4ef458ac0463a6cb75a5b73a3b8d84f592bf1df19c0f86b1339726d2b7c","lane":"rust-test","parents":["669f624acc8b5af933115d2f884dba0b71a7947e"],"secs":60,"stamp":"814b14a8cce95f9ad53a2b57d0ce72b7","tree":"629867f49909fa5ff1015989940fbb84f02fdaa8","v":1,"via":"run"} Ci-Attestation: {"at":1791669170,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"4a62cde6e9a4cb5268830caf2c01e04f95815d1a7c6384041e330e9daa9f0798","lane":"tier2-linux","parents":["669f624acc8b5af933115d2f884dba0b71a7947e"],"secs":105,"stamp":"1b98a7491a26056229d6c4fdc69fcfd7","tree":"629867f49909fa5ff1015989940fbb84f02fdaa8","v":1,"via":"run"}
1a1166b to
06e60d7
Compare
|
Master moved again ( |
An Audio Input Capture stays silent for good once its own record stream dies while the connection to the server stays up: the server kills the stream, or the device goes away and comes back under the same name (switching to another virtual console and back, replugging a USB microphone). The restart from obs-rust#109 only runs when the whole server connection comes back. Watch the stream and the server's devices: - a stream state callback queues a restart when the stream fails while the context is still ready (with the context lost, pulse_reconnected already restarts it) - the wrapper subscribes to source events on every ready context and passes new and removed sources to the inputs - a removed device stops the stream recording from it (pipewire-pulse leaves a stream that may not move unlinked and silent; PulseAudio kills it), and a new device starts any input that has no running stream, which also starts a source whose device was missing when it was created The decision lives in pulse_stream_on_event() (pulse-reconnect.c), without context or stream calls. Each event leads to at most one start attempt, so a device that is gone for good is not polled: its source only looks again when some device appears. A stream on the default device is left to the server, which moves it. test_pulse_stream_restart: 3 of 4 failing -> 4/4 against a private PipeWire 1.6.8, pipewire-pulse and WirePlumber 0.5.17 (10/10 repeated runs). test_pulse_reconnect gains three cases for the decision, which run without a sound server: 10/10. Fixes obs-rust#377. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Local-Gate: v1 tree=b92cfda608c4102ab19ee759b83e3b204db9d58d secs=146 lanes=lint:run,rust-test:run,tier2-linux:run Ci-Attestation: {"at":1791816870,"gate":"rust/all/fmt","host":"linux-x86_64","key":"43d368cdc63ffbee96f8f424fb25ff18bca826236b64358a15264b317ff71cb2","lane":"lint","parents":["71acac7f7ae8f22917dcb634078dba6979daa11a"],"secs":52,"stamp":"a6df21afe9b4561baff31ae98399fb4d","tree":"b92cfda608c4102ab19ee759b83e3b204db9d58d","v":1,"via":"run"} Ci-Attestation: {"at":1791816870,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"43d368cdc63ffbee96f8f424fb25ff18bca826236b64358a15264b317ff71cb2","lane":"lint","parents":["71acac7f7ae8f22917dcb634078dba6979daa11a"],"secs":52,"stamp":"0781c02615b216aa99ce07842dd0d2f8","tree":"b92cfda608c4102ab19ee759b83e3b204db9d58d","v":1,"via":"run"} Ci-Attestation: {"at":1791816870,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"711aaf4d1c9da2312829d055fca4b93e1998e322b173ed0296b9a59a2ce7a175","lane":"rust-test","parents":["71acac7f7ae8f22917dcb634078dba6979daa11a"],"secs":40,"stamp":"e34cb2cc9233bd8acca50ed5b20d7e47","tree":"b92cfda608c4102ab19ee759b83e3b204db9d58d","v":1,"via":"run"} Ci-Attestation: {"at":1791816870,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"570801778dbea9a4b654ff807958d72ed42b6138b5a3f597049426543b6541e2","lane":"tier2-linux","parents":["71acac7f7ae8f22917dcb634078dba6979daa11a"],"secs":55,"stamp":"07ef830ec41989672618504fae491db0","tree":"b92cfda608c4102ab19ee759b83e3b204db9d58d","v":1,"via":"run"}
…378) * test/cmocka: Add failing test for a PulseAudio input whose stream dies An Audio Input Capture on PulseAudio or PipeWire stays silent for good once its own record stream dies while the connection to the server stays up. Upstream, the reporter switched to another virtual console, which takes the device away from the session; back on the desktop the device returned under the same name, but OBS never recorded from it again until the source's device was changed. Unplugging and replugging a USB microphone, or the server killing the stream, end the same way. pulse-input.c connects a chosen device with PA_STREAM_DONT_MOVE and sets only a read callback: no stream state callback and no subscription to source events. The restart added for a lost server connection (pulse_reconnected) only runs when the whole context comes back. On PipeWire 1.6.8 with pipewire-pulse and WirePlumber 0.5.17: - device removed and re-added under the same name: the stream stays READY but unlinked (source index 4294967295) and gets no data, with no state, moved or suspended callback; PulseAudio kills it instead - stream node destroyed: the stream goes FAILED ("Entity killed") and nothing restarts it - device missing when the source is created: the start fails once and is never retried, so a microphone plugged in later stays silent test_pulse_stream_restart builds the linux-pulseaudio capture code into the test and runs it against a private PipeWire, WirePlumber and pipewire-pulse (test_pulse_monitor_device.sh: own runtime dir, config and D-Bus, no hardware) with virtual sources it loads itself. libobs's source calls are stubbed with --wrap, so no display is needed: each source counts the frames handed to obs_source_output_audio, and UI tasks run on a thread of their own. On master: replugged_source_resumes no audio within 3 s after the replug killed_stream_restarts no audio within 3 s after the kill late_source_starts no audio within 3 s after plugging in deleted_source_stays_quiet passes (control) 3 of 4 cases fail. The controls (a second microphone that is not touched keeps its stream and its audio; a device deleted for good causes no retry loop, no audio and no crash) pass. Exits 77 (skip) without PipeWire, WirePlumber, pipewire-pulse or pactl. Reported upstream in obsproject/obs-studio#10072 by foresto. Refs #377. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * linux-pulseaudio: Restart an input whose stream dies while connected An Audio Input Capture stays silent for good once its own record stream dies while the connection to the server stays up: the server kills the stream, or the device goes away and comes back under the same name (switching to another virtual console and back, replugging a USB microphone). The restart from #109 only runs when the whole server connection comes back. Watch the stream and the server's devices: - a stream state callback queues a restart when the stream fails while the context is still ready (with the context lost, pulse_reconnected already restarts it) - the wrapper subscribes to source events on every ready context and passes new and removed sources to the inputs - a removed device stops the stream recording from it (pipewire-pulse leaves a stream that may not move unlinked and silent; PulseAudio kills it), and a new device starts any input that has no running stream, which also starts a source whose device was missing when it was created The decision lives in pulse_stream_on_event() (pulse-reconnect.c), without context or stream calls. Each event leads to at most one start attempt, so a device that is gone for good is not polled: its source only looks again when some device appears. A stream on the default device is left to the server, which moves it. test_pulse_stream_restart: 3 of 4 failing -> 4/4 against a private PipeWire 1.6.8, pipewire-pulse and WirePlumber 0.5.17 (10/10 repeated runs). test_pulse_reconnect gains three cases for the decision, which run without a sound server: 10/10. Fixes #377. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Local-Gate: v1 tree=b92cfda608c4102ab19ee759b83e3b204db9d58d secs=146 lanes=lint:run,rust-test:run,tier2-linux:run Ci-Attestation: {"at":1791816870,"gate":"rust/all/fmt","host":"linux-x86_64","key":"43d368cdc63ffbee96f8f424fb25ff18bca826236b64358a15264b317ff71cb2","lane":"lint","parents":["71acac7f7ae8f22917dcb634078dba6979daa11a"],"secs":52,"stamp":"a6df21afe9b4561baff31ae98399fb4d","tree":"b92cfda608c4102ab19ee759b83e3b204db9d58d","v":1,"via":"run"} Ci-Attestation: {"at":1791816870,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"43d368cdc63ffbee96f8f424fb25ff18bca826236b64358a15264b317ff71cb2","lane":"lint","parents":["71acac7f7ae8f22917dcb634078dba6979daa11a"],"secs":52,"stamp":"0781c02615b216aa99ce07842dd0d2f8","tree":"b92cfda608c4102ab19ee759b83e3b204db9d58d","v":1,"via":"run"} Ci-Attestation: {"at":1791816870,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"711aaf4d1c9da2312829d055fca4b93e1998e322b173ed0296b9a59a2ce7a175","lane":"rust-test","parents":["71acac7f7ae8f22917dcb634078dba6979daa11a"],"secs":40,"stamp":"e34cb2cc9233bd8acca50ed5b20d7e47","tree":"b92cfda608c4102ab19ee759b83e3b204db9d58d","v":1,"via":"run"} Ci-Attestation: {"at":1791816870,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"570801778dbea9a4b654ff807958d72ed42b6138b5a3f597049426543b6541e2","lane":"tier2-linux","parents":["71acac7f7ae8f22917dcb634078dba6979daa11a"],"secs":55,"stamp":"07ef830ec41989672618504fae491db0","tree":"b92cfda608c4102ab19ee759b83e3b204db9d58d","v":1,"via":"run"} --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
When a monitor is switched off or unplugged, or the computer sleeps, the compositor ends the screencast of that output and removes its PipeWire node. OBS's stream only pauses, with no error, so the capture stayed frozen until the source was selected again (upstream obsproject/obs-studio#12063 and obsproject/obs-studio#12423). - 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. obs_pipewire_node_removed_is_lost() reports it once, like a lost connection, so the reconnection from obs-rust#109 starts a new portal session with the restore token. - reconnect-policy.c: reconnection never gives up. After the first 10 attempts (the same fast backoff as before, about a minute) it retries every 30 s for as long as the source exists: a monitor can be off for hours. Cancelling the portal's dialog still ends it. - screencast-portal.c: after the 10th failed attempt, one warning says that retries continue; later attempts are logged at debug level. 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. test_pipewire_reconnect: 10 of 10 pass. test_pipewire_screencast_resume: 3 of 3 pass; the capture shows the monitor again about 3.6 s after it went away (2.5 s off, then the next retry). Fixes obs-rust#398. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Local-Gate: v1 tree=2f8ee712fbb967927e2a4d0b3bcde2de99d390e0 secs=183 lanes=lint:run,rust-test:run,tier2-linux:run Ci-Attestation: {"at":1791827929,"gate":"rust/all/fmt","host":"linux-x86_64","key":"016db496eb8d8359b45087af682aca9b4c8d21729b2f1a0b9e6cbe4dca41bbf0","lane":"lint","parents":["efa075b66ee59d563fea3ae867ac9fb6525094a3"],"secs":66,"stamp":"e0f625dd56b7ddd199149220a3ccb604","tree":"2f8ee712fbb967927e2a4d0b3bcde2de99d390e0","v":1,"via":"run"} Ci-Attestation: {"at":1791827929,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"016db496eb8d8359b45087af682aca9b4c8d21729b2f1a0b9e6cbe4dca41bbf0","lane":"lint","parents":["efa075b66ee59d563fea3ae867ac9fb6525094a3"],"secs":66,"stamp":"bb406dbf4a7dbb5ac0016261a1a1bfa3","tree":"2f8ee712fbb967927e2a4d0b3bcde2de99d390e0","v":1,"via":"run"} Ci-Attestation: {"at":1791827929,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"12e029fa9a0f918b577703b1a314265afcbe6bd0077ba57a4b60b8e030da2f9d","lane":"rust-test","parents":["efa075b66ee59d563fea3ae867ac9fb6525094a3"],"secs":51,"stamp":"c03f965bc23e8582da086528bef285f6","tree":"2f8ee712fbb967927e2a4d0b3bcde2de99d390e0","v":1,"via":"run"} Ci-Attestation: {"at":1791827929,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"88688525bfaba3ca64113acbfdec9176fe32f1fcbd00081af6e6a85b7219797f","lane":"tier2-linux","parents":["efa075b66ee59d563fea3ae867ac9fb6525094a3"],"secs":66,"stamp":"99680d5239648b5ebb4b2815a9007eab","tree":"2f8ee712fbb967927e2a4d0b3bcde2de99d390e0","v":1,"via":"run"}
…s-rust#1111) * test/cmocka: Screen captures that are not showing get frames test_pipewire_screencast_resume gains three cases. Its fake compositor now links every capture stream to the monitor (each once, as before), and the test counts the frames each stream takes (pw_stream_dequeue_buffer, wrapped at link time). With a capture showing, a second one in a scene that is not live and a third disabled in a live scene, all three streams get the monitor's frames. Their streams connect active, and only a hide after a show pauses them, so the compositor copies every frame for every screen capture (obsproject/obs-studio#13836). RED: sources_not_showing_keep_their_streams_inactive fails, "frames in 2 s: showing capture 60, in another scene 60, disabled 60" (0 expected for the two that are not showing). Guards that pass today: showing_a_source_starts_its_stream (20 rounds of show, a new frame, hide, no more frames) and sources_not_showing_stay_inactive_after_reconnect (obs-rust#109: after the monitor comes back, only the showing capture streams). The four existing cases still pass. Upstream: obsproject/obs-studio#13836. Refs obs-rust#1110. Co-Authored-By: Claude Opus 5.5 <[email protected]> * linux-pipewire: Keep the streams of hidden screen captures paused Every Screen Capture (PipeWire) stream connected active. libobs calls .hide only when a showing source stops showing, so a source that was disabled or in a scene that is not live when its portal session finished kept streaming, and the compositor copied every frame for it. With several captures this lags the desktop and OBS (obsproject/obs-studio#13836). Our reconnect (obs-rust#109) already paused a replacement stream for a hidden source; the first connect did not. The capture now remembers whether libobs last showed or hid it, and connects its stream with PW_STREAM_FLAG_INACTIVE unless it is showing. show() starts the stream as before. A show_mutex keeps that flag and the stream's active state in step: show() and hide() run on the video thread, a stream is connected or swapped out on the main loop. It is taken before the graphics lock and streams_mutex; show() and hide() never hold either. The camera source connects the same way but is left alone: nobody has reported it, and pausing a never-shown camera would let the device stop, so its first show would wait for the camera to start where today it is already running. GREEN for obs-rust#1110 (RED 2d6eb0d: a source in another scene and a disabled one each got 60 frames in 2 s). Now 0 and 0, with 60 for the showing capture. Shown 20 times, such a source got a new frame each time, and hiding it stopped its frames. After a reconnect only the showing capture streams. Upstream: obsproject/obs-studio#13836. Fixes obs-rust#1110. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>

Description
When PipeWire restarts (for example when the user restarts audio), OBS's PipeWire screen capture and its PulseAudio-protocol audio sources stay dead until OBS is restarted. With this, a recording carries on: the screen holds its last frame, then screen and audio come back by themselves.
test/cmocka: Add RED Linux capture reconnect tests: moves the reconnect decisions intolinux-pipewire/reconnect-policy.candlinux-pulseaudio/pulse-reconnect.c, with stubs that keep today's behaviour, and addstest_pipewire_reconnectandtest_pulse_reconnect. 9 of their 13 tests fail on this commit; each fix below turns its own tests green.linux-pipewire: Report lost PipeWire connections:obs_pipewiregets a callback for a lost connection (core-EPIPE) or a stream that fails after it was streaming. Errors before a stream ever streamed would only repeat, so they are left alone as before.linux-pipewire: Reconnect screen capture:linux-pulseaudio: Reconnect to the server: replace the failed context with aPA_CONTEXT_NOFAILone and notify sources when it is ready, resolving the old@todo. Only a connection that worked is retried (no server at startup fails as before), and a server that keeps refusing is retried with backoff.linux-pulseaudio: Handle a server with no default device:strlen(NULL)on the default sink name, hit right after the server restarts.linux-pulseaudio: Restart streams after reconnect: each source recreates its stream, retrying every 100 ms for up to 10 s until its device reappears.Motivation and Context
Fixes #108
Restarting audio is a normal fix for a stuck Bluetooth headset or a wrong output, and it shouldn't silently break a running recording or stream.
How Has This Been Tested?
Tested by hand on Arch Linux, Hyprland, PipeWire 1.6.8 with pipewire-pulse, xdg-desktop-portal-hyprland 1.4.1. I recorded 1080p60 while a moving 60 fps test pattern was on screen, ran
systemctl --user restart pipewiremid-recording, and measured the recording with ffmpegfreezedetectandsilencedetect:Most of the 0.6 s is WirePlumber coming back and linking the stream; the portal round trips take about 0.1 s. The portal's own buffer bug (fixed in xdph master by hyprwm/xdg-desktop-portal-hyprland#424 and #425) sometimes fails the new stream a second later; OBS reconnects again in under 0.1 s.
Automated (cmocka, no daemon, portal or server needed; built only where the plugins are):
test_pipewire_reconnect-EPIPEis a lost connection, reported once; other core errors are not; a stream error after streaming is, before streaming is not; screencast backoff 500 ms → 10 s, giving up after 10 attemptstest_pulse_reconnectI built every commit and ran both tests at each step: 4 pass on the RED commit (the ones that check errors are not treated as lost), then 7, 8, 11, 12 and 13 after each fix.
The manual measurement below was taken before the decisions were moved into their own files; that move does not change behaviour.
clang-format 22.1.3 and gersemi (
./lint's C lanes) pass, and each commit builds on its own without warnings. I couldn't run the Docker Tier 2 lane locally (no Docker access here); the tests were built and run against Arch's PipeWire 1.6.8 and libpulse headers.Not tested:
OBS_TASK_UI, so they are not restarted there; libobs logs "UI task could not be queued" for each source.Types of changes
Checklist:
🤖 Generated with Claude Code