mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2026-01-05 11:09:11 -05:00
bluetooth: use device flag to prevent assertion failure during shutdown
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/491>
This commit is contained in:
parent
698fb3bc26
commit
c884ae8c74
4 changed files with 5 additions and 9 deletions
|
|
@ -641,7 +641,7 @@ static DBusMessage *profile_new_connection(DBusConnection *conn, DBusMessage *m,
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pa_bluetooth_discovery_get_enable_native_hfp_hf(b->discovery)) {
|
if (d->enable_hfp_hf) {
|
||||||
if (p == PA_BLUETOOTH_PROFILE_HSP_HS && pa_hashmap_get(d->uuids, PA_BLUETOOTH_UUID_HFP_HF)) {
|
if (p == PA_BLUETOOTH_PROFILE_HSP_HS && pa_hashmap_get(d->uuids, PA_BLUETOOTH_UUID_HFP_HF)) {
|
||||||
/* If peer connecting to HSP Audio Gateway supports HFP HF profile
|
/* If peer connecting to HSP Audio Gateway supports HFP HF profile
|
||||||
* reject this connection to force it to connect to HSP Audio Gateway instead.
|
* reject this connection to force it to connect to HSP Audio Gateway instead.
|
||||||
|
|
|
||||||
|
|
@ -195,11 +195,9 @@ static const char *transport_state_to_string(pa_bluetooth_transport_state_t stat
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool device_supports_profile(pa_bluetooth_device *device, pa_bluetooth_profile_t profile) {
|
static bool device_supports_profile(pa_bluetooth_device *device, pa_bluetooth_profile_t profile) {
|
||||||
bool show_hfp, show_hsp, enable_native_hfp_hf;
|
bool show_hfp, show_hsp;
|
||||||
|
|
||||||
enable_native_hfp_hf = pa_bluetooth_discovery_get_enable_native_hfp_hf(device->discovery);
|
if (device->enable_hfp_hf) {
|
||||||
|
|
||||||
if (enable_native_hfp_hf) {
|
|
||||||
show_hfp = pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_HFP_HF);
|
show_hfp = pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_HFP_HF);
|
||||||
show_hsp = !show_hfp;
|
show_hsp = !show_hfp;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -727,6 +725,7 @@ static pa_bluetooth_device* device_create(pa_bluetooth_discovery *y, const char
|
||||||
|
|
||||||
d = pa_xnew0(pa_bluetooth_device, 1);
|
d = pa_xnew0(pa_bluetooth_device, 1);
|
||||||
d->discovery = y;
|
d->discovery = y;
|
||||||
|
d->enable_hfp_hf = pa_bluetooth_discovery_get_enable_native_hfp_hf(y);
|
||||||
d->path = pa_xstrdup(path);
|
d->path = pa_xstrdup(path);
|
||||||
d->uuids = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, pa_xfree);
|
d->uuids = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, pa_xfree);
|
||||||
d->a2dp_sink_endpoints = pa_hashmap_new_full(pa_a2dp_codec_id_hash_func, pa_a2dp_codec_id_compare_func, pa_xfree, (pa_free_cb_t)pa_hashmap_free);
|
d->a2dp_sink_endpoints = pa_hashmap_new_full(pa_a2dp_codec_id_hash_func, pa_a2dp_codec_id_compare_func, pa_xfree, (pa_free_cb_t)pa_hashmap_free);
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,7 @@ struct pa_bluetooth_device {
|
||||||
pa_bluetooth_discovery *discovery;
|
pa_bluetooth_discovery *discovery;
|
||||||
pa_bluetooth_adapter *adapter;
|
pa_bluetooth_adapter *adapter;
|
||||||
|
|
||||||
|
bool enable_hfp_hf;
|
||||||
bool properties_received;
|
bool properties_received;
|
||||||
bool tried_to_link_with_adapter;
|
bool tried_to_link_with_adapter;
|
||||||
bool valid;
|
bool valid;
|
||||||
|
|
|
||||||
|
|
@ -2090,7 +2090,6 @@ static int add_card(struct userdata *u) {
|
||||||
pa_bluetooth_profile_t *p;
|
pa_bluetooth_profile_t *p;
|
||||||
const char *uuid;
|
const char *uuid;
|
||||||
void *state;
|
void *state;
|
||||||
bool enable_native_hfp_hf, has_both;
|
|
||||||
|
|
||||||
pa_assert(u);
|
pa_assert(u);
|
||||||
pa_assert(u->device);
|
pa_assert(u->device);
|
||||||
|
|
@ -2121,9 +2120,6 @@ static int add_card(struct userdata *u) {
|
||||||
|
|
||||||
create_card_ports(u, data.ports);
|
create_card_ports(u, data.ports);
|
||||||
|
|
||||||
enable_native_hfp_hf = pa_bluetooth_discovery_get_enable_native_hfp_hf(u->discovery);
|
|
||||||
|
|
||||||
has_both = enable_native_hfp_hf && pa_hashmap_get(d->uuids, PA_BLUETOOTH_UUID_HFP_HF) && pa_hashmap_get(d->uuids, PA_BLUETOOTH_UUID_HSP_HS);
|
|
||||||
PA_HASHMAP_FOREACH(uuid, d->uuids, state) {
|
PA_HASHMAP_FOREACH(uuid, d->uuids, state) {
|
||||||
pa_bluetooth_profile_t profile;
|
pa_bluetooth_profile_t profile;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue