Skip to content

fix(pulseaudio): use device names as id#1228

Merged
roderickvd merged 3 commits into
masterfrom
fix/pulseaudio-human-ids
Jun 1, 2026
Merged

fix(pulseaudio): use device names as id#1228
roderickvd merged 3 commits into
masterfrom
fix/pulseaudio-human-ids

Conversation

@roderickvd
Copy link
Copy Markdown
Member

New output:

Supported hosts:
  [PulseAudio, Alsa]
Available hosts:
  [PulseAudio, Alsa]
PulseAudio
  Default Input Device:
    Some("pulseaudio:alsa_input.usb-SunplusIT_Inc_PC_Camera_JV0-02.analog-stereo")
  Default Output Device:
    Some("pulseaudio:alsa_output.usb-Schiit_Audio_Yggdrasil__384_1-00.analog-stereo")
  Devices: 
  1. pulseaudio:alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo (Audio Adapter (Unitek Y-247A) Analog Stereo)
  ...

Old output:

Supported hosts:
  [PulseAudio, Alsa]
Available hosts:
  [PulseAudio, Alsa]
PulseAudio
  Default Input Device:
    Some("pulseaudio:63")
  Default Output Device:
    Some("pulseaudio:62")
  Devices: 
  1. pulseaudio:61 (alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo)
  ...

Fixes #1227

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the PulseAudio backend to produce stable, meaningful DeviceIds by using the PulseAudio sink/source names rather than their transient numeric indexes, addressing unstable IDs (notably for Bluetooth devices) reported in #1227.

Changes:

  • Change PulseAudio DeviceTrait::id() to use info.name (e.g. alsa_output.*, bluez_output.*) instead of info.index.
  • Update Device equality and hashing to be based on info.name rather than info.index.
  • Adjust DeviceTrait::description() to prefer the human-friendly PulseAudio description as the display name.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/host/pulseaudio/mod.rs Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread src/host/pulseaudio/mod.rs Outdated
@DanielHabenicht
Copy link
Copy Markdown

Works!

@roderickvd roderickvd merged commit d2a2688 into master Jun 1, 2026
34 checks passed
@roderickvd roderickvd deleted the fix/pulseaudio-human-ids branch June 1, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pulseaudio Device IDs are useless for bluetooth devices.

3 participants