fix: linux pipewire native formats - #41
Merged
Merged
Conversation
This reverts commit 38e7bc7.
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.
What does this PR do?
Reworks Linux virtual audio devices to use PipeWire directly instead of writing
a configuration file and restarting the audio server. Virtual devices are now
created and removed while PipeWire is running, restored when Splitwave starts,
and kept in sync with the app's saved configuration. The old
50-splitwave-sinks.conffile is removed automatically.Linux inputs and outputs now use the sample rate and channel count reported by
PipeWire. This fixes incorrect 48 kHz stereo assumptions for devices with other
formats, including Splitwave virtual devices with many channels. Capture also
adapts if PipeWire negotiates a different rate after the stream starts.
The PR also fixes a Linux crash triggered by routing audio to a 16-channel,
96 kHz virtual device. The speaker worker could consume its Linux real-time CPU
budget and was then terminated by the kernel without a Rust panic or useful
error. Audio startup and pacing are now bounded so the worker keeps real-time
priority without exhausting that budget.
Wide output devices now avoid processing unused channels during sample-rate
conversion while still sending the device its full channel layout. Audio
callbacks use preallocated buffers, and silent input meters no longer perform
continuous animation work.
Why is this the right approach?
PipeWire already provides the runtime lifecycle and format information needed
for Linux virtual devices. Using those APIs avoids restarting the user's audio
server and interrupting unrelated applications.
The crash fix addresses the actual Linux real-time scheduling limit instead of
raising or disabling the system limit. It also keeps the same audio architecture
on all platforms while allowing each operating system to use its native device
format and scheduling behavior.
The cross-platform audio rules and platform-specific expectations are now
documented in
docs/CONCEPT.md.No new dependency was added.
Checklist
cargo check --manifest-path src-tauri/Cargo.tomlpassescargo fmt --manifest-path src-tauri/Cargo.toml --checkpassesbun run checkpasses with 0 errors; 22 existing warnings remainPlatform coverage
real-time CPU budget.
cargo checkand the Rust library tests with the required Linux audioand UI development libraries installed.
output, file input, network audio, and waveform output.
warnings.
cargo check,cargo fmt --check, andbun run check.output, file input, network audio, and waveform output.