bluez5: fix behavior on HSP/HFP backends with no codec switching

Fix HSP/HFP profile not showing correctly when using hsphfpd/ofono
backends, which don't support codec switching and have no HFP codec
profiles.
This commit is contained in:
Pauli Virtanen 2021-09-19 16:31:08 +03:00 committed by Wim Taymans
parent 90b4efd98d
commit def45adaec

View file

@ -681,6 +681,9 @@ static int emit_nodes(struct impl *this)
}
}
}
if (get_supported_a2dp_codec(this, this->props.codec) == NULL)
this->props.codec = 0;
break;
case DEVICE_PROFILE_HSP_HFP:
if (this->bt_dev->connected_profiles & SPA_BT_PROFILE_HEADSET_HEAD_UNIT) {
@ -696,6 +699,9 @@ static int emit_nodes(struct impl *this)
emit_node(this, t, DEVICE_ID_SINK, SPA_NAME_API_BLUEZ5_SCO_SINK, false);
}
}
if (spa_bt_device_supports_hfp_codec(this->bt_dev, get_hfp_codec(this->props.codec)) != 1)
this->props.codec = 0;
break;
default:
return -EINVAL;