Update version to 0.3.44

This commit is contained in:
Wim Taymans 2022-01-27 11:01:51 +01:00
parent ef09924546
commit 33fb92e6ff
10 changed files with 9 additions and 422 deletions

1
.gitignore vendored
View File

@ -64,3 +64,4 @@
/pipewire-0.3.41.tar.gz
/pipewire-0.3.42.tar.gz
/pipewire-0.3.43.tar.gz
/pipewire-0.3.44.tar.gz

View File

@ -1,57 +0,0 @@
From 070ec05984e23bc68e737683e6e707b537606683 Mon Sep 17 00:00:00 2001
From: Pauli Virtanen <pav@iki.fi>
Date: Mon, 17 Jan 2022 19:10:14 +0200
Subject: [PATCH] bluez5: don't create device if adapter is missing
BlueZ may be missing adapter information for devices in some cases.
Ignore devices without specified adapter.
---
spa/plugins/bluez5/bluez5-dbus.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/spa/plugins/bluez5/bluez5-dbus.c b/spa/plugins/bluez5/bluez5-dbus.c
index 32d540bf1..85ababc0d 100644
--- a/spa/plugins/bluez5/bluez5-dbus.c
+++ b/spa/plugins/bluez5/bluez5-dbus.c
@@ -1455,6 +1455,15 @@ static int device_update_props(struct spa_bt_device *device,
return 0;
}
+static bool device_props_ready(struct spa_bt_device *device)
+{
+ /*
+ * In some cases, BlueZ device props may be missing part of
+ * the information required when the interface first appears.
+ */
+ return device->adapter && device->address;
+}
+
bool spa_bt_device_supports_a2dp_codec(struct spa_bt_device *device, const struct a2dp_codec *codec)
{
struct spa_bt_monitor *monitor = device->monitor;
@@ -3607,6 +3616,9 @@ static void interface_added(struct spa_bt_monitor *monitor,
device_update_props(d, props_iter, NULL);
d->reconnect_state = BT_DEVICE_RECONNECT_INIT;
+ if (!device_props_ready(d))
+ return;
+
device_update_hw_volume_profiles(d);
/* Trigger bluez device creation before bluez profile negotiation started so that
@@ -3963,6 +3975,12 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
spa_log_debug(monitor->log, "Properties changed in device %s", path);
device_update_props(d, &it[1], NULL);
+
+ if (!device_props_ready(d))
+ goto finish;
+
+ device_update_hw_volume_profiles(d);
+
spa_bt_device_add_profile(d, SPA_BT_PROFILE_NULL);
}
else if (spa_streq(iface, BLUEZ_MEDIA_ENDPOINT_INTERFACE)) {
--
2.31.1

View File

@ -1,106 +0,0 @@
From 58d2594362d5f7e2fff63679e5aac477cb380654 Mon Sep 17 00:00:00 2001
From: Pauli Virtanen <pav@iki.fi>
Date: Wed, 19 Jan 2022 19:05:37 +0200
Subject: [PATCH 1/4] bluez5: require adapter before profile connect & after
All exposed bluez devices should have an adapter specified at all times.
Adapter-less devices appear in some race conditions in BlueZ interface.
Require device has non-null adapter, in all cases before adding any
profiles (which exposes the device), and reject BlueZ profile connection
attempts in that state.
If an adapter gets removed by BlueZ, remove also all its devices, so
that device->adapter pointers stay valid.
---
spa/plugins/bluez5/backend-hsphfpd.c | 2 +-
spa/plugins/bluez5/backend-native.c | 4 ++--
spa/plugins/bluez5/backend-ofono.c | 2 +-
spa/plugins/bluez5/bluez5-dbus.c | 11 ++++++++++-
4 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/spa/plugins/bluez5/backend-hsphfpd.c b/spa/plugins/bluez5/backend-hsphfpd.c
index bd5f7507e..93f512d01 100644
--- a/spa/plugins/bluez5/backend-hsphfpd.c
+++ b/spa/plugins/bluez5/backend-hsphfpd.c
@@ -1088,7 +1088,7 @@ static DBusHandlerResult hsphfpd_parse_endpoint_properties(struct impl *backend,
}
d = spa_bt_device_find_by_address(backend->monitor, endpoint->remote_address, endpoint->local_address);
- if (!d) {
+ if (!d || !d->adapter) {
spa_log_debug(backend->log, "No device for %s", endpoint->path);
return DBUS_HANDLER_RESULT_HANDLED;
}
diff --git a/spa/plugins/bluez5/backend-native.c b/spa/plugins/bluez5/backend-native.c
index 49699913f..fe5d0c29c 100644
--- a/spa/plugins/bluez5/backend-native.c
+++ b/spa/plugins/bluez5/backend-native.c
@@ -1689,7 +1689,7 @@ static DBusHandlerResult profile_new_connection(DBusConnection *conn, DBusMessag
dbus_message_iter_get_basic(&it[0], &path);
d = spa_bt_device_find(backend->monitor, path);
- if (d == NULL) {
+ if (d == NULL || d->adapter == NULL) {
spa_log_warn(backend->log, "unknown device for path %s", path);
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
@@ -1816,7 +1816,7 @@ static DBusHandlerResult profile_request_disconnection(DBusConnection *conn, DBu
dbus_message_iter_get_basic(&it[0], &path);
d = spa_bt_device_find(backend->monitor, path);
- if (d == NULL) {
+ if (d == NULL || d->adapter == NULL) {
spa_log_warn(backend->log, "unknown device for path %s", path);
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
diff --git a/spa/plugins/bluez5/backend-ofono.c b/spa/plugins/bluez5/backend-ofono.c
index a4a2825ac..0f07736bb 100644
--- a/spa/plugins/bluez5/backend-ofono.c
+++ b/spa/plugins/bluez5/backend-ofono.c
@@ -364,7 +364,7 @@ static DBusHandlerResult ofono_audio_card_found(struct impl *backend, char *path
}
d = spa_bt_device_find_by_address(backend->monitor, remote_address, local_address);
- if (!d) {
+ if (!d || !d->adapter) {
spa_log_error(backend->log, "Device doesnt exist for %s", path);
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
diff --git a/spa/plugins/bluez5/bluez5-dbus.c b/spa/plugins/bluez5/bluez5-dbus.c
index 85ababc0d..c7ab216f3 100644
--- a/spa/plugins/bluez5/bluez5-dbus.c
+++ b/spa/plugins/bluez5/bluez5-dbus.c
@@ -785,11 +785,20 @@ static struct spa_bt_adapter *adapter_create(struct spa_bt_monitor *monitor, con
return d;
}
+static void device_free(struct spa_bt_device *device);
+
static void adapter_free(struct spa_bt_adapter *adapter)
{
struct spa_bt_monitor *monitor = adapter->monitor;
+ struct spa_bt_device *d, *td;
+
spa_log_debug(monitor->log, "%p", adapter);
+ /* Devices should be destroyed before their assigned adapter */
+ spa_list_for_each_safe(d, td, &monitor->device_list, link)
+ if (d->adapter == adapter)
+ device_free(d);
+
spa_bt_player_destroy(adapter->dummy_player);
spa_list_remove(&adapter->link);
@@ -2937,7 +2946,7 @@ static DBusHandlerResult endpoint_set_configuration(DBusConnection *conn,
transport->a2dp_codec = codec;
transport_update_props(transport, &it[1], NULL);
- if (transport->device == NULL) {
+ if (transport->device == NULL || transport->device->adapter == NULL) {
spa_log_warn(monitor->log, "no device found for transport");
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
--
2.34.1

View File

@ -1,76 +0,0 @@
From 336655360cfbe00e205d6392e1dc948ebe800815 Mon Sep 17 00:00:00 2001
From: Pauli Virtanen <pav@iki.fi>
Date: Wed, 19 Jan 2022 19:41:08 +0200
Subject: [PATCH 2/4] bluez5: maintain transport->device_list properly
If device != NULL, the transport must be in its transport_list.
---
spa/plugins/bluez5/bluez5-dbus.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/spa/plugins/bluez5/bluez5-dbus.c b/spa/plugins/bluez5/bluez5-dbus.c
index c7ab216f3..442974701 100644
--- a/spa/plugins/bluez5/bluez5-dbus.c
+++ b/spa/plugins/bluez5/bluez5-dbus.c
@@ -2109,9 +2109,16 @@ static int transport_update_props(struct spa_bt_transport *transport,
spa_bt_transport_set_state(transport, spa_bt_transport_state_from_string(value));
}
else if (spa_streq(key, "Device")) {
- transport->device = spa_bt_device_find(monitor, value);
- if (transport->device == NULL)
- spa_log_warn(monitor->log, "could not find device %s", value);
+ struct spa_bt_device *device = spa_bt_device_find(monitor, value);
+ if (transport->device != device) {
+ if (transport->device != NULL)
+ spa_list_remove(&transport->device_link);
+ transport->device = device;
+ if (device != NULL)
+ spa_list_append(&device->transport_list, &transport->device_link);
+ else
+ spa_log_warn(monitor->log, "could not find device %s", value);
+ }
}
}
else if (spa_streq(key, "Codec")) {
@@ -2892,7 +2899,6 @@ static DBusHandlerResult endpoint_set_configuration(DBusConnection *conn,
DBusMessageIter it[2];
DBusMessage *r;
struct spa_bt_transport *transport;
- bool is_new = false;
const struct a2dp_codec *codec;
int profile;
@@ -2915,9 +2921,8 @@ static DBusHandlerResult endpoint_set_configuration(DBusConnection *conn,
dbus_message_iter_recurse(&it[0], &it[1]);
transport = spa_bt_transport_find(monitor, transport_path);
- is_new = transport == NULL;
- if (is_new) {
+ if (transport == NULL) {
char *tpath = strdup(transport_path);
transport = spa_bt_transport_create(monitor, tpath, 0);
@@ -2950,10 +2955,6 @@ static DBusHandlerResult endpoint_set_configuration(DBusConnection *conn,
spa_log_warn(monitor->log, "no device found for transport");
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
- spa_bt_device_add_profile(transport->device, transport->profile);
-
- if (is_new)
- spa_list_append(&transport->device->transport_list, &transport->device_link);
device_update_last_bluez_action_time(transport->device);
@@ -2984,6 +2985,8 @@ static DBusHandlerResult endpoint_set_configuration(DBusConnection *conn,
spa_log_info(monitor->log, "%p: %s validate conf channels:%d",
monitor, path, transport->n_channels);
+ spa_bt_device_add_profile(transport->device, transport->profile);
+
spa_bt_device_connect_profile(transport->device, transport->profile);
/* Sync initial volumes */
--
2.34.1

View File

@ -1,48 +0,0 @@
From 30ea2a9682727f64857537c5b36b65cf6425b005 Mon Sep 17 00:00:00 2001
From: Wim Taymans <wtaymans@redhat.com>
Date: Wed, 5 Jan 2022 17:02:40 +0100
Subject: [PATCH 3/4] audioconvert: avoid infinite loop
When the follower has no param to enumerate we would keep on enumerating
the params of the converter forever. Fix this by setting the next value
to something that would then stop the iteration.
Also increase the amount of bits for the follower because it might need
them.
---
spa/plugins/audioconvert/audioadapter.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/spa/plugins/audioconvert/audioadapter.c b/spa/plugins/audioconvert/audioadapter.c
index b7f80feca..34622a66c 100644
--- a/spa/plugins/audioconvert/audioadapter.c
+++ b/spa/plugins/audioconvert/audioadapter.c
@@ -118,19 +118,20 @@ static int follower_enum_params(struct impl *this,
struct spa_pod_builder *builder)
{
int res;
- if (result->next < 0x10000) {
+ if (result->next < 0x100000) {
if ((res = spa_node_enum_params_sync(this->convert,
id, &result->next, filter, &result->param, builder)) == 1)
return res;
- result->next = 0x10000;
+ result->next = 0x100000;
}
- if (result->next >= 0x10000 && this->follower_params_flags[idx] & SPA_PARAM_INFO_READ) {
- result->next &= 0xffff;
+ if (result->next < 0x200000 && this->follower_params_flags[idx] & SPA_PARAM_INFO_READ) {
+ result->next &= 0xfffff;
if ((res = spa_node_enum_params_sync(this->follower,
id, &result->next, filter, &result->param, builder)) == 1) {
- result->next |= 0x10000;
+ result->next |= 0x100000;
return res;
}
+ result->next = 0x200000;
}
return 0;
}
--
2.31.1

View File

@ -1,26 +0,0 @@
From e56c1977726e342c21d395033328094d515e1309 Mon Sep 17 00:00:00 2001
From: Pauli Virtanen <pav@iki.fi>
Date: Wed, 19 Jan 2022 19:42:03 +0200
Subject: [PATCH 3/4] bluez5: don't crash in battery_remove
If device has no adapter, then there's no battery provider.
---
spa/plugins/bluez5/bluez5-dbus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/spa/plugins/bluez5/bluez5-dbus.c b/spa/plugins/bluez5/bluez5-dbus.c
index 442974701..e48def2af 100644
--- a/spa/plugins/bluez5/bluez5-dbus.c
+++ b/spa/plugins/bluez5/bluez5-dbus.c
@@ -229,7 +229,7 @@ static void battery_remove(struct spa_bt_device *device) {
device->battery_pending_call = NULL;
}
- if (!device->adapter->has_battery_provider || !device->has_battery)
+ if (!device->adapter || !device->adapter->has_battery_provider || !device->has_battery)
return;
spa_log_debug(device->monitor->log, "Removing virtual battery: %s", device->battery_path);
--
2.34.1

View File

@ -1,61 +0,0 @@
From 651a52a3bba12ec4a9a8cbbab23554cdaf6d73a9 Mon Sep 17 00:00:00 2001
From: Pauli Virtanen <pav@iki.fi>
Date: Thu, 20 Jan 2022 23:55:06 +0200
Subject: [PATCH 4/4] bluez5: deal with adapters appearing after devices
Devices may appear before or after their adapter does on BlueZ DBus
interface.
When an adapter appears, search the device list, and associated its
devices with it.
---
spa/plugins/bluez5/bluez5-dbus.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/spa/plugins/bluez5/bluez5-dbus.c b/spa/plugins/bluez5/bluez5-dbus.c
index e48def2af..51a415fa8 100644
--- a/spa/plugins/bluez5/bluez5-dbus.c
+++ b/spa/plugins/bluez5/bluez5-dbus.c
@@ -694,6 +694,22 @@ static int adapter_update_props(struct spa_bt_adapter *adapter,
return 0;
}
+static void adapter_update_devices(struct spa_bt_adapter *adapter)
+{
+ struct spa_bt_monitor *monitor = adapter->monitor;
+ struct spa_bt_device *device;
+
+ /*
+ * Update devices when new adapter appears.
+ * Devices may appear on DBus before or after the adapter does.
+ */
+
+ spa_list_for_each(device, &monitor->device_list, link) {
+ if (device->adapter == NULL && spa_streq(device->adapter_path, adapter->path))
+ device->adapter = adapter;
+ }
+}
+
static void adapter_register_player(struct spa_bt_adapter *adapter)
{
if (adapter->player_registered || !adapter->monitor->dummy_avrcp_player)
@@ -1358,7 +1374,7 @@ static int device_update_props(struct spa_bt_device *device,
device->adapter = adapter_find(monitor, value);
if (device->adapter == NULL) {
- spa_log_warn(monitor->log, "unknown adapter %s", value);
+ spa_log_info(monitor->log, "unknown adapter %s", value);
}
}
else if (spa_streq(key, "Icon")) {
@@ -3606,6 +3622,7 @@ static void interface_added(struct spa_bt_monitor *monitor,
adapter_update_props(a, props_iter, NULL);
adapter_register_application(a);
adapter_register_player(a);
+ adapter_update_devices(a);
}
else if (spa_streq(interface_name, BLUEZ_PROFILE_MANAGER_INTERFACE)) {
if (monitor->backends[BACKEND_NATIVE])
--
2.34.1

View File

@ -1,38 +0,0 @@
From a85ed47bb50c70384c37d4896a41596921c8d674 Mon Sep 17 00:00:00 2001
From: Wim Taymans <wtaymans@redhat.com>
Date: Tue, 11 Jan 2022 21:33:35 +0100
Subject: [PATCH 4/4] bluez5: handle missing device and adapter in quirks
When the device or adapter is NULL, skip the quirk checks instead of
crashing.
Fixes https://gitlab.freedesktop.org/pipewire/wireplumber/-/issues/155
---
spa/plugins/bluez5/quirks.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/spa/plugins/bluez5/quirks.c b/spa/plugins/bluez5/quirks.c
index 217bb61f6..16a8ebaa9 100644
--- a/spa/plugins/bluez5/quirks.c
+++ b/spa/plugins/bluez5/quirks.c
@@ -332,7 +332,7 @@ int spa_bt_quirks_get_features(const struct spa_bt_quirks *this,
}
/* Adapter */
- if (this->adapter_rules) {
+ if (this->adapter_rules && adapter) {
uint32_t no_features = 0;
int nitems = 0;
char vendor_id[64], product_id[64], address[64];
@@ -357,7 +357,7 @@ int spa_bt_quirks_get_features(const struct spa_bt_quirks *this,
}
/* Device */
- if (this->device_rules) {
+ if (this->device_rules && device) {
uint32_t no_features = 0;
int nitems = 0;
char vendor_id[64], product_id[64], version_id[64], address[64];
--
2.31.1

View File

@ -1,6 +1,6 @@
%global majorversion 0
%global minorversion 3
%global microversion 43
%global microversion 44
%global apiversion 0.3
%global spaversion 0.2
@ -9,7 +9,7 @@
%global ms_version 0.4.1
# For rpmdev-bumpspec and releng automation
%global baserelease 5
%global baserelease 1
#global snapdate 20210107
#global gitcommit b17db2cebc1a5ab2c01851d29c05f79cd2f262bb
@ -73,13 +73,6 @@ Source1: https://gitlab.freedesktop.org/pipewire/media-session/-/archive/
%endif
## upstream patches
Patch0001: 0003-audioconvert-avoid-infinite-loop.patch
Patch0002: 0004-bluez5-handle-missing-device-and-adapter-in-quirks.patch
Patch0003: 0001-bluez5-don-t-create-device-if-adapter-is-missing.patch
Patch0004: 0001-bluez5-require-adapter-before-profile-connect-after.patch
Patch0005: 0002-bluez5-maintain-transport-device_list-properly.patch
Patch0006: 0003-bluez5-don-t-crash-in-battery_remove.patch
Patch0007: 0004-bluez5-deal-with-adapters-appearing-after-devices.patch
## upstreamable patches
@ -129,6 +122,7 @@ BuildRequires: libusb-devel
BuildRequires: readline-devel
BuildRequires: lilv-devel
BuildRequires: openssl-devel
BuildRequires: libcanberra-devel
Requires(pre): shadow-utils
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
@ -459,6 +453,7 @@ systemctl --no-reload preset --global pipewire.socket >/dev/null 2>&1 || :
%{_mandir}/man1/pipewire.1*
%dir %{_datadir}/pipewire/
%{_datadir}/pipewire/pipewire.conf
%{_datadir}/pipewire/minimal.conf
%{_datadir}/pipewire/filter-chain/*.conf
%{_mandir}/man5/pipewire.conf.5*
@ -609,6 +604,9 @@ systemctl --no-reload preset --global pipewire.socket >/dev/null 2>&1 || :
%endif
%changelog
* Thu Jan 27 2022 Wim Taymans <wtaymans@redhat.com> - 0.3.44-1
- Update version to 0.3.44
* Tue Jan 25 2022 Wim Taymans <wtaymans@redhat.com> - 0.3.43-5
- Add more patches to avoid segfaults in bluez5

View File

@ -1,2 +1,2 @@
SHA512 (pipewire-0.3.43.tar.gz) = d3804cdb1d94977bb4e2757e46829e1e51fca52b018007afa3bbfabff4dc33538cedad015c91154e28b879fc2edeb4e1fadf633b0af9a0d3bfd930c53b1bc2c0
SHA512 (pipewire-0.3.44.tar.gz) = 9a356b1d63e996e3725b6d126d7f0a972f83d0db0a95e923d9a7ec5432ff04688d51332f5c83826069e593e021bf514937ae5daf9cc6ad7307fe8baab964a244
SHA512 (media-session-0.4.1.tar.gz) = bfce472b7260b280c0d3cd74d917f48655b5be9976c89a109e94b81af2c3664e83446e97db573cedba6e5d54dedf77195b80eb0a76f6bfc0e96e342557469f99