Wrong default sink after after Bluetooth speaker disconnect
I'm on kubuntu 20.04 running This is PulseAudio 13.99.1
I set up a equalizer-sink as follow /etc/pulse/default.pa adding at the bottom to a default config file the following lines:
load-module module-dbus-protocol load-module module-equalizer-sink sink_master=alsa_output.pci-0000_00_1f.3.analog-stereo sink_name=EqSink sink_properties="device.description='EqSink'" set-default-sink EqSink
On laptop start the defaulted sink is correctly EqSink When I connect a Bluetooth speaker the audio is correctly moved to the Bluetooth but when I disconnect the device the new default sink is set to alsa_output.pci-0000_00_1f.3.analog-stereo
If I use the volume button to change default device the system work correcly but on direct disconnect does not. What I noticed is that when I manually click the change of the default seems that function pa_core_set_configured_default_sink from core.c is executed while on disconnect is not. On all scenario we call core.c -> pa_core_update_default_sink but on disconnect it pick up the sink with index 0 instead the default set on the config file.
Here some logs:
From Bluetooth speaker to EqSink:
Apr 26 14:57:48 Latitude-7480 pulseaudio[70426]: configured_default_sink: bluez_sink.EC_81_93_2A_51_7E.a2dp_sink -> EqSink Apr 26 14:57:48 Latitude-7480 pulseaudio[70426]: default_sink: bluez_sink.EC_81_93_2A_51_7E.a2dp_sink -> EqSink Apr 26 14:57:48 Latitude-7480 pulseaudio[70426]: Restoring volume for sink input sink-input-by-application-name:Firefox. Apr 26 14:57:48 Latitude-7480 pulseaudio[70426]: Restoring mute state for sink input sink-input-by-application-name:Firefox. Apr 26 14:57:48 Latitude-7480 pulseaudio[70426]: Restoring device for stream sink-input-by-application-name:Firefox. Apr 26 14:57:48 Latitude-7480 pulseaudio[70426]: Requested tlength=200,00 ms, minreq=24,99 ms Apr 26 14:57:48 Latitude-7480 pulseaudio[70426]: Trying resume... Apr 26 14:57:48 Latitude-7480 pulseaudio[70426]: Trying to disable ALSA period wakeups, using timers only Apr 26 14:57:48 Latitude-7480 pulseaudio[70426]: ALSA period wakeups disabled Apr 26 14:57:48 Latitude-7480 pulseaudio[70426]: Time scheduling watermark is 20,00ms Apr 26 14:57:48 Latitude-7480 pulseaudio[70426]: Resumed successfully... Apr 26 14:57:48 Latitude-7480 pulseaudio[70426]: Starting playback.
From EqSink to Bluetooth speaker:
Apr 26 14:58:07 Latitude-7480 pulseaudio[70426]: configured_default_sink: EqSink -> bluez_sink.EC_81_93_2A_51_7E.a2dp_sink Apr 26 14:58:07 Latitude-7480 pulseaudio[70426]: default_sink: EqSink -> bluez_sink.EC_81_93_2A_51_7E.a2dp_sink Apr 26 14:58:07 Latitude-7480 pulseaudio[70426]: Restoring volume for sink input sink-input-by-application-name:Firefox. Apr 26 14:58:07 Latitude-7480 pulseaudio[70426]: Restoring mute state for sink input sink-input-by-application-name:Firefox. Apr 26 14:58:07 Latitude-7480 pulseaudio[70426]: Restoring device for stream sink-input-by-application-name:Firefox. Apr 26 14:58:07 Latitude-7480 pulseaudio[70426]: Resetting filter Apr 26 14:58:07 Latitude-7480 pulseaudio[70426]: Trying to change sample spec Apr 26 14:58:07 Latitude-7480 pulseaudio[70426]: Requested tlength=200,00 ms, minreq=24,99 ms Apr 26 14:58:07 Latitude-7480 pulseaudio[70426]: Forcing resampler 'copy', because of fixed, identical sample rates. Apr 26 14:58:07 Latitude-7480 pulseaudio[70426]: Transport /org/bluez/hci0/dev_EC_81_93_2A_51_7E/sep1/fd19 acquired: fd 44 Apr 26 14:58:07 Latitude-7480 pulseaudio[70426]: Transport /org/bluez/hci0/dev_EC_81_93_2A_51_7E/sep1/fd19 resuming Apr 26 14:58:07 Latitude-7480 pulseaudio[70426]: Storing volume/mute/device for stream sink-input-by-application-name:Firefox.
On Bluetooth speaker disconnect:
Apr 26 14:58:53 Latitude-7480 acpid: input device has been disconnected, fd 22 Apr 26 14:58:53 Latitude-7480 pulseaudio[70426]: default_sink: bluez_sink.EC_81_93_2A_51_7E.a2dp_sink -> alsa_output.pci-0000_00_1f.3.analog-stereo Apr 26 14:58:53 Latitude-7480 pulseaudio[70426]: The sink input 91 "Firefox" is moving to alsa_output.pci-0000_00_1f.3.analog-stereo, because the old sink became unavailable. Apr 26 14:58:53 Latitude-7480 pulseaudio[70426]: FD error: POLLHUP Apr 26 14:58:53 Latitude-7480 pulseaudio[70426]: Trying to change sample spec Apr 26 14:58:53 Latitude-7480 pulseaudio[70426]: Requested tlength=200,00 ms, minreq=24,99 ms Apr 26 14:58:53 Latitude-7480 pulseaudio[70426]: Trying resume... Apr 26 14:58:53 Latitude-7480 pulseaudio[70426]: Trying to disable ALSA period wakeups, using timers only Apr 26 14:58:53 Latitude-7480 pulseaudio[70426]: ALSA period wakeups disabled Apr 26 14:58:53 Latitude-7480 pulseaudio[70426]: Time scheduling watermark is 20,00ms Apr 26 14:58:53 Latitude-7480 pulseaudio[70426]: Resumed successfully... Apr 26 14:58:53 Latitude-7480 pulseaudio[70426]: Starting playback. Apr 26 14:58:53 Latitude-7480 pulseaudio[70426]: default_source: bluez_sink.EC_81_93_2A_51_7E.a2dp_sink.monitor -> alsa_output.pci-0000_00_1f.3.analog-stereo.monitor Apr 26 14:58:53 Latitude-7480 pulseaudio[70426]: Transport /org/bluez/hci0/dev_EC_81_93_2A_51_7E/sep1/fd19 auto-released by BlueZ or already released Apr 26 14:58:53 Latitude-7480 pulseaudio[70426]: Freeing sink 6 "bluez_sink.EC_81_93_2A_51_7E.a2dp_sink" Apr 26 14:58:53 Latitude-7480 pulseaudio[70426]: Freeing source 6 "bluez_sink.EC_81_93_2A_51_7E.a2dp_sink.monitor" Apr 26 14:58:53 Latitude-7480 pulseaudio[70426]: Unloading "module-bluez5-device" (index: #30). Apr 26 14:58:53 Latitude-7480 pulseaudio[70426]: Freed 5 "bluez_card.EC_81_93_2A_51_7E" Apr 26 14:58:53 Latitude-7480 pulseaudio[70426]: Unloaded "module-bluez5-device" (index: #30). Apr 26 14:58:53 Latitude-7480 pulseaudio[70426]: Storing volume/mute/device for stream sink-input-by-application-name:Firefox.