mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
bluez5: fix HSP HS profile enumeration
HSP don't supports codec switching.
This commit is contained in:
parent
30e4e56852
commit
01f2c91b89
1 changed files with 12 additions and 6 deletions
|
|
@ -532,6 +532,9 @@ static int emit_nodes(struct impl *this)
|
||||||
if (!t)
|
if (!t)
|
||||||
t = find_transport(this, SPA_BT_PROFILE_HSP_AG, 0);
|
t = find_transport(this, SPA_BT_PROFILE_HSP_AG, 0);
|
||||||
if (t) {
|
if (t) {
|
||||||
|
if (t->profile == SPA_BT_PROFILE_HSP_AG)
|
||||||
|
this->props.codec = 0;
|
||||||
|
else
|
||||||
this->props.codec = get_hfp_codec_id(t->codec);
|
this->props.codec = get_hfp_codec_id(t->codec);
|
||||||
emit_dynamic_node(&this->dyn_sco_source, this, t,
|
emit_dynamic_node(&this->dyn_sco_source, this, t,
|
||||||
0, SPA_NAME_API_BLUEZ5_SCO_SOURCE);
|
0, SPA_NAME_API_BLUEZ5_SCO_SOURCE);
|
||||||
|
|
@ -572,6 +575,9 @@ static int emit_nodes(struct impl *this)
|
||||||
if (!t)
|
if (!t)
|
||||||
t = find_transport(this, SPA_BT_PROFILE_HSP_HS, 0);
|
t = find_transport(this, SPA_BT_PROFILE_HSP_HS, 0);
|
||||||
if (t) {
|
if (t) {
|
||||||
|
if (t->profile == SPA_BT_PROFILE_HSP_HS)
|
||||||
|
this->props.codec = 0;
|
||||||
|
else
|
||||||
this->props.codec = get_hfp_codec_id(t->codec);
|
this->props.codec = get_hfp_codec_id(t->codec);
|
||||||
emit_node(this, t, DEVICE_ID_SOURCE, SPA_NAME_API_BLUEZ5_SCO_SOURCE);
|
emit_node(this, t, DEVICE_ID_SOURCE, SPA_NAME_API_BLUEZ5_SCO_SOURCE);
|
||||||
emit_node(this, t, DEVICE_ID_SINK, SPA_NAME_API_BLUEZ5_SCO_SINK);
|
emit_node(this, t, DEVICE_ID_SINK, SPA_NAME_API_BLUEZ5_SCO_SINK);
|
||||||
|
|
@ -770,7 +776,7 @@ static void profiles_changed(void *userdata, uint32_t prev_profiles, uint32_t pr
|
||||||
nodes_changed);
|
nodes_changed);
|
||||||
break;
|
break;
|
||||||
case DEVICE_PROFILE_HSP_HFP:
|
case DEVICE_PROFILE_HSP_HFP:
|
||||||
if (spa_bt_device_supports_hfp_codec(this->bt_dev, get_hfp_codec(this->props.codec)) == 0)
|
if (spa_bt_device_supports_hfp_codec(this->bt_dev, get_hfp_codec(this->props.codec)) != 1)
|
||||||
this->props.codec = 0;
|
this->props.codec = 0;
|
||||||
nodes_changed = (connected_change & SPA_BT_PROFILE_HEADSET_HEAD_UNIT);
|
nodes_changed = (connected_change & SPA_BT_PROFILE_HEADSET_HEAD_UNIT);
|
||||||
spa_log_debug(this->log, NAME": profiles changed: HSP/HFP nodes changed: %d",
|
spa_log_debug(this->log, NAME": profiles changed: HSP/HFP nodes changed: %d",
|
||||||
|
|
@ -1024,7 +1030,7 @@ static struct spa_pod *build_profile(struct impl *this, struct spa_pod_builder *
|
||||||
if (codec) {
|
if (codec) {
|
||||||
const struct a2dp_codec *a2dp_codec = get_supported_a2dp_codec(this, codec);
|
const struct a2dp_codec *a2dp_codec = get_supported_a2dp_codec(this, codec);
|
||||||
if (a2dp_codec == NULL) {
|
if (a2dp_codec == NULL) {
|
||||||
errno = -EINVAL;
|
errno = EINVAL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
name_and_codec = spa_aprintf("%s-%s", name, a2dp_codec->name);
|
name_and_codec = spa_aprintf("%s-%s", name, a2dp_codec->name);
|
||||||
|
|
@ -1059,10 +1065,10 @@ static struct spa_pod *build_profile(struct impl *this, struct spa_pod_builder *
|
||||||
if (codec) {
|
if (codec) {
|
||||||
bool codec_ok = !(profile & SPA_BT_PROFILE_HEADSET_AUDIO_GATEWAY);
|
bool codec_ok = !(profile & SPA_BT_PROFILE_HEADSET_AUDIO_GATEWAY);
|
||||||
unsigned int hfp_codec = get_hfp_codec(codec);
|
unsigned int hfp_codec = get_hfp_codec(codec);
|
||||||
if (spa_bt_device_supports_hfp_codec(this->bt_dev, hfp_codec) == 0)
|
if (spa_bt_device_supports_hfp_codec(this->bt_dev, hfp_codec) != 1)
|
||||||
codec_ok = false;
|
codec_ok = false;
|
||||||
if (!codec_ok) {
|
if (!codec_ok) {
|
||||||
errno = -EINVAL;
|
errno = EINVAL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
name_and_codec = spa_aprintf("%s-%s", name, get_hfp_codec_name(hfp_codec));
|
name_and_codec = spa_aprintf("%s-%s", name, get_hfp_codec_name(hfp_codec));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue