Skip to content

fix: use BufferSize::Default for PipeWire ALSA devices on Linux - #2142

Open
nightwatch92 wants to merge 1 commit into
CapSoftware:mainfrom
nightwatch92:fix/linux-pipewire-buffer-size
Open

fix: use BufferSize::Default for PipeWire ALSA devices on Linux#2142
nightwatch92 wants to merge 1 commit into
CapSoftware:mainfrom
nightwatch92:fix/linux-pipewire-buffer-size

Conversation

@nightwatch92

@nightwatch92 nightwatch92 commented Aug 20, 2026

Copy link
Copy Markdown

cpal's BufferSize::Fixed calls snd_pcm_hw_params_set_buffer_size (exact),
which pipewire-alsa rejects unless the frame count matches its current
quantum. Fall back to BufferSize::Default (uses _near) for default/pulse/
pipewire device names on Linux.

Also emit a targeted error when pactl is not installed instead of the
generic 'no monitor input found' message — the previous message sent
users chasing ALSA config when the real fix is installing pulseaudio-utils.

Fixes #2131.

Greptile Summary

This PR improves Linux audio capture compatibility and diagnostics.

  • Uses CPAL’s default buffer-size negotiation for Linux devices named default, pulse, or pipewire.
  • Reports targeted installation guidance when system-audio discovery cannot find pactl on PATH.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete changed-code defect identified.

The buffer-selection change is Linux-scoped and narrowly targets the device aliases described by the fix, while the new diagnostic preserves successful monitor selection and only changes the terminal error path.

Important Files Changed

Filename Overview
crates/recording/src/feeds/microphone.rs Selects BufferSize::Default for recognized Linux PulseAudio/PipeWire ALSA device names while preserving fixed latency buffers elsewhere.
crates/recording/src/sources/screen_capture/linux.rs Adds a dedicated missing-pactl diagnostic after existing CPAL and pactl monitor-source discovery attempts fail.

Reviews (1): Last reviewed commit: "fix: use BufferSize::Default for PipeWir..." | Re-trigger Greptile

  cpal's BufferSize::Fixed calls snd_pcm_hw_params_set_buffer_size (exact),
  which pipewire-alsa rejects unless the frame count matches its current
  quantum. Fall back to BufferSize::Default (uses _near) for default/pulse/
  pipewire device names on Linux.

  Also emit a targeted error when pactl is not installed instead of the
  generic 'no monitor input found' message — the previous message sent
  users chasing ALSA config when the real fix is installing pulseaudio-utils.

  Fixes CapSoftware#2131.
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.

alsa function ' snd_pcm_hw_params_set_buffer_size' failed , linux system audio input failed to connect

1 participant