From 3f0e843bc862b5bce28b768da82d440c2f0c357a Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Thu, 28 Jan 2021 22:25:19 +0100 Subject: [PATCH] bluetooth: Mark profile available when the peer supports it --- src/modules/bluetooth/module-bluez5-device.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c index 0fb3a8b3d..430574429 100644 --- a/src/modules/bluetooth/module-bluez5-device.c +++ b/src/modules/bluetooth/module-bluez5-device.c @@ -2074,10 +2074,7 @@ static pa_card_profile *create_card_profile(struct userdata *u, pa_bluetooth_pro *p = profile; - if (u->device->transports[*p]) - cp->available = transport_state_to_availability(u->device->transports[*p]->state); - else - cp->available = PA_AVAILABLE_NO; + cp->available = pa_bluetooth_device_supports_profile(u->device, profile) ? PA_AVAILABLE_YES : PA_AVAILABLE_NO; return cp; } @@ -2277,13 +2274,8 @@ static void handle_transport_state_change(struct userdata *u, struct pa_bluetoot pa_assert(t); pa_assert_se(cp = pa_hashmap_get(u->card->profiles, pa_bluetooth_profile_to_string(t->profile))); + // TODO: Makes no sense to check this anymore, but maybe that breaks the boolean? oldavail = cp->available; - /* - * If codec switching is in progress, transport state change should not - * make profile unavailable. - */ - if (!t->device->codec_switching_in_progress) - pa_card_profile_set_available(cp, transport_state_to_availability(t->state)); /* Update port availability */ pa_assert_se(port = pa_hashmap_get(u->card->ports, u->output_port_name));