fix(live-input): warn when another process already publishes the live-input sink - #353
Merged
Merged
Conversation
…-input sink Two renderers publishing the same `node.name` (an orender from another workflow, an orphan from a previous session) let WirePlumber resolve the default sink to the older, driver-less node: players hang on it while the healthy renderer reports nothing. Both PipeWire bridge backends now take one registry snapshot on their main loop right after the core connects, before the node is published: Audio/Sink nodes carrying our name are joined to their Client globals and those owned by another process (pipewire.sec.pid) are logged with pid, binary and node id, and posted to the input status Studio displays. The node is never renamed; a scan that fails or times out is skipped so it can never keep the sink from being published. The live-input manager clears the previous input error before spawning the capture thread so the thread's connect-time warning is not wiped by the reset racing it, and Studio opens the Audio Input section on the warning's rising edge as it does for bridge-path errors. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Two
orenderprocesses (one from another workflow, one launched by Studio) both published a PipeWire sink namedomniphony(render.live_input.node,input_mode: pipewire_bridge). WirePlumber resolved the default sinkomniphonyto the older node, owned by an orphan renderer whose output device (a suspended headphone sink) never cycled. Firefox's stream attached to a driver-less node and video playback froze. Studio showed nothing wrong because its own renderer was healthy.Change
audio_input::pipewire_node_conflict: one registry round trip (get_registry+core.sync) on the backend's main loop, right after the core connects and before the node is published. One-shot at connect, off the realtime path. It collects theAudio/Sinknodes whosenode.namematches ours plus theClientglobals, joins them throughclient.id, and reports the nodes owned by another process (pid frompipewire.sec.pid, fallbackapplication.process.id; binary fromapplication.process.binary, fallbackapplication.name). Same-pid nodes (a sibling connection, the previous incarnation of the backend still tearing down) are not conflicts; nodes with no resolvable owner are reported.pipewire.rs(pw_stream) andpipewire_client_node.rs(pw_client_node).log::warn!naming pid, binary and node id, andInputControl::set_input_errorso it reaches Studio's input status (applied.error→inputError). The node is never renamed. A scan that fails or times out (2 s bound) is logged and skipped, so it can never keep the sink from being published.live_input.rs: the manager now clearsinput_errorbefore spawning the capture thread instead of after, so the thread's connect-time warning is not wiped by the reset racing it.init.js: the Audio Input section auto-opens on the warning's rising edge, as it already does for bridge-path errors.Example message:
Tests
live_registry_scan_completes_and_never_reports_this_process(#[ignore], needs a PipeWire session): run against this machine's daemon while another workflow'sorenderwas publishingomniphony, it listednode 477, pid 1491576 (orender).cargo test -p audio_input,cargo check -p omniphony-rendererandcargo fmt --all --checkare clean;rustfmtwas run only on the edited files.Not covered (follow-up)
Livemode sink (run_pipewire_pcm_capture_loopinlive_input.rs) publishes a name the same way and could call the same helper.🤖 Generated with Claude Code