Skip to content

fix: linux pipewire native formats - #41

Merged
Horuse merged 17 commits into
mainfrom
fix/linux-pipewire-native-formats
Sep 10, 2026
Merged

fix: linux pipewire native formats#41
Horuse merged 17 commits into
mainfrom
fix/linux-pipewire-native-formats

Conversation

@Horuse

@Horuse Horuse commented Sep 9, 2026

Copy link
Copy Markdown
Owner

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.conf file 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.toml passes
  • cargo fmt --manifest-path src-tauri/Cargo.toml --check passes
  • bun run check passes with 0 errors; 22 existing warnings remain
  • Resampler tests pass, including wide-channel output
  • No generated TypeScript types were affected
  • No new dependency was added
  • Linux runtime crash reproduction passes after the fix
  • macOS runtime smoke test passes
  • Windows runtime smoke test

Platform coverage

  • Developed on: macOS, Apple Silicon
  • Tested on: macOS and Linux
  • Linux:
    • Reproduced the crash with a 16-channel, 96 kHz Splitwave virtual device.
    • Confirmed that Linux terminated the speaker worker after it exhausted its
      real-time CPU budget.
    • Verified that the same pipeline remains running after the fix.
    • Ran cargo check and the Rust library tests with the required Linux audio
      and UI development libraries installed.
  • macOS:
    • Tested the equivalent pipeline with the Splitwave virtual device, physical
      output, file input, network audio, and waveform output.
    • Verified that normal device pacing no longer floods the log with false clock
      warnings.
    • Ran cargo check, cargo fmt --check, and bun run check.
  • Windows:
    • Tested the equivalent pipeline with the Splitwave virtual device, physical
      output, file input, network audio, and waveform output.

@Horuse
Horuse merged commit b245b43 into main Sep 10, 2026
9 checks passed
@Horuse
Horuse deleted the fix/linux-pipewire-native-formats branch September 10, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant