Accepting request 947466 from home:alarrosa:branches:multimedia:libs

- Add several more patches from upstream 
- BlueZ may be missing adapter information for devices in some cases.
  Ignore devices without specified adapter:
  * 0001-bluez5-dont-create-device-if-adapter-is-missing.patch
- Fix a case when pipewwire could never call callbacks or even
  block forever when loop is not running:
  * 0001-loop-invoke-immediately-when-loop-is-not-running.patch
- Reconfigure when monitor changes
  * 0001-merger-also-reconfigure-when-monitor-changes.patch
- Handle NULL props from metadata object
  * 0001-pw-metadata-handle-NULL-props-from-metadata-object.patch
- Improve rate selection so we don't select an invalid rate when
  the default is set or the card is already opened in an
  unsupported rate:
  * 0001-alsa-improve-rate-selection.patch

OBS-URL: https://build.opensuse.org/request/show/947466
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/pipewire?expand=0&rev=41
This commit is contained in:
Antonio Larrosa 2022-01-19 17:11:01 +00:00 committed by Git OBS Bridge
parent 0b8f9e9847
commit 4710a6257e
7 changed files with 237 additions and 0 deletions

View File

@ -0,0 +1,75 @@
From d8c867b51508b7337507e04648ace5df21bde048 Mon Sep 17 00:00:00 2001
From: Wim Taymans <wtaymans@redhat.com>
Date: Wed, 5 Jan 2022 11:53:47 +0100
Subject: [PATCH] alsa: improve rate selection
Make sure we don't select an invalid rate when the default is set or
when the card is already opened in some unsupported rate.
See #1975
---
spa/plugins/alsa/alsa-pcm.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c
index a4ea34a94..8e8834ebb 100644
--- a/spa/plugins/alsa/alsa-pcm.c
+++ b/spa/plugins/alsa/alsa-pcm.c
@@ -734,31 +734,32 @@ static int add_rate(struct state *state, uint32_t scale, bool all, uint32_t inde
CHECK(snd_pcm_hw_params_get_rate_min(params, &min, &dir), "get_rate_min");
CHECK(snd_pcm_hw_params_get_rate_max(params, &max, &dir), "get_rate_max");
- rate = state->default_rate;
if (!state->multi_rate && state->card->format_ref > 0)
rate = state->card->rate;
+ else
+ rate = state->default_rate;
- if (rate != 0 && !all) {
- if (min < rate)
- min = rate;
- if (max > rate)
- max = rate;
- }
+ if (rate < min || rate > max)
+ rate = 0;
+
+ if (rate != 0 && !all)
+ min = max = rate;
+
+ if (rate == 0)
+ rate = state->position ? state->position->clock.rate.denom : DEFAULT_RATE;
+
+ rate = SPA_CLAMP(rate, min, max);
spa_pod_builder_prop(b, SPA_FORMAT_AUDIO_rate, 0);
spa_pod_builder_push_choice(b, &f[0], SPA_CHOICE_None, 0);
choice = (struct spa_pod_choice*)spa_pod_builder_frame(b, &f[0]);
- if (rate == 0)
- rate = state->position ? state->position->clock.rate.denom : DEFAULT_RATE;
-
if (state->n_allowed_rates > 0) {
uint32_t i, v, last = 0, count = 0;
- v = SPA_CLAMP(rate, min, max);
- if (uint32_array_contains(state->allowed_rates, state->n_allowed_rates, v)) {
- spa_pod_builder_int(b, v * scale);
+ if (uint32_array_contains(state->allowed_rates, state->n_allowed_rates, rate)) {
+ spa_pod_builder_int(b, rate * scale);
count++;
}
for (i = 0; i < state->n_allowed_rates; i++) {
@@ -775,7 +776,7 @@ static int add_rate(struct state *state, uint32_t scale, bool all, uint32_t inde
if (count > 1)
choice->body.type = SPA_CHOICE_Enum;
} else {
- spa_pod_builder_int(b, SPA_CLAMP(rate, min, max) * scale);
+ spa_pod_builder_int(b, rate * scale);
if (min != max) {
spa_pod_builder_int(b, min * scale);
--
GitLab

View File

@ -0,0 +1,57 @@
From 67dcc0d29120572048f71fd40ab924a01ddd42fa 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 2b7f20162..f355b08d3 100644
--- a/spa/plugins/bluez5/bluez5-dbus.c
+++ b/spa/plugins/bluez5/bluez5-dbus.c
@@ -1470,6 +1470,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;
@@ -3622,6 +3631,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
@@ -3978,6 +3990,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)) {
--
GitLab

View File

@ -0,0 +1,27 @@
From 6ece5d810ce7090be07d22808f48caef96cb790d Mon Sep 17 00:00:00 2001
From: Wim Taymans <wtaymans@redhat.com>
Date: Tue, 18 Jan 2022 20:03:01 +0100
Subject: [PATCH] loop: invoke immediately when loop is not running
Or else we might never get our callback called or worse, block forever,
waiting for the response.
---
spa/plugins/support/loop.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/spa/plugins/support/loop.c b/spa/plugins/support/loop.c
index 94f4b321f..c8bcc5b08 100644
--- a/spa/plugins/support/loop.c
+++ b/spa/plugins/support/loop.c
@@ -187,7 +187,7 @@ loop_invoke(void *object,
int32_t filled;
uint32_t avail, idx, offset, l0;
- if (pthread_equal(impl->thread, pthread_self()))
+ if (impl->thread == 0 || pthread_equal(impl->thread, pthread_self()))
return loop_invoke_inthread(impl, func, seq, data, size, block, user_data);
filled = spa_ringbuffer_get_write_index(&impl->buffer, &idx);
--
GitLab

View File

@ -0,0 +1,28 @@
From dec7f7a608fc2f8aac1338d398ae30ba5a592e64 Mon Sep 17 00:00:00 2001
From: Wim Taymans <wtaymans@redhat.com>
Date: Mon, 17 Jan 2022 16:28:06 +0100
Subject: [PATCH] merger: also reconfigure when monitor changes
So that monitor ports are added/removed.
---
spa/plugins/audioconvert/merger.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/spa/plugins/audioconvert/merger.c b/spa/plugins/audioconvert/merger.c
index 9ebf040e9..c0b979997 100644
--- a/spa/plugins/audioconvert/merger.c
+++ b/spa/plugins/audioconvert/merger.c
@@ -624,7 +624,9 @@ static int impl_node_set_param(void *object, uint32_t id, uint32_t flags,
info.info.raw.rate = 0;
- if (this->have_profile && memcmp(&this->format, &info, sizeof(info)) == 0)
+ if (this->have_profile &&
+ memcmp(&this->format, &info, sizeof(info)) == 0 &&
+ this->monitor == monitor)
return 0;
spa_log_debug(this->log, "%p: port config %d/%d %d", this,
--
GitLab

View File

@ -0,0 +1,26 @@
From a8bafa063137c78cd191837598fae3c6c6392b68 Mon Sep 17 00:00:00 2001
From: Wim Taymans <wtaymans@redhat.com>
Date: Tue, 18 Jan 2022 12:41:17 +0100
Subject: [PATCH] pw-metadata: handle NULL props from metadata object
---
src/tools/pw-metadata.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/tools/pw-metadata.c b/src/tools/pw-metadata.c
index 97fda6744..e0aca1366 100644
--- a/src/tools/pw-metadata.c
+++ b/src/tools/pw-metadata.c
@@ -96,7 +96,8 @@ static void registry_event_global(void *data, uint32_t id, uint32_t permissions,
if (!spa_streq(type, PW_TYPE_INTERFACE_Metadata))
return;
- if ((str = spa_dict_lookup(props, PW_KEY_METADATA_NAME)) != NULL &&
+ if (props != NULL &&
+ (str = spa_dict_lookup(props, PW_KEY_METADATA_NAME)) != NULL &&
!spa_streq(str, d->opt_name))
return;
--
GitLab

View File

@ -1,3 +1,22 @@
-------------------------------------------------------------------
Wed Jan 19 16:49:42 UTC 2022 - Antonio Larrosa <alarrosa@suse.com>
- Add several more patches from upstream
- BlueZ may be missing adapter information for devices in some cases.
Ignore devices without specified adapter:
* 0001-bluez5-dont-create-device-if-adapter-is-missing.patch
- Fix a case when pipewwire could never call callbacks or even
block forever when loop is not running:
* 0001-loop-invoke-immediately-when-loop-is-not-running.patch
- Reconfigure when monitor changes
* 0001-merger-also-reconfigure-when-monitor-changes.patch
- Handle NULL props from metadata object
* 0001-pw-metadata-handle-NULL-props-from-metadata-object.patch
- Improve rate selection so we don't select an invalid rate when
the default is set or the card is already opened in an
unsupported rate:
* 0001-alsa-improve-rate-selection.patch
-------------------------------------------------------------------
Fri Jan 14 16:34:05 UTC 2022 - Antonio Larrosa <alarrosa@suse.com>

View File

@ -66,6 +66,11 @@ Patch1: 0001-bluez5-handle-missing-device-and-adapter-in-quirks.patch
Patch2: 0001-jack-remember-last-return-from-jack_get_buffer_size.patch
Patch3: 0001-pulse-server-show-monitor-sources-with-device_class_monitor.patch
Patch4: 0001-raop-fix-errno-check.patch
Patch5: 0001-bluez5-dont-create-device-if-adapter-is-missing.patch
Patch6: 0001-loop-invoke-immediately-when-loop-is-not-running.patch
Patch7: 0001-merger-also-reconfigure-when-monitor-changes.patch
Patch8: 0001-pw-metadata-handle-NULL-props-from-metadata-object.patch
Patch9: 0001-alsa-improve-rate-selection.patch
BuildRequires: docutils
BuildRequires: doxygen
BuildRequires: fdupes