pulseaudio/0009-bluetooth-use-device-flag-to-prevent-assertion-failu.patch
Takashi Iwai 37ac29471d Accepting request 877714 from home:tiwai:branches:multimedia:libs
- Upstream fixes for supporting HFP in native backend (bsc#1167940):
  0001-bluetooth-use-consistent-profile-names.patch
  0002-bluetooth-separate-HSP-and-HFP.patch
  0003-bluetooth-add-correct-HFP-rfcomm-negotiation.patch
  0004-bluetooth-make-native-the-default-backend.patch
  0005-bluetooth-enable-module-bluez5-discover-argument-ena.patch
  0006-bluetooth-fix-headset-auto-ofono-handover.patch
  0007-bluetooth-prefer-headset-HFP-HF-connection-with-nati.patch
  0008-bluetooth-complete-bluetooth-profile-separation.patch
  0009-bluetooth-use-device-flag-to-prevent-assertion-failu.patch
  0010-bluetooth-rename-enable_hs_role-to-enable_shared_pro.patch
  0011-bluetooth-clean-up-rfcomm_write-usage.patch

OBS-URL: https://build.opensuse.org/request/show/877714
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/pulseaudio?expand=0&rev=234
2021-03-08 12:50:38 +00:00

80 lines
3.2 KiB
Diff

From c884ae8c7453c038d7359758e81dbaf3499a2368 Mon Sep 17 00:00:00 2001
From: "Igor V. Kovalenko" <igor.v.kovalenko@gmail.com>
Date: Mon, 1 Feb 2021 20:51:18 +0300
Subject: [PATCH 09/11] bluetooth: use device flag to prevent assertion failure
during shutdown
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/491>
---
src/modules/bluetooth/backend-native.c | 2 +-
src/modules/bluetooth/bluez5-util.c | 7 +++----
src/modules/bluetooth/bluez5-util.h | 1 +
src/modules/bluetooth/module-bluez5-device.c | 4 ----
4 files changed, 5 insertions(+), 9 deletions(-)
--- a/src/modules/bluetooth/backend-native.c
+++ b/src/modules/bluetooth/backend-native.c
@@ -645,7 +645,7 @@ static DBusMessage *profile_new_connecti
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 peer connecting to HSP Audio Gateway supports HFP HF profile
* reject this connection to force it to connect to HSP Audio Gateway instead.
--- a/src/modules/bluetooth/bluez5-util.c
+++ b/src/modules/bluetooth/bluez5-util.c
@@ -175,11 +175,9 @@ static const char *transport_state_to_st
}
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 (enable_native_hfp_hf) {
+ if (device->enable_hfp_hf) {
show_hfp = pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_HFP_HF);
show_hsp = !show_hfp;
} else {
@@ -537,6 +535,7 @@ static pa_bluetooth_device* device_creat
d = pa_xnew0(pa_bluetooth_device, 1);
d->discovery = y;
+ d->enable_hfp_hf = pa_bluetooth_discovery_get_enable_native_hfp_hf(y);
d->path = pa_xstrdup(path);
d->uuids = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, pa_xfree);
--- a/src/modules/bluetooth/bluez5-util.h
+++ b/src/modules/bluetooth/bluez5-util.h
@@ -107,6 +107,7 @@ struct pa_bluetooth_device {
pa_bluetooth_discovery *discovery;
pa_bluetooth_adapter *adapter;
+ bool enable_hfp_hf;
bool properties_received;
bool tried_to_link_with_adapter;
bool valid;
--- a/src/modules/bluetooth/module-bluez5-device.c
+++ b/src/modules/bluetooth/module-bluez5-device.c
@@ -2059,7 +2059,6 @@ static int add_card(struct userdata *u)
pa_bluetooth_profile_t *p;
const char *uuid;
void *state;
- bool enable_native_hfp_hf, has_both;
pa_assert(u);
pa_assert(u->device);
@@ -2090,9 +2089,6 @@ static int add_card(struct userdata *u)
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_bluetooth_profile_t profile;