Repository navigation
Fix "Could not find default hardware sink" race after Maxine restart - #5
Merged
Merged
Conversation
…axine set_maxine_enabled() restarts pipewire, pipewire-pulse, and wireplumber every time the Maxine backend is toggled, but WirePlumber re-enumerates ALSA cards asynchronously after those restarts. apply_routes() ran immediately afterward and would see only the filter's own virtual sink for up to ~1-2s, failing with "Could not find default hardware sink" and leaving broadcast stuck off. Poll pactl briefly after the restart cascade until a real hardware sink reappears before returning.
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.
Summary
set_maxine_enabled()restartspipewire,pipewire-pulse, andwireplumberevery time the Maxine backend is toggled on/off.pactl list sinks(only the filter's own virtual sink shows up).set_filter_active→apply_routesran immediately after the restart with no delay, sofind_default_sink_namereliably hit this window and failed with "Could not find default hardware sink" — leaving broadcast stuck off.wait_for_hardware_sink(), a short best-effort poll (200ms interval, 8s cap) after the restart cascade inset_maxine_enabled, so callers only proceed once a real hardware sink is present again.Test plan
cargo test -p broadcast-core -p broadcast-ctl(77 tests pass)broadcast-ctl on→Error: Could not find default hardware sink), confirmed pactl only reports the filter's virtual sink immediately after a pipewire/wireplumber restart cascade and recovers ~1s laterbroadcast-ctl on/offnow succeed reliably withHealth: OKand correct default sink/source