bluez5: fix spa_bt_device_supports_media_codec() for HFP codecs

HFP codecs don't have a direction dependent "target" profile, and this
function was returning false if A2DP is disabled.

Don't check target profile for HFP, leave checks to backend.

Fixes HFP-only configurations, which were missing profiles.
This commit is contained in:
Pauli Virtanen 2026-03-09 20:39:44 +02:00
parent 2548fcad25
commit 75c3d3ecf8

View file

@ -2777,16 +2777,18 @@ bool spa_bt_device_supports_media_codec(struct spa_bt_device *device, const stru
bool is_bap = codec->kind == MEDIA_CODEC_BAP;
size_t i;
codec_target_profile = get_codec_target_profile(monitor, codec);
if (!codec_target_profile)
return false;
if (codec->kind == MEDIA_CODEC_HFP) {
if (!(profile & SPA_BT_PROFILE_HEADSET_AUDIO))
return false;
if (!is_media_codec_enabled(monitor, codec))
return false;
return spa_bt_backend_supports_codec(monitor->backend, device, codec->codec_id) == 1;
}
codec_target_profile = get_codec_target_profile(monitor, codec);
if (!codec_target_profile)
return false;
if (!device->adapter->a2dp_application_registered && is_a2dp) {
/* Codec switching not supported: only plain SBC allowed */
return (codec->codec_id == A2DP_CODEC_SBC && spa_streq(codec->name, "sbc") &&