From 8eb1f5aa3570d2962dd2815d440f9c7381ea6da3 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Mon, 22 Jan 2024 22:36:43 +0200 Subject: [PATCH] bluez5: pick right codec when multiple ones share the endpoint The "default" codec is the one with fill_caps != NULL, and should be picked if we don't know which one we are using. Fixes showing AAC-ELD as supported when it's not, which happened because it's ordered before the default AAC in the codec list unlike the other "shared endpoint" codecs. --- spa/plugins/bluez5/bluez5-dbus.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spa/plugins/bluez5/bluez5-dbus.c b/spa/plugins/bluez5/bluez5-dbus.c index 7f0cbb937..84a5fd7ef 100644 --- a/spa/plugins/bluez5/bluez5-dbus.c +++ b/spa/plugins/bluez5/bluez5-dbus.c @@ -457,6 +457,8 @@ static const struct media_codec *media_endpoint_to_codec(struct spa_bt_monitor * const char *codec_ep_name = codec->endpoint_name ? codec->endpoint_name : codec->name; + if (!preferred && !codec->fill_caps) + continue; if (!spa_streq(ep_name, codec_ep_name)) continue; if ((*sink && !codec->decode) || (!*sink && !codec->encode))