Ever since I switched to linux I have been encountering various issues
with my Bose QC35 II headset.

I used it extensively on my mac book pro before, here is the behaviour I was 
used to: 
- upon connecting the headset the sound streams where automatically redirected 
to it
- upon starting a visio conference call (meet.google.com on chrome and firefox, 
skype, jitsi, slack) the built-in microphone would activate automatically and I 
don't remember lowered sound quality (as in noone ever told me I sounded like a 
robot even after switching from builtin mike to headset mike).
- upon disconnecting, spotify would pause automatically (which avoids the 
sudden "music blasting off the laptop speaker" when the headset runs out of 
battery :) 

On ubuntu 20.04, after encountering various issues, I am in a state where it's 
**almost** working: 
- for playback on connecting it works just fine
- for visio conferencing, without custom configuration pulseaudio 
systematically prefers the laptop microphone over the BT microphone, I can 
enable it but I have to manually select it in gnome settings, sometimes within 
the app itself. When switching from built-in laptop microphone to headset 
microphone, multiple interlocutors reported I suddenly sounded like a robot.
- upon disconnecting, spotify does not pause automatically, I have learned to 
make sure the laptop speakers are muted before disconnecting or on low battery 
warnings from the headset. I read through a lot of material on pulseaudio 
lately and I think this could be configured though a policy (either by loading 
one that exists or by creating an additional one)


According to 
https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/508522/comments/39, 
with the default configuration, autoswitch shoudl trigger when the calling app 
attempts to record with media.role=phone. 
I haven't been able to make this work on ubuntu 20.04, with
-  snap slack 
-  firefox (jitsi or google meet)
-  chrome (jitsi or google meet), 
-  a dockerized zoom 
(https://github.com/mdouchement/docker-zoom-us/blob/master/scripts/zoom-us-wrapper)
 

now there is the "more aggressive switching behaviour" : when specifying
load-module module-bluetooth-policy auto_switch=2

Using auto_switch=2, almost works \o/

Using chrome :

- Google meet session:  autoswitch does lots of back and forth making my
headset beep dozens of time (which is quite annoying). Sometimes ends up
working sometimes not and I get loads of bluetooth/sound related errors
in journald

janv. 18 11:48:16 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 0
janv. 18 11:48:16 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 0
janv. 18 11:48:16 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 0
janv. 18 11:48:16 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 0
janv. 18 11:48:16 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 0
janv. 18 11:48:16 x1byjean rtkit-daemon[1817]: Supervising 7 threads of 1 
processes of 1 users.
janv. 18 11:48:16 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 294
janv. 18 11:48:16 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 294
janv. 18 11:48:16 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 294
janv. 18 11:48:16 x1byjean rtkit-daemon[1817]: Successfully made thread 773344 
of process 770761 owned by '1000' RT at priority 5.
janv. 18 11:48:16 x1byjean rtkit-daemon[1817]: Supervising 8 threads of 1 
processes of 1 users.
janv. 18 11:48:16 x1byjean gsd-media-keys[6497]: Unable to get default sink
janv. 18 11:48:16 x1byjean gsd-media-keys[6497]: Unable to get default source
janv. 18 11:48:16 x1byjean rtkit-daemon[1817]: Supervising 7 threads of 1 
processes of 1 users.
janv. 18 11:48:16 x1byjean rtkit-daemon[1817]: Successfully made thread 773349 
of process 770761 owned by '1000' RT at priority 5.
janv. 18 11:48:16 x1byjean rtkit-daemon[1817]: Supervising 8 threads of 1 
processes of 1 users.
janv. 18 11:48:16 x1byjean gsd-media-keys[6497]: Unable to get default sink
janv. 18 11:48:16 x1byjean gsd-media-keys[6497]: Unable to get default source
janv. 18 11:48:16 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 0
janv. 18 11:48:16 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 0
janv. 18 11:48:16 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 0
janv. 18 11:48:16 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 0
janv. 18 11:48:16 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 0
janv. 18 11:48:17 x1byjean rtkit-daemon[1817]: Supervising 7 threads of 1 
processes of 1 users.
janv. 18 11:48:17 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 295
janv. 18 11:48:17 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 295
janv. 18 11:48:17 x1byjean rtkit-daemon[1817]: Successfully made thread 773355 
of process 770761 owned by '1000' RT at priority 5.
janv. 18 11:48:17 x1byjean rtkit-daemon[1817]: Supervising 8 threads of 1 
processes of 1 users.
janv. 18 11:48:17 x1byjean gsd-media-keys[6497]: Unable to get default sink
janv. 18 11:48:17 x1byjean gsd-media-keys[6497]: Unable to get default source
janv. 18 11:48:17 x1byjean rtkit-daemon[1817]: Supervising 7 threads of 1 
processes of 1 users.
janv. 18 11:48:17 x1byjean rtkit-daemon[1817]: Warning: Reached burst limit for 
user '1000', denying request.
janv. 18 11:48:17 x1byjean rtkit-daemon[1817]: Supervising 7 threads of 1 
processes of 1 users.
janv. 18 11:48:17 x1byjean rtkit-daemon[1817]: Warning: Reached burst limit for 
user '1000', denying request.
janv. 18 11:48:17 x1byjean rtkit-daemon[1817]: Supervising 7 threads of 1 
processes of 1 users.
janv. 18 11:48:17 x1byjean rtkit-daemon[1817]: Warning: Reached burst limit for 
user '1000', denying request.
janv. 18 11:48:17 x1byjean rtkit-daemon[1817]: Supervising 7 threads of 1 
processes of 1 users.
janv. 18 11:48:17 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 0
janv. 18 11:48:17 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 0
janv. 18 11:48:17 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 0
janv. 18 11:48:17 x1byjean rtkit-daemon[1817]: Warning: Reached burst limit for 
user '1000', denying request.
janv. 18 11:48:17 x1byjean rtkit-daemon[1817]: Supervising 7 threads of 1 
processes of 1 users.
janv. 18 11:48:17 x1byjean rtkit-daemon[1817]: Warning: Reached burst limit for 
user '1000', denying request.

- Trying to open a jitsi meet session in chromium : autoswitching works

- for either of the above sometimes I end up getting the following and nothing 
works anymore, is fixed by a restart of chromium, but I am not entirely sure 
how I reached that state.
janv. 18 12:19:25 x1byjean chromium_chromium.desktop[771776]: 
[771776:771776:0118/121925.571659:ERROR:pulse_util.cc(343)] pa_operation is 
nullptr.
janv. 18 12:19:25 x1byjean chromium_chromium.desktop[771776]: 
[771776:771776:0118/121925.571982:ERROR:pulse_util.cc(343)] pa_operation is 
nullptr.
janv. 18 12:19:25 x1byjean chromium_chromium.desktop[771776]: 
[771776:771776:0118/121925.572887:ERROR:pulse_util.cc(343)] pa_operation is 
nullptr.
janv. 18 12:19:25 x1byjean chromium_chromium.desktop[771776]: 
[771776:771776:0118/121925.573374:ERROR:pulse_util.cc(343)] pa_operation is 
nullptr.
janv. 18 12:19:25 x1byjean chromium_chromium.desktop[771776]: 
[771776:771776:0118/121925.596189:ERROR:pulse_util.cc(343)] pa_operation is 
nullptr.
janv. 18 12:19:25 x1byjean chromium_chromium.desktop[771776]: 
[771776:771776:0118/121925.689268:ERROR:pulse_util.cc(343)] pa_operation is 
nullptr.
janv. 18 12:19:26 x1byjean chromium_chromium.desktop[771776]: 
[771776:771776:0118/121926.022878:ERROR:pulse_util.cc(343)] pa_operation is 
nullptr.
janv. 18 12:19:26 x1byjean chromium_chromium.desktop[771776]: 
[771776:771776:0118/121926.023032:ERROR:pulse_util.cc(343)] pa_operation is 
nullptr.
janv. 18 12:19:26 x1byjean chromium_chromium.desktop[771776]: 
[771776:771776:0118/121926.036085:ERROR:pulse_util.cc(343)] pa_operation is 
nullptr.
janv. 18 12:19:26 x1byjean chromium_chromium.desktop[771776]: 
[771776:771776:0118/121926.036201:ERROR:pulse_util.cc(343)] pa_operation is 
nullptr.


Firefox:
- Trying to open a jitsi meet session in firefox : autoswitch ok  
- Trying to open a google meet session in firefox : autoswitch ok 

rarely fails and is again fixed by a restart of firefox, the following
trace was observed in such a case but may not be the root cause:

janv. 18 12:22:09 x1byjean bluetoothd[1437]: Endpoint unregistered: 
sender=:1.1030 path=/MediaEndpoint/A2DPSink/sbc
janv. 18 12:22:09 x1byjean bluetoothd[1437]: Endpoint unregistered: 
sender=:1.1030 path=/MediaEndpoint/A2DPSource/sbc
janv. 18 12:22:09 x1byjean systemd[3409]: pulseaudio.service: Main process 
exited, code=dumped, status=11/SEGV
janv. 18 12:22:09 x1byjean systemd[3409]: pulseaudio.service: Failed with 
result 'core-dump'.
janv. 18 12:22:10 x1byjean acpid[1433]: input device has been disconnected, fd 
21
janv. 18 12:22:10 x1byjean /usr/lib/gdm3/gdm-x-session[3508]: (II) config/udev: 
removing device LE-Grotte 35ii (AVRCP)
janv. 18 12:22:10 x1byjean /usr/lib/gdm3/gdm-x-session[3508]: (**) Option "fd" 
"125"
janv. 18 12:22:10 x1byjean /usr/lib/gdm3/gdm-x-session[3508]: (II) event20 - 
LE-Grotte 35ii (AVRCP): device removed
janv. 18 12:22:10 x1byjean /usr/lib/gdm3/gdm-x-session[3508]: (II) 
UnloadModule: "libinput"
janv. 18 12:22:10 x1byjean /usr/lib/gdm3/gdm-x-session[3508]: (II) 
systemd-logind: releasing fd for 13:84
janv. 18 12:22:10 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 311
janv. 18 12:22:10 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 311
janv. 18 12:22:10 x1byjean audit[1440]: USER_AVC pid=1440 uid=103 
auid=4294967295 ses=4294967295 msg='apparmor="DENIED" operation="dbus_signal"  
bus="system" path="/org/freedesktop/NetworkManager" 
interface="org.freedesktop.NetworkManager" member="CheckPermissions" 
name=":1.11" mask="receive" pid=778847 label="snap.spotify.spotify" 
peer_pid=1441 peer_label="unconfined"
                                         exe="/usr/bin/dbus-daemon" sauid=103 
hostname=? addr=? terminal=?'
janv. 18 12:22:10 x1byjean kernel: audit: type=1107 audit(1610968930.039:2566): 
pid=1440 uid=103 auid=4294967295 ses=4294967295 msg='apparmor="DENIED" 
operation="dbus_signal"  bus="system" path="/org/freedesktop/NetworkManager" 
interface="org.freedesktop.NetworkManager" member="CheckPermissions" 
name=":1.11" mask="receive" pid=778847 label="snap.spotify.spotify" 
peer_pid=1441 peer_label="unconfined"
                                    exe="/usr/bin/dbus-daemon" sauid=103 
hostname=? addr=? terminal=?'
janv. 18 12:22:10 x1byjean systemd[3409]: pulseaudio.service: Scheduled restart 
job, restart counter is at 3.
janv. 18 12:22:10 x1byjean systemd[3409]: Stopped target GNOME Sound sample 
caching handling.
janv. 18 12:22:10 x1byjean systemd[3409]: Stopping GNOME Sound sample caching 
handling.
janv. 18 12:22:10 x1byjean systemd[3409]: Stopping GNOME Sound sample caching 
handling...
janv. 18 12:22:10 x1byjean systemd[3409]: Stopped Sound Service.
janv. 18 12:22:10 x1byjean systemd[3409]: Starting Sound Service...
janv. 18 12:22:10 x1byjean systemd[3409]: gsd-sound.service: Succeeded.
janv. 18 12:22:10 x1byjean systemd[3409]: Stopped GNOME Sound sample caching 
handling.
janv. 18 12:22:10 x1byjean systemd[3409]: Starting GNOME Sound sample caching 
handling...
janv. 18 12:22:10 x1byjean systemd[3409]: Started GNOME Sound sample caching 
handling.
janv. 18 12:22:10 x1byjean rtkit-daemon[1817]: Successfully made thread 783377 
of process 783377 owned by '1000' high priority at nice level -11.
janv. 18 12:22:10 x1byjean rtkit-daemon[1817]: Supervising 3 threads of 3 
processes of 1 users.
janv. 18 12:22:10 x1byjean pulseaudio[783377]: Stale PID file, overwriting.
janv. 18 12:22:10 x1byjean rtkit-daemon[1817]: Supervising 3 threads of 3 
processes of 1 users.
janv. 18 12:22:10 x1byjean rtkit-daemon[1817]: Successfully made thread 783383 
of process 783377 owned by '1000' RT at priority 5.


- trying to open a zoom meeting from the zoom client triggers "some" of the 
above but consistently succeeds without making my headset beep more than once 
(I think it beeps on profile change)
janv. 18 12:18:24 x1byjean rtkit-daemon[1817]: Supervising 7 threads of 1 
processes of 1 users.
janv. 18 12:18:24 x1byjean rtkit-daemon[1817]: Successfully made thread 782336 
of process 778168 owned by '1000' RT at priority 5.
janv. 18 12:18:24 x1byjean rtkit-daemon[1817]: Supervising 8 threads of 1 
processes of 1 users.
janv. 18 12:18:24 x1byjean gsd-media-keys[6497]: Unable to get default sink
janv. 18 12:18:24 x1byjean gsd-media-keys[6497]: Unable to get default source
janv. 18 12:18:24 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 0
janv. 18 12:18:24 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 0
janv. 18 12:18:24 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 0
janv. 18 12:18:24 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 0
janv. 18 12:18:24 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 0
janv. 18 12:18:24 x1byjean gnome-shell[4339]: Window manager warning: Invalid 
WM_TRANSIENT_FOR window 0x3a00007 specified for 0x3a003cc.
janv. 18 12:18:24 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 307
janv. 18 12:18:24 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 307
janv. 18 12:18:24 x1byjean rtkit-daemon[1817]: Supervising 7 threads of 1 
processes of 1 users.
janv. 18 12:18:24 x1byjean rtkit-daemon[1817]: Successfully made thread 782338 
of process 778168 owned by '1000' RT at priority 5.
janv. 18 12:18:24 x1byjean rtkit-daemon[1817]: Supervising 8 threads of 1 
processes of 1 users.
janv. 18 12:18:24 x1byjean gsd-media-keys[6497]: Unable to get default sink
janv. 18 12:18:24 x1byjean gsd-media-keys[6497]: Unable to get default source
janv. 18 12:18:24 x1byjean rtkit-daemon[1817]: Supervising 7 threads of 1 
processes of 1 users.
janv. 18 12:18:24 x1byjean rtkit-daemon[1817]: Successfully made thread 782345 
of process 778168 owned by '1000' RT at priority 5.
janv. 18 12:18:24 x1byjean rtkit-daemon[1817]: Supervising 8 threads of 1 
processes of 1 users.
janv. 18 12:18:24 x1byjean gsd-media-keys[6497]: Unable to get default sink
janv. 18 12:18:24 x1byjean gsd-media-keys[6497]: Unable to get default source
janv. 18 12:18:24 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 0
janv. 18 12:18:24 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 0
janv. 18 12:18:24 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 0
janv. 18 12:18:24 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 0
janv. 18 12:18:24 x1byjean rtkit-daemon[1817]: Supervising 7 threads of 1 
processes of 1 users.
janv. 18 12:18:24 x1byjean rtkit-daemon[1817]: Successfully made thread 782351 
of process 778168 owned by '1000' RT at priority 5.
janv. 18 12:18:24 x1byjean rtkit-daemon[1817]: Supervising 8 threads of 1 
processes of 1 users.
janv. 18 12:18:24 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 308
janv. 18 12:18:24 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 308
janv. 18 12:18:24 x1byjean gsd-media-keys[6497]: Unable to get default sink
janv. 18 12:18:24 x1byjean gsd-media-keys[6497]: Unable to get default source
janv. 18 12:18:24 x1byjean rtkit-daemon[1817]: Supervising 7 threads of 1 
processes of 1 users.
janv. 18 12:18:24 x1byjean rtkit-daemon[1817]: Successfully made thread 782352 
of process 778168 owned by '1000' RT at priority 5.
janv. 18 12:18:24 x1byjean rtkit-daemon[1817]: Supervising 8 threads of 1 
processes of 1 users.
janv. 18 12:18:24 x1byjean gsd-media-keys[6497]: Unable to get default sink
janv. 18 12:18:24 x1byjean gsd-media-keys[6497]: Unable to get default source
janv. 18 12:18:24 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 0
janv. 18 12:18:24 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 0
janv. 18 12:18:24 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 0
janv. 18 12:18:24 x1byjean kernel: Bluetooth: hci0: SCO packet for unknown 
connection handle 0

I haven't been able to test a slack call with the new settings yet.

Among my tests I ended up having to restat spotify and (chrome or
firefox) a couple time because they could no longer access the sound
devices. I always left spotify open in the background paused and after a
test call I tried to resume the spotify playback and while the time was
advancing, I didn't have any output on the headset.


About the sonding like a robot part : 
>From what I read so far the HSP/HPF profile currently uses the CVSD codec 
>which in turn uses an 8-bit sampling rate. 
This is a pretty extreme compromise between bandwidth and sound quality (in 
favor of bandwidth). IIUC this is what makes me "sound like a robot".
When using the same visio apps (slack, google meet, jitsi meet, etc) with the 
laptop's built in microphone people report a much much better sound quality, 
unfortunately that also picks up keystrokes and mouse clics which is failry 
annoying/distracting for my interlocutors when I do presentations (product 
demonstration or live coding). I wonder if it would be possible to use a 
different codec/sampling rate (through configuration) or ideally an app driven 
sampling rate, this way the app could optimize the bandwidth/sound quality 
based on actual network conditions ...

Let me know if you need more diagnostic information (I might need some
help on how to collect them)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/508522

Title:
  Add automatic switching to HSP/HFP from A2DP when a mic is needed

To manage notifications about this bug go to:
https://bugs.launchpad.net/pulseaudio/+bug/508522/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to