From 87066a23fa83f3e1ed1f8949241a3009324f3433 Mon Sep 17 00:00:00 2001 From: cinerea0 Date: Wed, 25 Jan 2023 21:13:51 -0500 Subject: [PATCH] pipewire: update to 0.3.64 --- srcpkgs/pipewire/INSTALL.msg | 4 ++ .../patches/fix-audioconvert-overflow.patch | 56 +++++++++++++++++++ .../pipewire/patches/fix-avx-crackle.patch | 15 +++++ .../patches/mark-deprecated-keys.patch | 51 +++++++++++++++++ srcpkgs/pipewire/template | 8 +-- 5 files changed, 130 insertions(+), 4 deletions(-) create mode 100644 srcpkgs/pipewire/INSTALL.msg create mode 100644 srcpkgs/pipewire/patches/fix-audioconvert-overflow.patch create mode 100644 srcpkgs/pipewire/patches/fix-avx-crackle.patch create mode 100644 srcpkgs/pipewire/patches/mark-deprecated-keys.patch diff --git a/srcpkgs/pipewire/INSTALL.msg b/srcpkgs/pipewire/INSTALL.msg new file mode 100644 index 000000000000..6293ff76f853 --- /dev/null +++ b/srcpkgs/pipewire/INSTALL.msg @@ -0,0 +1,4 @@ +The pipewire-media-session session manager has been abandoned upstream and +will be removed from Void in a subsequent pipewire update. All users are +encouraged to transition to wireplumber immediately to avoid unexpected loss +of functionality in the future. \ No newline at end of file diff --git a/srcpkgs/pipewire/patches/fix-audioconvert-overflow.patch b/srcpkgs/pipewire/patches/fix-audioconvert-overflow.patch new file mode 100644 index 000000000000..6af679027a13 --- /dev/null +++ b/srcpkgs/pipewire/patches/fix-audioconvert-overflow.patch @@ -0,0 +1,56 @@ +# fixes audioconvert overflow when scaling, will be in 0.3.65+ +# https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/1d9640af5a7906620f214aa0a39c63128c8506a6 +diff --git a/spa/include/spa/utils/defs.h b/spa/include/spa/utils/defs.h +index c602c9348827805dbafc63bf2732e0d5df833158..3b4862663643e35595d7d12d3d9cdd45fdc85868 100644 +--- a/spa/include/spa/utils/defs.h ++++ b/spa/include/spa/utils/defs.h +@@ -274,6 +274,14 @@ struct spa_fraction { + #define SPA_ROUND_DOWN_N(num,align) ((num) & ~SPA_ROUND_MASK(num, align)) + #define SPA_ROUND_UP_N(num,align) ((((num)-1) | SPA_ROUND_MASK(num, align))+1) + ++#define SPA_SCALE32_UP(val,num,denom) \ ++({ \ ++ uint64_t _val = (val); \ ++ uint64_t _denom = (denom); \ ++ (uint32_t)(((_val) * (num) + (_denom)-1) / (_denom)); \ ++}) ++ ++ + #define SPA_PTR_ALIGNMENT(p,align) ((intptr_t)(p) & ((align)-1)) + #define SPA_IS_ALIGNED(p,align) (SPA_PTR_ALIGNMENT(p,align) == 0) + #define SPA_PTR_ALIGN(p,align,type) ((type*)SPA_ROUND_UP_N((intptr_t)(p), (intptr_t)(align))) +diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c +index 08b9ceddd89f1602b39a3a0e3c0e7cbe221f49c5..012b4603101cdd76e1796f66f932a7a21f847176 100644 +--- a/spa/plugins/alsa/alsa-pcm.c ++++ b/spa/plugins/alsa/alsa-pcm.c +@@ -1999,7 +1999,7 @@ static inline void check_position_config(struct state *state) + (state->rate_denom != state->position->clock.rate.denom))) { + state->duration = state->position->clock.duration; + state->rate_denom = state->position->clock.rate.denom; +- state->threshold = (state->duration * state->rate + state->rate_denom-1) / state->rate_denom; ++ state->threshold = SPA_SCALE32_UP(state->duration, state->rate, state->rate_denom); + state->max_error = SPA_MAX(256.0f, state->threshold / 2.0f); + state->resample = ((uint32_t)state->rate != state->rate_denom) || state->matching; + state->alsa_sync = true; +@@ -2569,7 +2569,7 @@ int spa_alsa_start(struct state *state) + setup_matching(state); + + spa_dll_init(&state->dll); +- state->threshold = (state->duration * state->rate + state->rate_denom-1) / state->rate_denom; ++ state->threshold = SPA_SCALE32_UP(state->duration, state->rate, state->rate_denom); + state->last_threshold = state->threshold; + state->max_error = SPA_MAX(256.0f, state->threshold / 2.0f); + +diff --git a/spa/plugins/audioconvert/audioconvert.c b/spa/plugins/audioconvert/audioconvert.c +index 578f70ff9a769fce2d45fa414b6f89fab37216a8..783ab81741a99fb00762382b2e6507f369757906 100644 +--- a/spa/plugins/audioconvert/audioconvert.c ++++ b/spa/plugins/audioconvert/audioconvert.c +@@ -1755,7 +1755,7 @@ impl_node_port_enum_params(void *object, int seq, + size = this->quantum_limit * 2; + /* scale the buffer size when we can. */ + if (irate != 0 && orate != 0) +- size = size * (irate + orate - 1) / orate; ++ size = SPA_SCALE32_UP(size, irate, orate); + } + + param = spa_pod_builder_add_object(&b, diff --git a/srcpkgs/pipewire/patches/fix-avx-crackle.patch b/srcpkgs/pipewire/patches/fix-avx-crackle.patch new file mode 100644 index 000000000000..847269c06a32 --- /dev/null +++ b/srcpkgs/pipewire/patches/fix-avx-crackle.patch @@ -0,0 +1,15 @@ +# fixes crackling when using virtual sound, will be in 0.3.65+ +# https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/ccedf1722ae44c97ec0d058b349494c67a0b56dc +diff --git a/src/modules/module-filter-chain/dsp-ops-avx.c b/src/modules/module-filter-chain/dsp-ops-avx.c +index 64abcaa441ec632972137c1f6ac86f1a85c9d77e..7ea5456fa66e3689a7d238c94c96600edaf01250 100644 +--- a/src/modules/module-filter-chain/dsp-ops-avx.c ++++ b/src/modules/module-filter-chain/dsp-ops-avx.c +@@ -59,7 +59,7 @@ void dsp_sum_avx(struct dsp_ops *ops, float *r, const float *a, const float *b, + _mm256_store_ps(&r[n+24], in[3]); + } + } else { +- for (n = 0; n < unrolled; n += 16) { ++ for (n = 0; n < unrolled; n += 32) { + in[0] = _mm256_loadu_ps(&a[n+ 0]); + in[1] = _mm256_loadu_ps(&a[n+ 8]); + in[2] = _mm256_loadu_ps(&a[n+16]); diff --git a/srcpkgs/pipewire/patches/mark-deprecated-keys.patch b/srcpkgs/pipewire/patches/mark-deprecated-keys.patch new file mode 100644 index 000000000000..e21f0bda99c9 --- /dev/null +++ b/srcpkgs/pipewire/patches/mark-deprecated-keys.patch @@ -0,0 +1,51 @@ +# Adds macro to mark deprecated keys instead of removing them outright, will be in 0.3.65+ +# https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/a979c0f43078cbfefa2ba614ee078579042d2de2 +diff --git a/src/pipewire/keys.h b/src/pipewire/keys.h +index ae54807bcf1c7ad5e2d3d3da1abd2095f901c66e..b0faf611d8926c4ea82c4b4ec82af33347edcc31 100644 +--- a/src/pipewire/keys.h ++++ b/src/pipewire/keys.h +@@ -29,6 +29,7 @@ + extern "C" { + #endif + ++#include + /** + * \defgroup pw_keys Key Names + * +@@ -337,14 +338,14 @@ extern "C" { + #define PW_KEY_VIDEO_FORMAT "video.format" /**< a video format */ + #define PW_KEY_VIDEO_SIZE "video.size" /**< a video size as "x