[GH-ISSUE #946] Audio Sink Error when switching between two instances of librespot #462

Closed
opened 2026-02-27 19:30:45 +03:00 by kerem · 1 comment
Owner

Originally created by @ghost on GitHub (Jan 26, 2022).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/946

Tested on: librespot 0.3.1 4370aa1 (Built on 2021-12-22, Build ID: Ov05MEB1, Profile: release)

This is probably a very unusual use case, but I am trying to open an issue, hopefully it leads to a good discussion, as usual.

I am running two instances of librespot on one device (Raspberry Pi 3).

Both are configured to output to the same alsa device. The meaning of this is that one instance is configured with --normalisation-pregain "-9" and is used when listening to music on headphones and the other instance is configured with --normalisation-pregain "6" and is used on speakers at night.

The problem is that when switching between them, for example from headphones to speakers, the new instance starts before the old instance stops and this creates an error with the alsa sink:

[2022-01-20T16:15:55Z ERROR librespot_playback::player] Audio Sink Error Connection Refused: <AlsaSink> Device hw:1,0 May be Invalid, Busy, or Already in Use, ALSA function 'snd_pcm_open' failed with error 'EBUSY: Device or resource busy'

Is there anything the devs can do with this? Maybe implement a small (configurable) delay somewhere in the chain, or is there a better way to handle this use case?

Originally created by @ghost on GitHub (Jan 26, 2022). Original GitHub issue: https://github.com/librespot-org/librespot/issues/946 Tested on: ``librespot 0.3.1 4370aa1 (Built on 2021-12-22, Build ID: Ov05MEB1, Profile: release)`` This is probably a very unusual use case, but I am trying to open an issue, hopefully it leads to a good discussion, as usual. I am running two instances of `librespot` on one device (Raspberry Pi 3). Both are configured to output to the same `alsa` device. The meaning of this is that one instance is configured with `--normalisation-pregain "-9"` and is used when listening to music on headphones and the other instance is configured with `--normalisation-pregain "6"` and is used on speakers at night. The problem is that when switching between them, for example from `headphones` to `speakers`, the new instance starts before the old instance stops and this creates an error with the alsa sink: ``` [2022-01-20T16:15:55Z ERROR librespot_playback::player] Audio Sink Error Connection Refused: <AlsaSink> Device hw:1,0 May be Invalid, Busy, or Already in Use, ALSA function 'snd_pcm_open' failed with error 'EBUSY: Device or resource busy' ``` Is there anything the devs can do with this? Maybe implement a small (configurable) delay somewhere in the chain, or is there a better way to handle this use case?
kerem 2026-02-27 19:30:45 +03:00
  • closed this issue
  • added the
    wontfix
    label
Author
Owner

@roderickvd commented on GitHub (Jan 26, 2022):

Sorry, but that is not something I am going to deal with. You may want to look at using PulseAudio as a backend, that can accept multiple sources at the same time.

<!-- gh-comment-id:1022415505 --> @roderickvd commented on GitHub (Jan 26, 2022): Sorry, but that is not something I am going to deal with. You may want to look at using PulseAudio as a backend, that can accept multiple sources at the same time.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librespot#462
No description provided.