Skip to content

feat(macos): follow CoreAudio default output device changes - #1431

Open
wesalvaro wants to merge 1 commit into
Spotifyd:masterfrom
wesalvaro:macos-default-output
Open

wesalvaro wants to merge 1 commit into
Spotifyd:masterfrom
wesalvaro:macos-default-output

Conversation

@wesalvaro

Copy link
Copy Markdown

librespot-playback backends such as PortAudio query CoreAudio's device list and default output device once when the sink is constructed (Pa_Initialize + get_default_output_index in PortAudioSink::open). On macOS, connecting or disconnecting Bluetooth headphones, plugging into a dock, or switching outputs in Control Center updates CoreAudio's kAudioHardwarePropertyDefaultOutputDevice without notifying PortAudio, leaving a long-running spotifyd writing to the stale output device.

When no explicit --device is configured on macOS, wrap the backend in DefaultOutputSink, which queries kAudioHardwarePropertyDefaultOutputDevice via CoreAudio.framework and reopens the underlying sink when the default output AudioDeviceID changes, and closes the inner sink on stop() so no CoreAudio stream is held open while idle.

librespot-playback backends such as PortAudio query CoreAudio's device list
and default output device once when the sink is constructed (Pa_Initialize +
get_default_output_index in PortAudioSink::open). On macOS, connecting or
disconnecting Bluetooth headphones, plugging into a dock, or switching outputs
in Control Center updates CoreAudio's kAudioHardwarePropertyDefaultOutputDevice
without notifying PortAudio, leaving a long-running spotifyd writing to the
stale output device.

When no explicit --device is configured on macOS, wrap the backend in
DefaultOutputSink, which queries kAudioHardwarePropertyDefaultOutputDevice via
CoreAudio.framework and reopens the underlying sink when the default output
AudioDeviceID changes, and closes the inner sink on stop() so no CoreAudio
stream is held open while idle.
@wesalvaro wesalvaro changed the title fix(macos): follow CoreAudio default output device changes feat(macos): follow CoreAudio default output device changes Oct 21, 2026

This branch has not been deployed

No deployments
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