From 4b408e2978f04cc1f22c7edf0473d3a3ec1a1b0b Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Tue, 17 Jan 2023 20:14:10 +0200 Subject: [PATCH] bluez5: fix reported BAP profile index --- spa/plugins/bluez5/bluez5-device.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/spa/plugins/bluez5/bluez5-device.c b/spa/plugins/bluez5/bluez5-device.c index 558cff2be..9571c0674 100644 --- a/spa/plugins/bluez5/bluez5-device.c +++ b/spa/plugins/bluez5/bluez5-device.c @@ -1150,13 +1150,20 @@ static uint32_t get_index_from_profile(struct impl *this, uint32_t profile, enum if (profile == DEVICE_PROFILE_OFF || profile == DEVICE_PROFILE_AG) return profile; - if (profile == DEVICE_PROFILE_A2DP || profile == DEVICE_PROFILE_BAP) { + if (profile == DEVICE_PROFILE_A2DP) { if (codec == 0 || (this->bt_dev->connected_profiles & SPA_BT_PROFILE_MEDIA_SOURCE)) return profile; return codec + DEVICE_PROFILE_LAST; } + if (profile == DEVICE_PROFILE_BAP) { + if (codec == 0) + return profile; + + return codec + DEVICE_PROFILE_LAST; + } + if (profile == DEVICE_PROFILE_HSP_HFP) { if (codec == 0 || (this->bt_dev->connected_profiles & SPA_BT_PROFILE_HFP_AG)) return profile;