bluetooth: set better priorities for profiles
authorTanu Kaskinen <tanuk@iki.fi>
Sun, 15 Oct 2017 10:29:42 +0000 (13:29 +0300)
committerTanu Kaskinen <tanuk@iki.fi>
Thu, 19 Oct 2017 20:03:02 +0000 (23:03 +0300)
Since HSP had higher priority than A2DP, the default profile when
connecting a new headset was HSP. To me it makes more sense to default
to high-quality output. We already have some automatic policies to
switch to HSP when it's needed.

I also made the A2DP source and HSP/HFP gateway profiles have lower
priority than the A2DP sink and HSP headset profiles. The A2DP source
and HSP/HFP gateway profiles should only be activated if the remote
device initiates audio streaming, so it makes sense to have lower
priority for those profiles.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=103058
src/modules/bluetooth/module-bluez5-device.c

index 8a90639..fb99147 100644 (file)
@@ -1861,7 +1861,7 @@ static pa_card_profile *create_card_profile(struct userdata *u, pa_bluetooth_pro
     switch (profile) {
     case PA_BLUETOOTH_PROFILE_A2DP_SINK:
         cp = pa_card_profile_new(name, _("High Fidelity Playback (A2DP Sink)"), sizeof(pa_bluetooth_profile_t));
-        cp->priority = 10;
+        cp->priority = 40;
         cp->n_sinks = 1;
         cp->n_sources = 0;
         cp->max_sink_channels = 2;
@@ -1873,7 +1873,7 @@ static pa_card_profile *create_card_profile(struct userdata *u, pa_bluetooth_pro
 
     case PA_BLUETOOTH_PROFILE_A2DP_SOURCE:
         cp = pa_card_profile_new(name, _("High Fidelity Capture (A2DP Source)"), sizeof(pa_bluetooth_profile_t));
-        cp->priority = 10;
+        cp->priority = 20;
         cp->n_sinks = 0;
         cp->n_sources = 1;
         cp->max_sink_channels = 0;
@@ -1885,7 +1885,7 @@ static pa_card_profile *create_card_profile(struct userdata *u, pa_bluetooth_pro
 
     case PA_BLUETOOTH_PROFILE_HEADSET_HEAD_UNIT:
         cp = pa_card_profile_new(name, _("Headset Head Unit (HSP/HFP)"), sizeof(pa_bluetooth_profile_t));
-        cp->priority = 20;
+        cp->priority = 30;
         cp->n_sinks = 1;
         cp->n_sources = 1;
         cp->max_sink_channels = 1;
@@ -1898,7 +1898,7 @@ static pa_card_profile *create_card_profile(struct userdata *u, pa_bluetooth_pro
 
     case PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY:
         cp = pa_card_profile_new(name, _("Headset Audio Gateway (HSP/HFP)"), sizeof(pa_bluetooth_profile_t));
-        cp->priority = 20;
+        cp->priority = 10;
         cp->n_sinks = 1;
         cp->n_sources = 1;
         cp->max_sink_channels = 1;