Disconnecting an alsa USB source blocks a linked null sink
- PipeWire version (
pipewire --version
): 0.3.43 - Distribution and distribution version (
PRETTY_NAME
from/etc/os-release
): Custom - Desktop Environment: None
- Kernel version (
uname -r
): 5.12.0 - Pulseaudio version: 13.0
Description of Problem:
Disconnecting an alsa USB source blocks a linked null sink
I am using a null sink to mix two or more alsa sources to get one source that can then be used by multiple applications via the null sink's monitor source. To link the alsa source to the null sink I use the loopback module. Once this setup (via pulse-api) is complete, everything works fine.
Here is a simple graph of the use case:
+---------------+ +-----------------+ +------------------+
| alsa source A |---| module-loopback |---| |
+---------------+ +-----------------+ | |
| module-null-sink |
+---------------+ +-----------------+ | |--- monitor source for gstreamer apps
| alsa source B |---| module-loopback |---| |
+---------------+ +-----------------+ +------------------+
But if one of the alsa sources is unexpectedly removed (USB unplug), the null sink stops working and does not output the content of the remaining source(s). According to pactl, the source device is gone, but the associated loopback module and source output are still present. As soon as I manually unload the loopback module of the lost alsa source, the null sink starts working again.
If I replace pipewire-pulse with the original pulseaudio daemon, the null sink still works as expected when an alsa source is removed. It simply outputs the content of the remaining source(s). This works without noticeable interruptions. According to pactl, not only is the source gone, but the associated loopback module has also been automatically removed.
Since unexpected device removals (e.g. USB headsets) is a quite common use case, I think there is a working solution for pipewire-pulse as well. Unfortunately, I haven't found it until now. Maybe I can get some hints?
How Reproducible:
Always.
Steps to Reproduce:
- Install at least two alsa sources, one of which should be connected via USB
- Create the null sink 'pactl load-module module-null-sink sink_name=mix'
- Connect first source 'pactl load-module module-loopback sink=mix source='
- Connect second source 'pactl load-module module-loopback sink=mix source='
- Listen to monitor output of null sink
- Unplug one of the sources
Actual Results:
The monitor output stops outputting until the loose loopback module is manually removed.
Expected Results:
The monitor output of the null sink continues to output the content of the remaining source(s).