Switching BT profiles in gnome-control-center does not work properly
Switching Bluetooth profiles in gnome-control-center (g-c-c) does not work properly.
Repro: open g-c-c, and use it to switch from A2DP to HFP (hsphfpd backend), and back again to A2DP. One of the following appears to happen: (1) The playback sink disappears, (2) Sink does not disappear, but in audio test in g-c-c there's no sound, (3) Sink does not disappear, but starting audio test in g-c-c hangs g-c-c.
Some logs with PIPEWIRE_DEBUG=3 (at b2b45abe, but I bumped up some BT events to info log level pvir/pipewire@7c8ffca0): pw-1.log, pw-ms-1.log (media-session run separately in valgrind, which shows some errors)
pipewire-media-session also crashed once --- however, it does not always crash:
(gdb) bt #0 0x0000000000428a42 in spa_list_insert (list=0xcb6df0, elem=0xc2eaf0) at ../spa/include/spa/utils/list.h:51 #1 0x000000000042b32b in node_init (object=0xc2e9c8) at ../src/examples/media-session/media-session.c:612 #2 0x000000000042cbdb in init_object (impl=0x7fff2ad1be00, info=0x486940 <node_info>, proxy=0x0, handle=0xc2e950, id=4294967295, props=0x7ed0a0) at ../src/examples/media-session/media-session.c:1150 #3 0x000000000042cce8 in create_object (impl=0x7fff2ad1be00, proxy=0x0, handle=0xc2e950, props=0x7ed0a0) at ../src/examples/media-session/media-session.c:1177 #4 0x000000000042dd68 in sm_media_session_export_node (sess=0x7fff2ad1be00, props=0x7ed0a0, object=0x88a020) at ../src/examples/media-session/media-session.c:1444 #5 0x0000000000415974 in bluez5_create_node (device=0x87ae50, id=0, info=0x7fff2ad1b710) at ../src/examples/media-session/bluez-monitor.c:178 #6 0x0000000000415b62 in bluez5_device_object_info (data=0x87ae50, id=0, info=0x7fff2ad1b710) at ../src/examples/media-session/bluez-monitor.c:225 #7 0x00007f31db1a4771 in emit_node (this=0x818f28, t=0x819940, id=0, factory_name=0x7f31db1c6e93 "api.bluez5.a2dp.sink") at ../spa/plugins/bluez5/bluez5-device.c:99 #8 0x00007f31db1a490d in emit_nodes (this=0x818f28) at ../spa/plugins/bluez5/bluez5-device.c:133 #9 0x00007f31db1a4ac8 in set_profile (this=0x818f28, profile=1) at ../spa/plugins/bluez5/bluez5-device.c:172 #10 0x00007f31db1a56ae in impl_set_param (object=0x818f28, id=9, flags=0, param=0x654248) at ../spa/plugins/bluez5/bluez5-device.c:393 #11 0x00007f31dbc3f9ea in device_demarshal_set_param (object=0x87b0e0, msg=0x64b130) at ../src/modules/module-client-device/protocol-native.c:188 #12 0x00007f31db3bde1c in process_remote (impl=0x64a030) at ../src/modules/module-protocol-native.c:762 #13 0x00007f31db3bdfdc in on_remote_data (data=0x64a030, fd=21, mask=1) at ../src/modules/module-protocol-native.c:795 #14 0x00007f31dc4536e6 in source_io_func (source=0x65c390) at ../spa/plugins/support/loop.c:320 #15 0x00007f31dc453667 in loop_iterate (object=0x621fb8, timeout=-1) at ../spa/plugins/support/loop.c:308 #16 0x00007f31dc4dc89b in pw_main_loop_run (loop=0x621e90) at ../src/pipewire/main-loop.c:158 #17 0x00000000004312bc in main (argc=1, argv=0x7fff2ad1d158) at ../src/examples/media-session/media-session.c:2373
at the same time also bluetoothd crashed (backtrace same as in #534 (closed)). This may be a separate issue that something else in the BT stack seems to be buggy for me vs profile switching, as bluetoothd sometimes crashes, and dmesg with this adapter (BCM20702A1) sometimes says "Bluetooth: hci0: link tx timeout", "Bluetooth: hci0: killing stalled connection XX:XX:XX:XX:XX:XX" recovering from which requires unplugging the BCM20702A1 BT dongle.