Incorrect node/profile switching when unplugging headphones
In order for wireplumber to automatically activate the headphone profile when I plug them in, I set the headphones as the default profile for my audio card:
❯ cat default-profile
[default-profile]
alsa_card.pci-0000_00_1b.0=output:analog-stereo
alsa_card.usb-Blue_Microphones_Yeti_Stereo_Microphone_REV8-00=input:iec958-stereo
alsa_card.usb-046d_HD_Pro_Webcam_C920_D390F1BF-02=off
alsa_card.pci-0000_01_00.1=output:hdmi-stereo-extra1
When plugging my headphones into the front jack, wireplumber correctly switches to that profile and updates all links. The issue now is that when unplugging the headphones, it does not switch the profile back:
policy-device-profile.lua:165:handleProfiles: Default profile output:analog-stereo unavailable for alsa_card.pci-0000_00_1b.0
policy-device-profile.lua:181:handleProfiles: Best profile output:iec958-stereo did not change on alsa_card.pci-0000_00_1b.0
Looking at the source of policy-device-profile.lua
, when the best profile did not change, no action is performed, even though the best profile might not be the active profile.
What happens instead is that module-default-nodes.c
reevulates the nodes, finds that the node alsa_output.pci-0000_00_1b.0.analog-stereo
has no available routes and thus switches over to alsa_output.pci-0000_01_00.1.hdmi-stereo-extra1
. I did add some debug logging to figure this one out.
So the big question is: Am I doing something wrong; Should I not set any default profile? (If I set the speakers (Digital Stereo) as default profile, plugging in the headphones will not automatically switch to them).
Or is this a bug in handleBestProfile
/ handleProfiles
?