bluetooth: prioritize native backend HFP HF connection
authorIgor V. Kovalenko <igor.v.kovalenko@gmail.com>
Sat, 3 Apr 2021 05:10:46 +0000 (08:10 +0300)
committerIgor V. Kovalenko <igor.v.kovalenko@gmail.com>
Sat, 3 Apr 2021 05:48:06 +0000 (08:48 +0300)
Bluez prepends newly registered profile to a list of supported profiles,
and new peer profile connections are attempted in reverse order of profile
registration.

Currently native backend would register HFP AG profile before HSP AG profile.
When peer supports both HFP HF and HSP HS profiles, this registration order
causes extra HSP HS connection attempt before native backend would reject it
to make sure peer is reconnected with HFP HF profile.

Reorder HSP AG profile registration before HFP AG to make sure peer supporting
both profiles connects with HFP HF profile first.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/534>

src/modules/bluetooth/backend-native.c

index 90116bb..d866f4b 100644 (file)
@@ -914,11 +914,11 @@ pa_bluetooth_backend *pa_bluetooth_native_backend_new(pa_core *c, pa_bluetooth_d
     backend->enable_shared_profiles = enable_shared_profiles;
     backend->enable_hfp_hf = pa_bluetooth_discovery_get_enable_native_hfp_hf(y);
 
+    profile_init(backend, PA_BLUETOOTH_PROFILE_HSP_HS);
+
     if (backend->enable_shared_profiles)
         native_backend_apply_profile_registration_change(backend, true);
 
-    profile_init(backend, PA_BLUETOOTH_PROFILE_HSP_HS);
-
     return backend;
 }