If I play music through a USB sound card in ALSA, and accidentally unplug the USB cable, then it stops playing automatically, making it easy to detect the problem and fix it:

$ mpv --audio-device=alsa/hw:2 sound.wav
 (+) Audio --aid=1 (pcm_s16le 2ch 44100Hz)
AO: [alsa] 44100Hz stereo 2ch s16
A: 00:00:05 / 00:03:41 (2%)
[ao/alsa] Device lost, trying to recover...
Exiting... (Interrupted by error)

However, if I play music thing through Pulseaudio and unplug the USB cable then it "fails over" to another sink and continues playing:

$ mpv --audio-device=pulse/alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo sound.wav
 (+) Audio --aid=1 (pcm_s16le 2ch 44100Hz)
AO: [pulse] 44100Hz stereo 2ch s16
A: 00:00:16 / 00:03:41 (7%)
# no error message

In this case, I have only two sinks, and unplugging the USB device causes the audio connection to move to the PCI device, which happens to be my laptop speakers:

$ pacmd list-sinks | grep name:
        name: <alsa_output.pci-0000_06_00.6.analog-stereo>
        name: <alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo>

After reconnecting the USB cable, the audio still comes out through the laptop speakers.

Pulseaudio's behavior might be useful if I knew how to control it, but I don't. In particular, I would like to be able to control which sink is activated on failover, and I would like to be able to disable failover so that an error occurs in the client application when the USB cable is unplugged.

Obviously, depending on the circumstances, the default behavior might cause me some embarrassment. For example if I am listening to something private with headphones in a public place, and Pulseaudio decides to reroute it through my laptop speakers, that would be quite annoying. The situation would be remedied if I could configure the USB sink to failover to either a null sink, which discards samples, or to an error sink, which produces an error in the client. Are either of these possible?

1 Answer 1


Through Pulseaudio version 13.0, sink evacuation can be disabled with

pactl unload-module module-rescue-streams

or by commenting out the appropriate line in /etc/pulse/default.pa.

Starting with version 14.0, module-rescue-streams becomes part of the core functionality and cannot be unloaded. However, a new boolean option has been introduced to make it possible to disable it. After 14.0, sink evacuation can be disabled by adding rescue-streams=no in /etc/pulse/daemon.conf.

There are currently no plans to allow users to configure which sink a given stream evacuates to when its sink fails. Streams are always evacuated to the default sink.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .