Closed Districtfine closed 2 years ago
I can reproduce it. Is there anything I can do to help?
Okay I can confirm this one. However that's the way the PulseAudio daemon maps streams, and this indicator is not affecting that.
At the same time, the standard Sound Panel in Gnome Control Center does switch the default sink/source in such a way that any stream appearing after that is mapped to the default.
I'll investigate how the Sound Panel handles it once I've got enough time.
I use 2.2.0 in Linux Mint 19.1. Problem is actual.
This happens for me when restore_device
is true, which is the default. Disabling it makes re-appearing streams go to the newly selected output:
# /etc/pulse/default.pa
load-module module-stream-restore restore_device=false
The line already exists, so you just need to add restore_device=false
.
The docs actually explain how the gnome sound switcher works – it simply edits the database for all streams to the newly selected device: https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/DefaultDevice/
I took a look my file (tdbdump ~/.config/pulse/*stream-volumes.tdb
) and it seems this is the format:
https://sources.debian.org/src/pulseaudio/12.2-4/src/modules/module-stream-restore.c/?hl=2474#L998-L1008 with these prefixes:
https://github.com/pulseaudio/pulseaudio/blob/master/src/pulsecore/tagstruct.h#L41-L61
However, I can't quite match my local entries to how I believe the code reads them, so I must've a misunderstanding somewhere.
Thanks @breunigs, it looks indeed that it "works as designed":
Whenever a new stream appears, PulseAudio's stream-restore module checks if the same stream has been seen before, and if it is, then the stream is connected to the same sink or source that was used previously. There is a concept of a "fallback" device, which is used if the stream has not been seen before.
For those who happen to dislike the way PulseAudio works, the same page lists four possible solutions:
stream-volumes
in its name in the ~/.pulse
directory and restart PulseAudio, orrestore_device=false
like in the comment above.If I have time, I'll try to mimic Gnome's behaviour (not sure what "modifying the stream-restore database" entails exactly).
Considering the alternatives (especially the persistent fix of editing PA config, item 4 above), this item is closed.
For example, if I have my default device set as my speaker then I change the default device to headphones, all sounds currently playing will switch to headphones. But if I launch a program, its audio will play from the speakers, until I open the sound switcher and select headphones for a second time.