From 0b8f9e9847b56725814726ab61104dbe2879d89a35b64120e0f1edd2ea24b181 Mon Sep 17 00:00:00 2001 From: Antonio Larrosa Date: Fri, 14 Jan 2022 16:59:50 +0000 Subject: [PATCH] Accepting request 946469 from home:alarrosa:branches:multimedia:libs - Add several patches from upstream - Avoid an infinite loop when enumerating params of the converter: * 0001-audioconvert-avoid-infinite-loop.patch - When the device or adapter is NULL, skip the quirk checks instead of crashing: * 0001-bluez5-handle-missing-device-and-adapter-in-quirks.patch - Remember the last returned value from jack_get_buffer_size and only emit a buffersize change event when something new is configured. This fixes startup of jconvolver. * 0001-jack-remember-last-return-from-jack_get_buffer_size.patch - Better emulation of pulseaudio which shows monitor sources with device.class=monitor so now pipewire does that too: * 0001-pulse-server-show-monitor-sources-with-device_class_monitor.patch - Fix an errno check: * 0001-raop-fix-errno-check.patch - Added more baselibs packages and their dependencies OBS-URL: https://build.opensuse.org/request/show/946469 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/pipewire?expand=0&rev=40 --- 0001-audioconvert-avoid-infinite-loop.patch | 48 ++++++++++++++++ ...missing-device-and-adapter-in-quirks.patch | 38 +++++++++++++ ...ast-return-from-jack_get_buffer_size.patch | 40 +++++++++++++ ...or-sources-with-device_class_monitor.patch | 57 +++++++++++++++++++ 0001-raop-fix-errno-check.patch | 44 ++++++++++++++ baselibs.conf | 9 +++ pipewire.changes | 24 ++++++++ pipewire.spec | 6 +- 8 files changed, 265 insertions(+), 1 deletion(-) create mode 100644 0001-audioconvert-avoid-infinite-loop.patch create mode 100644 0001-bluez5-handle-missing-device-and-adapter-in-quirks.patch create mode 100644 0001-jack-remember-last-return-from-jack_get_buffer_size.patch create mode 100644 0001-pulse-server-show-monitor-sources-with-device_class_monitor.patch create mode 100644 0001-raop-fix-errno-check.patch diff --git a/0001-audioconvert-avoid-infinite-loop.patch b/0001-audioconvert-avoid-infinite-loop.patch new file mode 100644 index 0000000..2474281 --- /dev/null +++ b/0001-audioconvert-avoid-infinite-loop.patch @@ -0,0 +1,48 @@ +From af11fb4804c97ad0dee73dba059b7a3d42d15bad Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Wed, 5 Jan 2022 17:02:40 +0100 +Subject: [PATCH] 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; + } +-- +GitLab + diff --git a/0001-bluez5-handle-missing-device-and-adapter-in-quirks.patch b/0001-bluez5-handle-missing-device-and-adapter-in-quirks.patch new file mode 100644 index 0000000..6a880e5 --- /dev/null +++ b/0001-bluez5-handle-missing-device-and-adapter-in-quirks.patch @@ -0,0 +1,38 @@ +From 140c8d0cd95523815d42dbca10ef9457780f6636 Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Tue, 11 Jan 2022 21:33:35 +0100 +Subject: [PATCH] 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]; +-- +GitLab + diff --git a/0001-jack-remember-last-return-from-jack_get_buffer_size.patch b/0001-jack-remember-last-return-from-jack_get_buffer_size.patch new file mode 100644 index 0000000..9d4ca97 --- /dev/null +++ b/0001-jack-remember-last-return-from-jack_get_buffer_size.patch @@ -0,0 +1,40 @@ +From 2b102a1046630b072d80e36c872e2aa4e28052ca Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Fri, 7 Jan 2022 17:12:43 +0100 +Subject: [PATCH] jack: remember last return from jack_get_buffer_size + +Remember what we last returned from jack_get_buffer_size and only +emit a buffersize change event when somwthing new is configured. + +Fixes startup of jconvolver. + +Fixes #1989 +--- + pipewire-jack/src/pipewire-jack.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/pipewire-jack/src/pipewire-jack.c b/pipewire-jack/src/pipewire-jack.c +index 595d786f6..f338d2469 100644 +--- a/pipewire-jack/src/pipewire-jack.c ++++ b/pipewire-jack/src/pipewire-jack.c +@@ -1227,7 +1227,8 @@ do_buffer_frames(struct spa_loop *loop, + { + uint32_t buffer_frames = *((uint32_t*)data); + struct client *c = user_data; +- do_callback_expr(c, c->buffer_frames = buffer_frames, bufsize_callback, buffer_frames, c->bufsize_arg); ++ if (c->buffer_frames != buffer_frames) ++ do_callback_expr(c, c->buffer_frames = buffer_frames, bufsize_callback, buffer_frames, c->bufsize_arg); + recompute_latencies(c); + return 0; + } +@@ -3985,6 +3986,7 @@ jack_nframes_t jack_get_buffer_size (jack_client_t *client) + res = c->position->clock.duration; + } + } ++ c->buffer_frames = res; + pw_log_debug("buffer_frames: %u", res); + return res; + } +-- +GitLab + diff --git a/0001-pulse-server-show-monitor-sources-with-device_class_monitor.patch b/0001-pulse-server-show-monitor-sources-with-device_class_monitor.patch new file mode 100644 index 0000000..bde7ea3 --- /dev/null +++ b/0001-pulse-server-show-monitor-sources-with-device_class_monitor.patch @@ -0,0 +1,57 @@ +From 9eddd0474f55c4dda713511a14a1e15a4b4c685e Mon Sep 17 00:00:00 2001 +From: Pauli Virtanen +Date: Thu, 6 Jan 2022 21:27:40 +0200 +Subject: [PATCH] pulse-server: show monitor sources with device.class=monitor + +Pulseaudio shows monitors with device.class=monitor, so we follow. +--- + .../module-protocol-pulse/pulse-server.c | 25 ++++++++++++++++++- + 1 file changed, 24 insertions(+), 1 deletion(-) + +diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c +index 9747e5ae9..d0ebaeefd 100644 +--- a/src/modules/module-protocol-pulse/pulse-server.c ++++ b/src/modules/module-protocol-pulse/pulse-server.c +@@ -3670,6 +3670,27 @@ static int fill_sink_info(struct client *client, struct message *m, + return 0; + } + ++static int fill_source_info_proplist(struct message *m, struct pw_manager_object *o, ++ struct pw_node_info *info) ++{ ++ struct pw_properties *props = NULL; ++ struct spa_dict *props_dict = info->props; ++ ++ if (pw_manager_object_is_monitor(o)) { ++ props = pw_properties_new_dict(info->props); ++ if (props == NULL) ++ return -ENOMEM; ++ ++ pw_properties_set(props, PW_KEY_DEVICE_CLASS, "monitor"); ++ props_dict = &props->dict; ++ } ++ ++ message_put(m, TAG_PROPLIST, props_dict, TAG_INVALID); ++ pw_properties_free(props); ++ ++ return 0; ++} ++ + static int fill_source_info(struct client *client, struct message *m, + struct pw_manager_object *o) + { +@@ -3762,8 +3783,10 @@ static int fill_source_info(struct client *client, struct message *m, + TAG_INVALID); + + if (client->version >= 13) { ++ int res; ++ if ((res = fill_source_info_proplist(m, o, info)) < 0) ++ return res; + message_put(m, +- TAG_PROPLIST, info->props, + TAG_USEC, 0LL, /* requested latency */ + TAG_INVALID); + } +-- +GitLab + diff --git a/0001-raop-fix-errno-check.patch b/0001-raop-fix-errno-check.patch new file mode 100644 index 0000000..388cbf5 --- /dev/null +++ b/0001-raop-fix-errno-check.patch @@ -0,0 +1,44 @@ +From 8e3eaf79528006ed7940a525aab343b3812e8b19 Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Wed, 12 Jan 2022 10:08:40 +0100 +Subject: [PATCH] raop: fix errno check + +--- + src/modules/module-raop/rtsp-client.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/src/modules/module-raop/rtsp-client.c b/src/modules/module-raop/rtsp-client.c +index c1740ea5f..9bb888773 100644 +--- a/src/modules/module-raop/rtsp-client.c ++++ b/src/modules/module-raop/rtsp-client.c +@@ -203,9 +203,12 @@ static int read_line(struct pw_rtsp_client *client, char **buf) + if (res == 0) + return -EPIPE; + if (res < 0) { +- if (res == EAGAIN) +- return 0; +- return -errno; ++ res = -errno; ++ if (res == -EINTR) ++ continue; ++ if (res != -EAGAIN && res != -EWOULDBLOCK) ++ return res; ++ return 0; + } + if (c == '\n') { + client->line_buf[client->line_pos] = '\0'; +@@ -435,9 +438,10 @@ int pw_rtsp_client_connect(struct pw_rtsp_client *client, + true, on_source_io, client); + + if (client->source == NULL) { ++ res = -errno; + pw_log_error("%p: source create failed: %m", client); + close(fd); +- return -errno; ++ return res; + } + client->connecting = true; + free(client->session_id); +-- +GitLab + diff --git a/baselibs.conf b/baselibs.conf index c6af069..9ffb024 100644 --- a/baselibs.conf +++ b/baselibs.conf @@ -1,5 +1,14 @@ libpipewire-0_3-0 + requires "pipewire-spa-plugins-0_2- = " + requires "pipewire-modules-0_3- = " pipewire-alsa requires "libpipewire-0_3-0- = " pipewire-libjack-0_3 requires "libpipewire-0_3-0- = " +pipewire-modules-0_3 + requires "libpipewire-0_3-0- = " + provides "pipewire-modules- = " + obsoletes "pipewire-modules- < " +pipewire-spa-plugins-0_2 + requires "libpipewire-0_3-0- = " + diff --git a/pipewire.changes b/pipewire.changes index 3268797..49f9e0b 100644 --- a/pipewire.changes +++ b/pipewire.changes @@ -1,3 +1,27 @@ +------------------------------------------------------------------- +Fri Jan 14 16:34:05 UTC 2022 - Antonio Larrosa + +- Add several patches from upstream +- Avoid an infinite loop when enumerating params of the converter: + * 0001-audioconvert-avoid-infinite-loop.patch +- When the device or adapter is NULL, skip the quirk checks instead + of crashing: + * 0001-bluez5-handle-missing-device-and-adapter-in-quirks.patch +- Remember the last returned value from jack_get_buffer_size and + only emit a buffersize change event when something new is + configured. This fixes startup of jconvolver. + * 0001-jack-remember-last-return-from-jack_get_buffer_size.patch +- Better emulation of pulseaudio which shows monitor sources with + device.class=monitor so now pipewire does that too: + * 0001-pulse-server-show-monitor-sources-with-device_class_monitor.patch +- Fix an errno check: + * 0001-raop-fix-errno-check.patch + +------------------------------------------------------------------- +Wed Jan 12 12:48:21 UTC 2022 - Antonio Larrosa + +- Added more baselibs packages and their dependencies + ------------------------------------------------------------------- Wed Jan 5 16:23:30 UTC 2022 - Bjørn Lie diff --git a/pipewire.spec b/pipewire.spec index 1c306a3..120e312 100644 --- a/pipewire.spec +++ b/pipewire.spec @@ -61,7 +61,11 @@ Group: Development/Libraries/C and C++ URL: https://pipewire.org/ Source0: %{name}-%{version}.tar.xz Source99: baselibs.conf - +Patch0: 0001-audioconvert-avoid-infinite-loop.patch +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 BuildRequires: docutils BuildRequires: doxygen BuildRequires: fdupes