aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichał Polański <michal@polanski.me>2022-07-01 20:44:01 +0200
committerBart Ribbers <bribbers@disroot.org>2022-07-01 20:48:51 +0000
commit81363b2b5609e4dddb71dca1569a50cafcb91123 (patch)
treeffeaee69a2423c5e24d0e919c01037cc7d3121e7
parent65c4d884f393491e7ee71b54676295a61b454fe0 (diff)
community/pipewire: add patch recommended by upstream
See: https://gitlab.freedesktop.org/pipewire/pipewire/-/releases/0.3.53#distros Fixes a segfault in mpv.
-rw-r--r--community/pipewire/0002-audioconvert-ensure-temp-buffers-are-large-enough.patch80
-rw-r--r--community/pipewire/APKBUILD4
2 files changed, 83 insertions, 1 deletions
diff --git a/community/pipewire/0002-audioconvert-ensure-temp-buffers-are-large-enough.patch b/community/pipewire/0002-audioconvert-ensure-temp-buffers-are-large-enough.patch
new file mode 100644
index 00000000000..9282de63560
--- /dev/null
+++ b/community/pipewire/0002-audioconvert-ensure-temp-buffers-are-large-enough.patch
@@ -0,0 +1,80 @@
+From 9af94508886b19bb398f4e2a777447ca42907c2f Mon Sep 17 00:00:00 2001
+From: Wim Taymans <wtaymans@redhat.com>
+Date: Fri, 1 Jul 2022 15:25:37 +0200
+Subject: [PATCH] audioconvert: ensure temp buffers are large enough
+
+Ensure that our temporary buffers can hold at least quantum_limit
+samples. When no output or input is connected, we can generate up
+to a quantum_limit of silence, which requires all the buffers to
+be scaled correctly.
+
+Fixes a segfault in mpv.
+---
+ spa/plugins/audioconvert/audioconvert.c | 21 ++++++++++-----------
+ 1 file changed, 10 insertions(+), 11 deletions(-)
+
+diff --git a/spa/plugins/audioconvert/audioconvert.c b/spa/plugins/audioconvert/audioconvert.c
+index ae3e4d7c3..21a7ffea1 100644
+--- a/spa/plugins/audioconvert/audioconvert.c
++++ b/spa/plugins/audioconvert/audioconvert.c
+@@ -221,9 +221,7 @@ struct impl {
+ uint32_t empty_size;
+ float *empty;
+ float *scratch;
+- float *tmp;
+- float *tmp2;
+-
++ float *tmp[2];
+ float *tmp_datas[2][MAX_PORTS];
+ };
+
+@@ -1489,9 +1487,9 @@ static int setup_convert(struct impl *this)
+ return res;
+
+ for (i = 0; i < MAX_PORTS; i++) {
+- this->tmp_datas[0][i] = SPA_PTROFF(this->tmp, this->empty_size * i, void);
++ this->tmp_datas[0][i] = SPA_PTROFF(this->tmp[0], this->empty_size * i, void);
+ this->tmp_datas[0][i] = SPA_PTR_ALIGN(this->tmp_datas[0][i], MAX_ALIGN, void);
+- this->tmp_datas[1][i] = SPA_PTROFF(this->tmp2, this->empty_size * i, void);
++ this->tmp_datas[1][i] = SPA_PTROFF(this->tmp[1], this->empty_size * i, void);
+ this->tmp_datas[1][i] = SPA_PTR_ALIGN(this->tmp_datas[1][i], MAX_ALIGN, void);
+ }
+
+@@ -2007,7 +2005,8 @@ impl_node_port_use_buffers(void *object,
+
+ clear_buffers(this, port);
+
+- maxsize = 0;
++ maxsize = this->quantum_limit * sizeof(float);
++
+ for (i = 0; i < n_buffers; i++) {
+ struct buffer *b;
+ uint32_t n_datas = buffers[i]->n_datas;
+@@ -2048,10 +2047,10 @@ impl_node_port_use_buffers(void *object,
+ if (maxsize > this->empty_size) {
+ this->empty = realloc(this->empty, maxsize + MAX_ALIGN);
+ this->scratch = realloc(this->scratch, maxsize + MAX_ALIGN);
+- this->tmp = realloc(this->tmp, (4 * maxsize + MAX_ALIGN) * MAX_PORTS);
+- this->tmp2 = realloc(this->tmp2, (4 * maxsize + MAX_ALIGN) * MAX_PORTS);
++ this->tmp[0] = realloc(this->tmp[0], (maxsize + MAX_ALIGN) * MAX_PORTS);
++ this->tmp[1] = realloc(this->tmp[1], (maxsize + MAX_ALIGN) * MAX_PORTS);
+ if (this->empty == NULL || this->scratch == NULL ||
+- this->tmp == NULL || this->tmp2 == NULL)
++ this->tmp[0] == NULL || this->tmp[1] == NULL)
+ return -errno;
+ memset(this->empty, 0, maxsize + MAX_ALIGN);
+ this->empty_size = maxsize;
+@@ -2639,8 +2638,8 @@ static int impl_clear(struct spa_handle *handle)
+ free(this->dir[SPA_DIRECTION_OUTPUT].ports[i]);
+ free(this->empty);
+ free(this->scratch);
+- free(this->tmp);
+- free(this->tmp2);
++ free(this->tmp[0]);
++ free(this->tmp[1]);
+
+ if (this->resample.free)
+ resample_free(&this->resample);
+--
+2.37.0
+
diff --git a/community/pipewire/APKBUILD b/community/pipewire/APKBUILD
index 0ea03abb950..9fb8608ab87 100644
--- a/community/pipewire/APKBUILD
+++ b/community/pipewire/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=pipewire
pkgver=0.3.53
-pkgrel=0
+pkgrel=1
pkgdesc="Multimedia processing graphs"
url="https://pipewire.org/"
arch="all"
@@ -54,6 +54,7 @@ source="https://gitlab.freedesktop.org/PipeWire/pipewire/-/archive/$pkgver/pipew
pipewire.desktop
pipewire-launcher.sh
0001-Revert-pulse-tunnel-use-format-channels-and-rate-pro.patch
+ 0002-audioconvert-ensure-temp-buffers-are-large-enough.patch
"
case "$CARCH" in
@@ -204,4 +205,5 @@ sha512sums="
d5d8bc64e42715aa94296e3e26e740142bff7f638c7eb4fecc0301e46d55636d889bdc0c0399c1eb523271b20f7c48cc03f6ce3c072e0e8576c821ed1ea0e3dd pipewire.desktop
be2bd1520fae27ccca6af4c98e8ebe63541260af55eb085839235a8441a7bce434ba8bf23a5d1ca8b5f361229f5482d5b63504b9a5cbbe9d39bc051207cd7dac pipewire-launcher.sh
5a84a255794cd260476f93b154a32a84efc925c1f6ecc64efe659d89eb81bb3090438e2b3c4000a8ab68d8c72bca453e13297719a95f1e4457f43e43acec8bfa 0001-Revert-pulse-tunnel-use-format-channels-and-rate-pro.patch
+36a4928e70c9d253a37e17c579c58d22571eb41a7fd8c584077faf4b55c7843884c8e348143164e470a15c5cfaf3209c5d19c4cc949d73fa4bf8ce58b71e56d5 0002-audioconvert-ensure-temp-buffers-are-large-enough.patch
"