summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--media-video/pipewire/files/1.2.7/0001-spa-alsa-Fix-key-name-suggestion-in-log-message.patch28
-rw-r--r--media-video/pipewire/files/1.2.7/0002-spa-alsa-Don-t-assume-all-PCMs-have-a-card.patch128
-rw-r--r--media-video/pipewire/files/1.2.7/0003-gst-mark-the-pipewiresink-as-EARLY_PROCESS.patch29
-rw-r--r--media-video/pipewire/files/1.2.7/0004-gst-add-rate-control-to-the-sink.patch234
-rw-r--r--media-video/pipewire/files/1.2.7/0005-gst-add-slave-method-property.patch259
-rw-r--r--media-video/pipewire/files/1.2.7/0006-spa-fix-some-param-type-info.patch51
-rw-r--r--media-video/pipewire/files/1.2.7/0007-filter-chain-handle-0-length-IR.patch305
-rw-r--r--media-video/pipewire/files/1.2.7/0008-spa-initialize-all-fields-explicitly.patch47
-rw-r--r--media-video/pipewire/pipewire-1.2.7-r1.ebuild527
-rw-r--r--media-video/pipewire/pipewire-1.2.7.ebuild2
10 files changed, 1609 insertions, 1 deletions
diff --git a/media-video/pipewire/files/1.2.7/0001-spa-alsa-Fix-key-name-suggestion-in-log-message.patch b/media-video/pipewire/files/1.2.7/0001-spa-alsa-Fix-key-name-suggestion-in-log-message.patch
new file mode 100644
index 000000000000..a9348553e15b
--- /dev/null
+++ b/media-video/pipewire/files/1.2.7/0001-spa-alsa-Fix-key-name-suggestion-in-log-message.patch
@@ -0,0 +1,28 @@
+From 1993383ddf67e296334c7916d6afc699ee6300c7 Mon Sep 17 00:00:00 2001
+Message-ID: <1993383ddf67e296334c7916d6afc699ee6300c7.1737052666.git.sam@gentoo.org>
+From: Arun Raghavan <arun@asymptotic.io>
+Date: Fri, 29 Nov 2024 10:54:18 -0500
+Subject: [PATCH 1/8] spa: alsa: Fix key name suggestion in log message
+
+We use api.alsa.pcm.card to look up the PCM's card if we don't know it
+by other means.
+---
+ spa/plugins/alsa/alsa-pcm.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c
+index b07897935..9244b66aa 100644
+--- a/spa/plugins/alsa/alsa-pcm.c
++++ b/spa/plugins/alsa/alsa-pcm.c
+@@ -939,7 +939,7 @@ int spa_alsa_init(struct state *state, const struct spa_dict *info)
+ sscanf(state->props.device, "%*[^:]:%u", &state->card_index);
+ if (state->card_index == SPA_ID_INVALID) {
+ spa_log_error(state->log, "Could not determine card index, maybe set %s",
+- SPA_KEY_API_ALSA_CARD);
++ SPA_KEY_API_ALSA_PCM_CARD);
+ return -EINVAL;
+ }
+ }
+--
+2.48.0
+
diff --git a/media-video/pipewire/files/1.2.7/0002-spa-alsa-Don-t-assume-all-PCMs-have-a-card.patch b/media-video/pipewire/files/1.2.7/0002-spa-alsa-Don-t-assume-all-PCMs-have-a-card.patch
new file mode 100644
index 000000000000..efb13f667b9a
--- /dev/null
+++ b/media-video/pipewire/files/1.2.7/0002-spa-alsa-Don-t-assume-all-PCMs-have-a-card.patch
@@ -0,0 +1,128 @@
+From a6019e6dd73e686c69db5967fc3e852a8fe43ecb Mon Sep 17 00:00:00 2001
+Message-ID: <a6019e6dd73e686c69db5967fc3e852a8fe43ecb.1737052666.git.sam@gentoo.org>
+In-Reply-To: <1993383ddf67e296334c7916d6afc699ee6300c7.1737052666.git.sam@gentoo.org>
+References: <1993383ddf67e296334c7916d6afc699ee6300c7.1737052666.git.sam@gentoo.org>
+From: Arun Raghavan <arun@asymptotic.io>
+Date: Fri, 29 Nov 2024 10:42:58 -0500
+Subject: [PATCH 2/8] spa: alsa: Don't assume all PCMs have a card
+
+dmix/dsnoop devices, for example, don't have an associated card, so all
+the card-related checks don't make sense. Let's explicitly deal with
+this case.
+
+Fixes: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4432
+---
+ spa/plugins/alsa/alsa-pcm.c | 31 +++++++++++++++++--------------
+ 1 file changed, 17 insertions(+), 14 deletions(-)
+
+diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c
+index 9244b66aa..b8728bfe1 100644
+--- a/spa/plugins/alsa/alsa-pcm.c
++++ b/spa/plugins/alsa/alsa-pcm.c
+@@ -40,6 +40,9 @@ static struct card *ensure_card(uint32_t index, bool ucm)
+ const char *alibpref = NULL;
+ int err;
+
++ if (index == SPA_ID_INVALID)
++ return NULL;
++
+ if ((c = find_card(index)) != NULL)
+ return c;
+
+@@ -78,6 +81,9 @@ error:
+
+ static void release_card(struct card *c)
+ {
++ if (!c)
++ return;
++
+ spa_assert(c->ref > 0);
+
+ if (--c->ref > 0)
+@@ -657,7 +663,7 @@ static void silence_error_handler(const char *file, int line,
+ static void fill_device_name(struct state *state, const char *params, char device_name[], size_t len)
+ {
+ spa_scnprintf(device_name, len, "%s%s%s",
+- state->card->ucm_prefix ? state->card->ucm_prefix : "",
++ state->card && state->card->ucm_prefix ? state->card->ucm_prefix : "",
+ state->props.device, params ? params : "");
+ }
+
+@@ -938,13 +944,12 @@ int spa_alsa_init(struct state *state, const struct spa_dict *info)
+ /* If we don't have a card index, see if we have a *:<idx> string */
+ sscanf(state->props.device, "%*[^:]:%u", &state->card_index);
+ if (state->card_index == SPA_ID_INVALID) {
+- spa_log_error(state->log, "Could not determine card index, maybe set %s",
+- SPA_KEY_API_ALSA_PCM_CARD);
+- return -EINVAL;
++ spa_log_info(state->log, "Could not determine card index. %s and/or clock.name "
++ "may need to be configured manually", SPA_KEY_API_ALSA_PCM_CARD);
+ }
+ }
+
+- if (state->clock_name[0] == '\0')
++ if (state->clock_name[0] == '\0' && state->card_index != SPA_ID_INVALID)
+ snprintf(state->clock_name, sizeof(state->clock_name),
+ "api.alsa.%s-%u",
+ state->stream == SND_PCM_STREAM_PLAYBACK ? "p" : "c",
+@@ -957,10 +962,7 @@ int spa_alsa_init(struct state *state, const struct spa_dict *info)
+ }
+
+ state->card = ensure_card(state->card_index, state->open_ucm);
+- if (state->card == NULL) {
+- spa_log_error(state->log, "can't create card %u", state->card_index);
+- return -errno;
+- }
++
+ state->log_file = fopencookie(state, "w", io_funcs);
+ if (state->log_file == NULL) {
+ spa_log_error(state->log, "can't create log file");
+@@ -1203,7 +1205,7 @@ int spa_alsa_close(struct state *state)
+ else
+ state->n_fds = 0;
+
+- if (state->have_format)
++ if (state->have_format && state->card)
+ state->card->format_ref--;
+
+ state->have_format = false;
+@@ -1423,7 +1425,7 @@ static int add_rate(struct state *state, uint32_t scale, uint32_t interleave, bo
+ if (max < min)
+ return 0;
+
+- if (!state->multi_rate && state->card->format_ref > 0)
++ if (!state->multi_rate && state->card && state->card->format_ref > 0)
+ rate = state->card->rate;
+ else
+ rate = state->default_rate;
+@@ -1439,8 +1441,8 @@ static int add_rate(struct state *state, uint32_t scale, uint32_t interleave, bo
+
+ rate = SPA_CLAMP(rate, min, max);
+
+- spa_log_debug(state->log, "rate:%u multi:%d card:%d def:%d",
+- rate, state->multi_rate, state->card->rate, state->default_rate);
++ spa_log_debug(state->log, "rate:%u multi:%d card:%u def:%d",
++ rate, state->multi_rate, state->card ? state->card->rate : 0, state->default_rate);
+
+ spa_pod_builder_prop(b, SPA_FORMAT_AUDIO_rate, 0);
+
+@@ -2172,6 +2174,7 @@ int spa_alsa_set_format(struct state *state, struct spa_audio_info *fmt, uint32_
+ }
+
+ if (!state->multi_rate &&
++ state->card &&
+ state->card->format_ref > 0 &&
+ state->card->rate != rrate) {
+ spa_log_error(state->log, "%p: card already opened at rate:%i",
+@@ -2217,7 +2220,7 @@ int spa_alsa_set_format(struct state *state, struct spa_audio_info *fmt, uint32_
+ state->driver_rate.denom = 0;
+
+ state->have_format = true;
+- if (state->card->format_ref++ == 0)
++ if (state->card && state->card->format_ref++ == 0)
+ state->card->rate = rrate;
+
+ dir = 0;
+--
+2.48.0
+
diff --git a/media-video/pipewire/files/1.2.7/0003-gst-mark-the-pipewiresink-as-EARLY_PROCESS.patch b/media-video/pipewire/files/1.2.7/0003-gst-mark-the-pipewiresink-as-EARLY_PROCESS.patch
new file mode 100644
index 000000000000..54f020f9379e
--- /dev/null
+++ b/media-video/pipewire/files/1.2.7/0003-gst-mark-the-pipewiresink-as-EARLY_PROCESS.patch
@@ -0,0 +1,29 @@
+From 938283aee4a1c120bf1c9285090ea196a5b5c89b Mon Sep 17 00:00:00 2001
+Message-ID: <938283aee4a1c120bf1c9285090ea196a5b5c89b.1737052666.git.sam@gentoo.org>
+In-Reply-To: <1993383ddf67e296334c7916d6afc699ee6300c7.1737052666.git.sam@gentoo.org>
+References: <1993383ddf67e296334c7916d6afc699ee6300c7.1737052666.git.sam@gentoo.org>
+From: Wim Taymans <wtaymans@redhat.com>
+Date: Tue, 26 Nov 2024 16:57:14 +0100
+Subject: [PATCH 3/8] gst: mark the pipewiresink as EARLY_PROCESS
+
+We want to receive process callbacks as soon as a buffer is ready for
+reuse because we dequeue it for use in our buffer pool.
+---
+ src/gst/gstpipewiresink.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/gst/gstpipewiresink.c b/src/gst/gstpipewiresink.c
+index b39a335d8..d79ceaa66 100644
+--- a/src/gst/gstpipewiresink.c
++++ b/src/gst/gstpipewiresink.c
+@@ -633,6 +633,7 @@ gst_pipewire_sink_setcaps (GstBaseSink * bsink, GstCaps * caps)
+ char buf[64];
+
+ flags = PW_STREAM_FLAG_ASYNC;
++ flags |= PW_STREAM_FLAG_EARLY_PROCESS;
+ if (pwsink->mode != GST_PIPEWIRE_SINK_MODE_PROVIDE)
+ flags |= PW_STREAM_FLAG_AUTOCONNECT;
+ else
+--
+2.48.0
+
diff --git a/media-video/pipewire/files/1.2.7/0004-gst-add-rate-control-to-the-sink.patch b/media-video/pipewire/files/1.2.7/0004-gst-add-rate-control-to-the-sink.patch
new file mode 100644
index 000000000000..1fdd40244948
--- /dev/null
+++ b/media-video/pipewire/files/1.2.7/0004-gst-add-rate-control-to-the-sink.patch
@@ -0,0 +1,234 @@
+From 1e2b7f7c00fbded9e9ebb83b10ce302155ba444f Mon Sep 17 00:00:00 2001
+Message-ID: <1e2b7f7c00fbded9e9ebb83b10ce302155ba444f.1737052666.git.sam@gentoo.org>
+In-Reply-To: <1993383ddf67e296334c7916d6afc699ee6300c7.1737052666.git.sam@gentoo.org>
+References: <1993383ddf67e296334c7916d6afc699ee6300c7.1737052666.git.sam@gentoo.org>
+From: Wim Taymans <wtaymans@redhat.com>
+Date: Tue, 26 Nov 2024 17:45:41 +0100
+Subject: [PATCH 4/8] gst: add rate control to the sink
+
+Track the elapsed time between buffers and try to keep the buffer fill
+level constant by changing the rate of the stream.
+
+See #4374
+---
+ src/gst/gstpipewiresink.c | 76 ++++++++++++++++++++++++++++++++++---
+ src/gst/gstpipewiresink.h | 4 ++
+ src/gst/gstpipewirestream.c | 1 +
+ src/gst/gstpipewirestream.h | 8 ++++
+ src/gst/meson.build | 2 +-
+ 5 files changed, 84 insertions(+), 7 deletions(-)
+
+diff --git a/src/gst/gstpipewiresink.c b/src/gst/gstpipewiresink.c
+index d79ceaa66..33f2322e9 100644
+--- a/src/gst/gstpipewiresink.c
++++ b/src/gst/gstpipewiresink.c
+@@ -26,6 +26,7 @@
+
+ #include <spa/pod/builder.h>
+ #include <spa/utils/result.h>
++#include <spa/utils/dll.h>
+
+ #include <gst/video/video.h>
+
+@@ -481,14 +482,13 @@ static void
+ do_send_buffer (GstPipeWireSink *pwsink, GstBuffer *buffer)
+ {
+ GstPipeWirePoolData *data;
++ GstPipeWireStream *stream = pwsink->stream;
+ gboolean res;
+ guint i;
+ struct spa_buffer *b;
+
+ data = gst_pipewire_pool_get_data(buffer);
+
+- GST_LOG_OBJECT (pwsink, "queue buffer %p, pw_buffer %p", buffer, data->b);
+-
+ b = data->b->buffer;
+
+ if (data->header) {
+@@ -508,12 +508,15 @@ do_send_buffer (GstPipeWireSink *pwsink, GstBuffer *buffer)
+ data->crop->region.size.height = meta->width;
+ }
+ }
++ data->b->size = 0;
+ for (i = 0; i < b->n_datas; i++) {
+ struct spa_data *d = &b->datas[i];
+ GstMemory *mem = gst_buffer_peek_memory (buffer, i);
+ d->chunk->offset = mem->offset;
+ d->chunk->size = mem->size;
+- d->chunk->stride = pwsink->stream->pool->video_info.stride[i];
++ d->chunk->stride = stream->pool->video_info.stride[i];
++
++ data->b->size += mem->size / 4;
+ }
+
+ GstVideoMeta *meta = gst_buffer_get_video_meta (buffer);
+@@ -532,9 +535,50 @@ do_send_buffer (GstPipeWireSink *pwsink, GstBuffer *buffer)
+ }
+ }
+
+- if ((res = pw_stream_queue_buffer (pwsink->stream->pwstream, data->b)) < 0) {
++ if ((res = pw_stream_queue_buffer (stream->pwstream, data->b)) < 0) {
+ g_warning ("can't send buffer %s", spa_strerror(res));
+ }
++
++ if (pwsink->rate_match) {
++ double err, corr;
++ struct pw_time ts;
++ guint64 queued, now, elapsed, target;
++
++ pw_stream_get_time_n(stream->pwstream, &ts, sizeof(ts));
++ now = pw_stream_get_nsec(stream->pwstream);
++ if (ts.now != 0)
++ elapsed = gst_util_uint64_scale_int (now - ts.now, ts.rate.denom, GST_SECOND * ts.rate.num);
++ else
++ elapsed = 0;
++
++ queued = ts.queued - ts.size;
++ target = 2 * elapsed;
++ err = ((gint64)queued - ((gint64)target));
++
++ corr = spa_dll_update(&stream->dll, SPA_CLAMPD(err, -128.0, 128.0));
++
++ stream->err_wdw = (double)ts.rate.denom/ts.size;
++
++ double avg = (stream->err_avg * stream->err_wdw + (err - stream->err_avg)) / (stream->err_wdw + 1.0);
++ stream->err_var = (stream->err_var * stream->err_wdw +
++ (err - stream->err_avg) * (err - avg)) / (stream->err_wdw + 1.0);
++ stream->err_avg = avg;
++
++ if (stream->last_ts == 0 || stream->last_ts + SPA_NSEC_PER_SEC < now) {
++ stream->last_ts = now;
++ spa_dll_set_bw(&stream->dll, SPA_CLAMPD(fabs(stream->err_avg) / sqrt(fabs(stream->err_var)), 0.001, SPA_DLL_BW_MAX),
++ ts.size, ts.rate.denom);
++ GST_INFO_OBJECT (pwsink, "queue buffer %p, pw_buffer %p q:%"PRIi64"/%"PRIi64" e:%"PRIu64
++ " err:%+03f corr:%f %f %f %f",
++ buffer, data->b, ts.queued, ts.size, elapsed, err, corr,
++ stream->err_avg, stream->err_var, stream->dll.bw);
++ }
++
++ if (pwsink->match) {
++ pwsink->match->rate = corr;
++ SPA_FLAG_UPDATE(pwsink->match->flags, SPA_IO_RATE_MATCH_FLAG_ACTIVE, true);
++ }
++ }
+ }
+
+
+@@ -576,6 +620,18 @@ on_state_changed (void *data, enum pw_stream_state old, enum pw_stream_state sta
+ pw_thread_loop_signal (pwsink->stream->core->loop, FALSE);
+ }
+
++static void
++on_io_changed (void *obj, uint32_t id, void *data, uint32_t size)
++{
++ GstPipeWireSink *pwsink = obj;
++
++ switch (id) {
++ case SPA_IO_RateMatch:
++ pwsink->match = data;
++ break;
++ }
++}
++
+ static void
+ on_param_changed (void *data, uint32_t id, const struct spa_pod *param)
+ {
+@@ -613,9 +669,16 @@ gst_pipewire_sink_setcaps (GstBaseSink * bsink, GstCaps * caps)
+ pwsink = GST_PIPEWIRE_SINK (bsink);
+
+ s = gst_caps_get_structure (caps, 0);
+- rate = 0;
+- if (gst_structure_has_name (s, "audio/x-raw"))
++ if (gst_structure_has_name (s, "audio/x-raw")) {
+ gst_structure_get_int (s, "rate", &rate);
++ pwsink->rate = rate;
++ pwsink->rate_match = true;
++ } else {
++ pwsink->rate = rate = 0;
++ pwsink->rate_match = false;
++ }
++
++ spa_dll_set_bw(&pwsink->stream->dll, SPA_DLL_BW_MIN, 4096, rate);
+
+ possible = gst_caps_to_format_all (caps);
+
+@@ -791,6 +854,7 @@ not_negotiated:
+ static const struct pw_stream_events stream_events = {
+ PW_VERSION_STREAM_EVENTS,
+ .state_changed = on_state_changed,
++ .io_changed = on_io_changed,
+ .param_changed = on_param_changed,
+ .add_buffer = on_add_buffer,
+ .remove_buffer = on_remove_buffer,
+diff --git a/src/gst/gstpipewiresink.h b/src/gst/gstpipewiresink.h
+index 74e6667e6..33d7b5b4f 100644
+--- a/src/gst/gstpipewiresink.h
++++ b/src/gst/gstpipewiresink.h
+@@ -50,8 +50,12 @@ struct _GstPipeWireSink {
+
+ /* video state */
+ gboolean negotiated;
++ gboolean rate_match;
++ gint rate;
+
+ GstPipeWireSinkMode mode;
++
++ struct spa_io_rate_match *match;
+ };
+
+ GType gst_pipewire_sink_mode_get_type (void);
+diff --git a/src/gst/gstpipewirestream.c b/src/gst/gstpipewirestream.c
+index bf7641548..68cb9be21 100644
+--- a/src/gst/gstpipewirestream.c
++++ b/src/gst/gstpipewirestream.c
+@@ -19,6 +19,7 @@ gst_pipewire_stream_init (GstPipeWireStream * self)
+ self->fd = -1;
+ self->client_name = g_strdup (pw_get_client_name());
+ self->pool = gst_pipewire_pool_new (self);
++ spa_dll_init(&self->dll);
+ }
+
+ static void
+diff --git a/src/gst/gstpipewirestream.h b/src/gst/gstpipewirestream.h
+index ff8c8e2e6..a301375c7 100644
+--- a/src/gst/gstpipewirestream.h
++++ b/src/gst/gstpipewirestream.h
+@@ -11,6 +11,7 @@
+ #include "gstpipewirecore.h"
+
+ #include <gst/gst.h>
++#include <spa/utils/dll.h>
+ #include <pipewire/pipewire.h>
+
+ G_BEGIN_DECLS
+@@ -29,6 +30,13 @@ struct _GstPipeWireStream {
+ GstPipeWirePool *pool;
+ GstClock *clock;
+
++ guint64 position;
++ struct spa_dll dll;
++ double err_avg, err_var, err_wdw;
++ guint64 last_ts;
++ guint64 base_buffer_ts;
++ guint64 base_ts;
++
+ /* the actual pw stream */
+ struct pw_stream *pwstream;
+ struct spa_hook pwstream_listener;
+diff --git a/src/gst/meson.build b/src/gst/meson.build
+index ba1f6d558..1e39bcf89 100644
+--- a/src/gst/meson.build
++++ b/src/gst/meson.build
+@@ -27,7 +27,7 @@ pipewire_gst_headers = [
+ pipewire_gst = shared_library('gstpipewire',
+ pipewire_gst_sources,
+ include_directories : [ configinc ],
+- dependencies : [ spa_dep, gst_dep, pipewire_dep ],
++ dependencies : [ spa_dep, gst_dep, pipewire_dep, mathlib ],
+ install : true,
+ install_dir : '@0@/gstreamer-1.0'.format(get_option('libdir')),
+ )
+--
+2.48.0
+
diff --git a/media-video/pipewire/files/1.2.7/0005-gst-add-slave-method-property.patch b/media-video/pipewire/files/1.2.7/0005-gst-add-slave-method-property.patch
new file mode 100644
index 000000000000..74df92bbdfcf
--- /dev/null
+++ b/media-video/pipewire/files/1.2.7/0005-gst-add-slave-method-property.patch
@@ -0,0 +1,259 @@
+From 91e26d6011bd194deffb5765f9b3306fb92738d9 Mon Sep 17 00:00:00 2001
+Message-ID: <91e26d6011bd194deffb5765f9b3306fb92738d9.1737052666.git.sam@gentoo.org>
+In-Reply-To: <1993383ddf67e296334c7916d6afc699ee6300c7.1737052666.git.sam@gentoo.org>
+References: <1993383ddf67e296334c7916d6afc699ee6300c7.1737052666.git.sam@gentoo.org>
+From: Wim Taymans <wtaymans@redhat.com>
+Date: Tue, 3 Dec 2024 11:54:52 +0100
+Subject: [PATCH 5/8] gst: add slave-method property
+
+Set the slave-method to none by default to disable the resampler.
+
+Fixes #4374
+---
+ src/gst/gstpipewiresink.c | 141 +++++++++++++++++++++++++++-----------
+ src/gst/gstpipewiresink.h | 21 +++++-
+ 2 files changed, 120 insertions(+), 42 deletions(-)
+
+diff --git a/src/gst/gstpipewiresink.c b/src/gst/gstpipewiresink.c
+index 33f2322e9..bf1b427f0 100644
+--- a/src/gst/gstpipewiresink.c
++++ b/src/gst/gstpipewiresink.c
+@@ -37,6 +37,7 @@ GST_DEBUG_CATEGORY_STATIC (pipewire_sink_debug);
+ #define GST_CAT_DEFAULT pipewire_sink_debug
+
+ #define DEFAULT_PROP_MODE GST_PIPEWIRE_SINK_MODE_DEFAULT
++#define DEFAULT_PROP_SLAVE_METHOD GST_PIPEWIRE_SINK_SLAVE_METHOD_NONE
+
+ #define MIN_BUFFERS 8u
+
+@@ -49,7 +50,8 @@ enum
+ PROP_CLIENT_PROPERTIES,
+ PROP_STREAM_PROPERTIES,
+ PROP_MODE,
+- PROP_FD
++ PROP_FD,
++ PROP_SLAVE_METHOD
+ };
+
+ GType
+@@ -72,6 +74,26 @@ gst_pipewire_sink_mode_get_type (void)
+ return (GType) mode_type;
+ }
+
++GType
++gst_pipewire_sink_slave_method_get_type (void)
++{
++ static gsize method_type = 0;
++ static const GEnumValue method[] = {
++ {GST_PIPEWIRE_SINK_SLAVE_METHOD_NONE, "GST_PIPEWIRE_SINK_SLAVE_METHOD_NONE", "none"},
++ {GST_PIPEWIRE_SINK_SLAVE_METHOD_RESAMPLE, "GST_PIPEWIRE_SINK_SLAVE_METHOD_RESAMPLE", "resample"},
++ {0, NULL, NULL},
++ };
++
++ if (g_once_init_enter (&method_type)) {
++ GType tmp =
++ g_enum_register_static ("GstPipeWireSinkSlaveMethod", method);
++ g_once_init_leave (&method_type, tmp);
++ }
++
++ return (GType) method_type;
++}
++
++
+
+ static GstStaticPadTemplate gst_pipewire_sink_template =
+ GST_STATIC_PAD_TEMPLATE ("sink",
+@@ -225,6 +247,17 @@ gst_pipewire_sink_class_init (GstPipeWireSinkClass * klass)
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+
++ g_object_class_install_property (gobject_class,
++ PROP_SLAVE_METHOD,
++ g_param_spec_enum ("slave-method",
++ "Slave Method",
++ "Algorithm used to match the rate of the masterclock",
++ GST_TYPE_PIPEWIRE_SINK_SLAVE_METHOD,
++ DEFAULT_PROP_SLAVE_METHOD,
++ G_PARAM_READWRITE |
++ G_PARAM_STATIC_STRINGS));
++
++
+ gstelement_class->provide_clock = gst_pipewire_sink_provide_clock;
+ gstelement_class->change_state = gst_pipewire_sink_change_state;
+
+@@ -408,6 +441,10 @@ gst_pipewire_sink_set_property (GObject * object, guint prop_id,
+ pwsink->stream->fd = g_value_get_int (value);
+ break;
+
++ case PROP_SLAVE_METHOD:
++ pwsink->slave_method = g_value_get_enum (value);
++ break;
++
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+@@ -449,12 +486,69 @@ gst_pipewire_sink_get_property (GObject * object, guint prop_id,
+ g_value_set_int (value, pwsink->stream->fd);
+ break;
+
++ case PROP_SLAVE_METHOD:
++ g_value_set_enum (value, pwsink->slave_method);
++ break;
++
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+ }
+
++static void rate_match_resample(GstPipeWireSink *pwsink)
++{
++ GstPipeWireStream *stream = pwsink->stream;
++ double err, corr;
++ struct pw_time ts;
++ guint64 queued, now, elapsed, target;
++
++ if (!pwsink->rate_match)
++ return;
++
++ pw_stream_get_time_n(stream->pwstream, &ts, sizeof(ts));
++ now = pw_stream_get_nsec(stream->pwstream);
++ if (ts.now != 0)
++ elapsed = gst_util_uint64_scale_int (now - ts.now, ts.rate.denom, GST_SECOND * ts.rate.num);
++ else
++ elapsed = 0;
++
++ queued = ts.queued - ts.size;
++ target = elapsed;
++ err = ((gint64)queued - ((gint64)target));
++
++ corr = spa_dll_update(&stream->dll, SPA_CLAMPD(err, -128.0, 128.0));
++
++ stream->err_wdw = (double)ts.rate.denom/ts.size;
++
++ double avg = (stream->err_avg * stream->err_wdw + (err - stream->err_avg)) / (stream->err_wdw + 1.0);
++ stream->err_var = (stream->err_var * stream->err_wdw +
++ (err - stream->err_avg) * (err - avg)) / (stream->err_wdw + 1.0);
++ stream->err_avg = avg;
++
++ if (stream->last_ts == 0 || stream->last_ts + SPA_NSEC_PER_SEC < now) {
++ double bw;
++
++ stream->last_ts = now;
++
++ if (stream->err_var == 0.0)
++ bw = 0.0;
++ else
++ bw = fabs(stream->err_avg) / sqrt(fabs(stream->err_var));
++
++ spa_dll_set_bw(&stream->dll, SPA_CLAMPD(bw, 0.001, SPA_DLL_BW_MAX), ts.size, ts.rate.denom);
++
++ GST_INFO_OBJECT (pwsink, "q:%"PRIi64"/%"PRIi64" e:%"PRIu64" err:%+03f corr:%f %f %f %f",
++ ts.queued, ts.size, elapsed, err, corr,
++ stream->err_avg, stream->err_var, stream->dll.bw);
++ }
++
++ if (pwsink->match) {
++ pwsink->match->rate = corr;
++ SPA_FLAG_UPDATE(pwsink->match->flags, SPA_IO_RATE_MATCH_FLAG_ACTIVE, true);
++ }
++}
++
+ static void
+ on_add_buffer (void *_data, struct pw_buffer *b)
+ {
+@@ -539,45 +633,12 @@ do_send_buffer (GstPipeWireSink *pwsink, GstBuffer *buffer)
+ g_warning ("can't send buffer %s", spa_strerror(res));
+ }
+
+- if (pwsink->rate_match) {
+- double err, corr;
+- struct pw_time ts;
+- guint64 queued, now, elapsed, target;
+-
+- pw_stream_get_time_n(stream->pwstream, &ts, sizeof(ts));
+- now = pw_stream_get_nsec(stream->pwstream);
+- if (ts.now != 0)
+- elapsed = gst_util_uint64_scale_int (now - ts.now, ts.rate.denom, GST_SECOND * ts.rate.num);
+- else
+- elapsed = 0;
+-
+- queued = ts.queued - ts.size;
+- target = 2 * elapsed;
+- err = ((gint64)queued - ((gint64)target));
+-
+- corr = spa_dll_update(&stream->dll, SPA_CLAMPD(err, -128.0, 128.0));
+-
+- stream->err_wdw = (double)ts.rate.denom/ts.size;
+-
+- double avg = (stream->err_avg * stream->err_wdw + (err - stream->err_avg)) / (stream->err_wdw + 1.0);
+- stream->err_var = (stream->err_var * stream->err_wdw +
+- (err - stream->err_avg) * (err - avg)) / (stream->err_wdw + 1.0);
+- stream->err_avg = avg;
+-
+- if (stream->last_ts == 0 || stream->last_ts + SPA_NSEC_PER_SEC < now) {
+- stream->last_ts = now;
+- spa_dll_set_bw(&stream->dll, SPA_CLAMPD(fabs(stream->err_avg) / sqrt(fabs(stream->err_var)), 0.001, SPA_DLL_BW_MAX),
+- ts.size, ts.rate.denom);
+- GST_INFO_OBJECT (pwsink, "queue buffer %p, pw_buffer %p q:%"PRIi64"/%"PRIi64" e:%"PRIu64
+- " err:%+03f corr:%f %f %f %f",
+- buffer, data->b, ts.queued, ts.size, elapsed, err, corr,
+- stream->err_avg, stream->err_var, stream->dll.bw);
+- }
+-
+- if (pwsink->match) {
+- pwsink->match->rate = corr;
+- SPA_FLAG_UPDATE(pwsink->match->flags, SPA_IO_RATE_MATCH_FLAG_ACTIVE, true);
+- }
++ switch (pwsink->slave_method) {
++ case GST_PIPEWIRE_SINK_SLAVE_METHOD_NONE:
++ break;
++ case GST_PIPEWIRE_SINK_SLAVE_METHOD_RESAMPLE:
++ rate_match_resample(pwsink);
++ break;
+ }
+ }
+
+diff --git a/src/gst/gstpipewiresink.h b/src/gst/gstpipewiresink.h
+index 33d7b5b4f..306297d0e 100644
+--- a/src/gst/gstpipewiresink.h
++++ b/src/gst/gstpipewiresink.h
+@@ -37,6 +37,22 @@ typedef enum
+
+ #define GST_TYPE_PIPEWIRE_SINK_MODE (gst_pipewire_sink_mode_get_type ())
+
++
++/**
++ * GstPipeWireSinkSlaveMethod:
++ * @GST_PIPEWIRE_SINK_SLAVE_METHOD_NONE: no clock and timestamp slaving
++ * @GST_PIPEWIRE_SINK_SLAVE_METHOD_RESAMPLE: resample audio
++ *
++ * Different clock slaving methods
++ */
++typedef enum
++{
++ GST_PIPEWIRE_SINK_SLAVE_METHOD_NONE,
++ GST_PIPEWIRE_SINK_SLAVE_METHOD_RESAMPLE,
++} GstPipeWireSinkSlaveMethod;
++
++#define GST_TYPE_PIPEWIRE_SINK_SLAVE_METHOD (gst_pipewire_sink_slave_method_get_type ())
++
+ /**
+ * GstPipeWireSink:
+ *
+@@ -53,9 +69,10 @@ struct _GstPipeWireSink {
+ gboolean rate_match;
+ gint rate;
+
+- GstPipeWireSinkMode mode;
+-
+ struct spa_io_rate_match *match;
++
++ GstPipeWireSinkMode mode;
++ GstPipeWireSinkSlaveMethod slave_method;
+ };
+
+ GType gst_pipewire_sink_mode_get_type (void);
+--
+2.48.0
+
diff --git a/media-video/pipewire/files/1.2.7/0006-spa-fix-some-param-type-info.patch b/media-video/pipewire/files/1.2.7/0006-spa-fix-some-param-type-info.patch
new file mode 100644
index 000000000000..c91ada71cf5a
--- /dev/null
+++ b/media-video/pipewire/files/1.2.7/0006-spa-fix-some-param-type-info.patch
@@ -0,0 +1,51 @@
+From e42de413e89249dca22b78f3c3d5a5c2e2e8b2f3 Mon Sep 17 00:00:00 2001
+Message-ID: <e42de413e89249dca22b78f3c3d5a5c2e2e8b2f3.1737052666.git.sam@gentoo.org>
+In-Reply-To: <1993383ddf67e296334c7916d6afc699ee6300c7.1737052666.git.sam@gentoo.org>
+References: <1993383ddf67e296334c7916d6afc699ee6300c7.1737052666.git.sam@gentoo.org>
+From: Wim Taymans <wtaymans@redhat.com>
+Date: Tue, 3 Dec 2024 12:41:07 +0100
+Subject: [PATCH 6/8] spa: fix some param type info
+
+Add an int array type and use this in the route properties.
+
+Fixes #4441
+---
+ spa/include/spa/param/param-types.h | 5 +++++
+ spa/include/spa/param/route-types.h | 4 ++--
+ 2 files changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/spa/include/spa/param/param-types.h b/spa/include/spa/param/param-types.h
+index 4bed3651d..ebb8d988b 100644
+--- a/spa/include/spa/param/param-types.h
++++ b/spa/include/spa/param/param-types.h
+@@ -55,6 +55,11 @@ static const struct spa_type_info spa_type_prop_float_array[] = {
+ { 0, 0, NULL, NULL },
+ };
+
++static const struct spa_type_info spa_type_prop_int_array[] = {
++ { SPA_PROP_START, SPA_TYPE_Int, SPA_TYPE_INFO_BASE "intArray", NULL, },
++ { 0, 0, NULL, NULL },
++};
++
+ static const struct spa_type_info spa_type_prop_channel_map[] = {
+ { SPA_PROP_START, SPA_TYPE_Id, SPA_TYPE_INFO_BASE "channelMap", spa_type_audio_channel, },
+ { 0, 0, NULL, NULL },
+diff --git a/spa/include/spa/param/route-types.h b/spa/include/spa/param/route-types.h
+index 619a9e2e8..78ced495e 100644
+--- a/spa/include/spa/param/route-types.h
++++ b/spa/include/spa/param/route-types.h
+@@ -32,9 +32,9 @@ static const struct spa_type_info spa_type_param_route[] = {
+ { SPA_PARAM_ROUTE_priority, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_ROUTE_BASE "priority", NULL, },
+ { SPA_PARAM_ROUTE_available, SPA_TYPE_Id, SPA_TYPE_INFO_PARAM_ROUTE_BASE "available", spa_type_param_availability, },
+ { SPA_PARAM_ROUTE_info, SPA_TYPE_Struct, SPA_TYPE_INFO_PARAM_ROUTE_BASE "info", NULL, },
+- { SPA_PARAM_ROUTE_profiles, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_ROUTE_BASE "profiles", NULL, },
++ { SPA_PARAM_ROUTE_profiles, SPA_TYPE_Array, SPA_TYPE_INFO_PARAM_ROUTE_BASE "profiles", spa_type_prop_int_array, },
+ { SPA_PARAM_ROUTE_props, SPA_TYPE_OBJECT_Props, SPA_TYPE_INFO_PARAM_ROUTE_BASE "props", NULL, },
+- { SPA_PARAM_ROUTE_devices, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_ROUTE_BASE "devices", NULL, },
++ { SPA_PARAM_ROUTE_devices, SPA_TYPE_Array, SPA_TYPE_INFO_PARAM_ROUTE_BASE "devices", spa_type_prop_int_array, },
+ { SPA_PARAM_ROUTE_profile, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_ROUTE_BASE "profile", NULL, },
+ { SPA_PARAM_ROUTE_save, SPA_TYPE_Bool, SPA_TYPE_INFO_PARAM_ROUTE_BASE "save", NULL, },
+ { 0, 0, NULL, NULL },
+--
+2.48.0
+
diff --git a/media-video/pipewire/files/1.2.7/0007-filter-chain-handle-0-length-IR.patch b/media-video/pipewire/files/1.2.7/0007-filter-chain-handle-0-length-IR.patch
new file mode 100644
index 000000000000..4a1c25871d4c
--- /dev/null
+++ b/media-video/pipewire/files/1.2.7/0007-filter-chain-handle-0-length-IR.patch
@@ -0,0 +1,305 @@
+From 8d9269374ddd7fc1628d9bf05c0880e82a76015d Mon Sep 17 00:00:00 2001
+Message-ID: <8d9269374ddd7fc1628d9bf05c0880e82a76015d.1737052666.git.sam@gentoo.org>
+In-Reply-To: <1993383ddf67e296334c7916d6afc699ee6300c7.1737052666.git.sam@gentoo.org>
+References: <1993383ddf67e296334c7916d6afc699ee6300c7.1737052666.git.sam@gentoo.org>
+From: Wim Taymans <wtaymans@redhat.com>
+Date: Tue, 3 Dec 2024 15:43:56 +0100
+Subject: [PATCH 7/8] filter-chain: handle 0 length IR
+
+Make sure we copy the DSP functions in the convolver before leaving the
+function because we need them to clear memory.
+
+Don't store the DSP functions in the head and tail convolvers but pass
+them from the main convolver because the convolvers might be NULL but we
+still need the DSP functions to clear memory.
+
+Fixes #4433
+---
+ src/modules/module-filter-chain/convolver.c | 96 +++++++++++----------
+ 1 file changed, 49 insertions(+), 47 deletions(-)
+
+diff --git a/src/modules/module-filter-chain/convolver.c b/src/modules/module-filter-chain/convolver.c
+index 3aa7230c0..4251c4025 100644
+--- a/src/modules/module-filter-chain/convolver.c
++++ b/src/modules/module-filter-chain/convolver.c
+@@ -11,8 +11,6 @@
+ #include <math.h>
+
+ struct convolver1 {
+- struct dsp_ops *dsp;
+-
+ int blockSize;
+ int segSize;
+ int segCount;
+@@ -76,15 +74,15 @@ static int next_power_of_two(int val)
+ return r;
+ }
+
+-static void convolver1_reset(struct convolver1 *conv)
++static void convolver1_reset(struct dsp_ops *dsp, struct convolver1 *conv)
+ {
+ int i;
+ for (i = 0; i < conv->segCount; i++)
+- fft_cpx_clear(conv->dsp, conv->segments[i], conv->fftComplexSize);
+- dsp_ops_clear(conv->dsp, conv->overlap, conv->blockSize);
+- dsp_ops_clear(conv->dsp, conv->inputBuffer, conv->segSize);
+- fft_cpx_clear(conv->dsp, conv->pre_mult, conv->fftComplexSize);
+- fft_cpx_clear(conv->dsp, conv->conv, conv->fftComplexSize);
++ fft_cpx_clear(dsp, conv->segments[i], conv->fftComplexSize);
++ dsp_ops_clear(dsp, conv->overlap, conv->blockSize);
++ dsp_ops_clear(dsp, conv->inputBuffer, conv->segSize);
++ fft_cpx_clear(dsp, conv->pre_mult, conv->fftComplexSize);
++ fft_cpx_clear(dsp, conv->conv, conv->fftComplexSize);
+ conv->inputBufferFill = 0;
+ conv->current = 0;
+ }
+@@ -107,16 +105,15 @@ static struct convolver1 *convolver1_new(struct dsp_ops *dsp, int block, const f
+ if (irlen == 0)
+ return conv;
+
+- conv->dsp = dsp;
+ conv->blockSize = next_power_of_two(block);
+ conv->segSize = 2 * conv->blockSize;
+ conv->segCount = (irlen + conv->blockSize-1) / conv->blockSize;
+ conv->fftComplexSize = (conv->segSize / 2) + 1;
+
+- conv->fft = dsp_ops_fft_new(conv->dsp, conv->segSize, true);
++ conv->fft = dsp_ops_fft_new(dsp, conv->segSize, true);
+ if (conv->fft == NULL)
+ goto error;
+- conv->ifft = dsp_ops_fft_new(conv->dsp, conv->segSize, true);
++ conv->ifft = dsp_ops_fft_new(dsp, conv->segSize, true);
+ if (conv->ifft == NULL)
+ goto error;
+
+@@ -134,18 +131,18 @@ static struct convolver1 *convolver1_new(struct dsp_ops *dsp, int block, const f
+ conv->segments[i] = fft_cpx_alloc(conv->fftComplexSize);
+ conv->segmentsIr[i] = fft_cpx_alloc(conv->fftComplexSize);
+
+- dsp_ops_copy(conv->dsp, conv->fft_buffer, &ir[i * conv->blockSize], copy);
++ dsp_ops_copy(dsp, conv->fft_buffer, &ir[i * conv->blockSize], copy);
+ if (copy < conv->segSize)
+- dsp_ops_clear(conv->dsp, conv->fft_buffer + copy, conv->segSize - copy);
++ dsp_ops_clear(dsp, conv->fft_buffer + copy, conv->segSize - copy);
+
+- dsp_ops_fft_run(conv->dsp, conv->fft, 1, conv->fft_buffer, conv->segmentsIr[i]);
++ dsp_ops_fft_run(dsp, conv->fft, 1, conv->fft_buffer, conv->segmentsIr[i]);
+ }
+ conv->pre_mult = fft_cpx_alloc(conv->fftComplexSize);
+ conv->conv = fft_cpx_alloc(conv->fftComplexSize);
+ conv->overlap = fft_alloc(conv->blockSize);
+ conv->inputBuffer = fft_alloc(conv->segSize);
+ conv->scale = 1.0f / conv->segSize;
+- convolver1_reset(conv);
++ convolver1_reset(dsp, conv);
+
+ return conv;
+ error:
+@@ -159,7 +156,7 @@ error:
+ return NULL;
+ }
+
+-static void convolver1_free(struct convolver1 *conv)
++static void convolver1_free(struct dsp_ops *dsp, struct convolver1 *conv)
+ {
+ int i;
+ for (i = 0; i < conv->segCount; i++) {
+@@ -167,9 +164,9 @@ static void convolver1_free(struct convolver1 *conv)
+ fft_cpx_free(conv->segmentsIr[i]);
+ }
+ if (conv->fft)
+- dsp_ops_fft_free(conv->dsp, conv->fft);
++ dsp_ops_fft_free(dsp, conv->fft);
+ if (conv->ifft)
+- dsp_ops_fft_free(conv->dsp, conv->ifft);
++ dsp_ops_fft_free(dsp, conv->ifft);
+ if (conv->fft_buffer)
+ fft_free(conv->fft_buffer);
+ free(conv->segments);
+@@ -181,12 +178,12 @@ static void convolver1_free(struct convolver1 *conv)
+ free(conv);
+ }
+
+-static int convolver1_run(struct convolver1 *conv, const float *input, float *output, int len)
++static int convolver1_run(struct dsp_ops *dsp, struct convolver1 *conv, const float *input, float *output, int len)
+ {
+ int i, processed = 0;
+
+ if (conv == NULL || conv->segCount == 0) {
+- dsp_ops_clear(conv->dsp, output, len);
++ dsp_ops_clear(dsp, output, len);
+ return len;
+ }
+
+@@ -194,17 +191,17 @@ static int convolver1_run(struct convolver1 *conv, const float *input, float *ou
+ const int processing = SPA_MIN(len - processed, conv->blockSize - conv->inputBufferFill);
+ const int inputBufferPos = conv->inputBufferFill;
+
+- dsp_ops_copy(conv->dsp, conv->inputBuffer + inputBufferPos, input + processed, processing);
++ dsp_ops_copy(dsp, conv->inputBuffer + inputBufferPos, input + processed, processing);
+ if (inputBufferPos == 0 && processing < conv->blockSize)
+- dsp_ops_clear(conv->dsp, conv->inputBuffer + processing, conv->blockSize - processing);
++ dsp_ops_clear(dsp, conv->inputBuffer + processing, conv->blockSize - processing);
+
+- dsp_ops_fft_run(conv->dsp, conv->fft, 1, conv->inputBuffer, conv->segments[conv->current]);
++ dsp_ops_fft_run(dsp, conv->fft, 1, conv->inputBuffer, conv->segments[conv->current]);
+
+ if (conv->segCount > 1) {
+ if (conv->inputBufferFill == 0) {
+ int indexAudio = (conv->current + 1) % conv->segCount;
+
+- dsp_ops_fft_cmul(conv->dsp, conv->fft, conv->pre_mult,
++ dsp_ops_fft_cmul(dsp, conv->fft, conv->pre_mult,
+ conv->segmentsIr[1],
+ conv->segments[indexAudio],
+ conv->fftComplexSize, conv->scale);
+@@ -212,7 +209,7 @@ static int convolver1_run(struct convolver1 *conv, const float *input, float *ou
+ for (i = 2; i < conv->segCount; i++) {
+ indexAudio = (conv->current + i) % conv->segCount;
+
+- dsp_ops_fft_cmuladd(conv->dsp, conv->fft,
++ dsp_ops_fft_cmuladd(dsp, conv->fft,
+ conv->pre_mult,
+ conv->pre_mult,
+ conv->segmentsIr[i],
+@@ -220,30 +217,30 @@ static int convolver1_run(struct convolver1 *conv, const float *input, float *ou
+ conv->fftComplexSize, conv->scale);
+ }
+ }
+- dsp_ops_fft_cmuladd(conv->dsp, conv->fft,
++ dsp_ops_fft_cmuladd(dsp, conv->fft,
+ conv->conv,
+ conv->pre_mult,
+ conv->segments[conv->current],
+ conv->segmentsIr[0],
+ conv->fftComplexSize, conv->scale);
+ } else {
+- dsp_ops_fft_cmul(conv->dsp, conv->fft,
++ dsp_ops_fft_cmul(dsp, conv->fft,
+ conv->conv,
+ conv->segments[conv->current],
+ conv->segmentsIr[0],
+ conv->fftComplexSize, conv->scale);
+ }
+
+- dsp_ops_fft_run(conv->dsp, conv->ifft, -1, conv->conv, conv->fft_buffer);
++ dsp_ops_fft_run(dsp, conv->ifft, -1, conv->conv, conv->fft_buffer);
+
+- dsp_ops_sum(conv->dsp, output + processed, conv->fft_buffer + inputBufferPos,
++ dsp_ops_sum(dsp, output + processed, conv->fft_buffer + inputBufferPos,
+ conv->overlap + inputBufferPos, processing);
+
+ conv->inputBufferFill += processing;
+ if (conv->inputBufferFill == conv->blockSize) {
+ conv->inputBufferFill = 0;
+
+- dsp_ops_copy(conv->dsp, conv->overlap, conv->fft_buffer + conv->blockSize, conv->blockSize);
++ dsp_ops_copy(dsp, conv->overlap, conv->fft_buffer + conv->blockSize, conv->blockSize);
+
+ conv->current = (conv->current > 0) ? (conv->current - 1) : (conv->segCount - 1);
+ }
+@@ -272,17 +269,18 @@ struct convolver
+
+ void convolver_reset(struct convolver *conv)
+ {
++ struct dsp_ops *dsp = conv->dsp;
+ if (conv->headConvolver)
+- convolver1_reset(conv->headConvolver);
++ convolver1_reset(dsp, conv->headConvolver);
+ if (conv->tailConvolver0) {
+- convolver1_reset(conv->tailConvolver0);
+- dsp_ops_clear(conv->dsp, conv->tailOutput0, conv->tailBlockSize);
+- dsp_ops_clear(conv->dsp, conv->tailPrecalculated0, conv->tailBlockSize);
++ convolver1_reset(dsp, conv->tailConvolver0);
++ dsp_ops_clear(dsp, conv->tailOutput0, conv->tailBlockSize);
++ dsp_ops_clear(dsp, conv->tailPrecalculated0, conv->tailBlockSize);
+ }
+ if (conv->tailConvolver) {
+- convolver1_reset(conv->tailConvolver);
+- dsp_ops_clear(conv->dsp, conv->tailOutput, conv->tailBlockSize);
+- dsp_ops_clear(conv->dsp, conv->tailPrecalculated, conv->tailBlockSize);
++ convolver1_reset(dsp, conv->tailConvolver);
++ dsp_ops_clear(dsp, conv->tailOutput, conv->tailBlockSize);
++ dsp_ops_clear(dsp, conv->tailPrecalculated, conv->tailBlockSize);
+ }
+ conv->tailInputFill = 0;
+ conv->precalculatedPos = 0;
+@@ -307,10 +305,11 @@ struct convolver *convolver_new(struct dsp_ops *dsp_ops, int head_block, int tai
+ if (conv == NULL)
+ return NULL;
+
++ conv->dsp = dsp_ops;
++
+ if (irlen == 0)
+ return conv;
+
+- conv->dsp = dsp_ops;
+ conv->headBlockSize = next_power_of_two(head_block);
+ conv->tailBlockSize = next_power_of_two(tail_block);
+
+@@ -341,12 +340,13 @@ struct convolver *convolver_new(struct dsp_ops *dsp_ops, int head_block, int tai
+
+ void convolver_free(struct convolver *conv)
+ {
++ struct dsp_ops *dsp = conv->dsp;
+ if (conv->headConvolver)
+- convolver1_free(conv->headConvolver);
++ convolver1_free(dsp, conv->headConvolver);
+ if (conv->tailConvolver0)
+- convolver1_free(conv->tailConvolver0);
++ convolver1_free(dsp, conv->tailConvolver0);
+ if (conv->tailConvolver)
+- convolver1_free(conv->tailConvolver);
++ convolver1_free(dsp, conv->tailConvolver);
+ fft_free(conv->tailOutput0);
+ fft_free(conv->tailPrecalculated0);
+ fft_free(conv->tailOutput);
+@@ -357,7 +357,9 @@ void convolver_free(struct convolver *conv)
+
+ int convolver_run(struct convolver *conv, const float *input, float *output, int length)
+ {
+- convolver1_run(conv->headConvolver, input, output, length);
++ struct dsp_ops *dsp = conv->dsp;
++
++ convolver1_run(dsp, conv->headConvolver, input, output, length);
+
+ if (conv->tailInput) {
+ int processed = 0;
+@@ -367,21 +369,21 @@ int convolver_run(struct convolver *conv, const float *input, float *output, int
+ int processing = SPA_MIN(remaining, conv->headBlockSize - (conv->tailInputFill % conv->headBlockSize));
+
+ if (conv->tailPrecalculated0)
+- dsp_ops_sum(conv->dsp, &output[processed], &output[processed],
++ dsp_ops_sum(dsp, &output[processed], &output[processed],
+ &conv->tailPrecalculated0[conv->precalculatedPos],
+ processing);
+ if (conv->tailPrecalculated)
+- dsp_ops_sum(conv->dsp, &output[processed], &output[processed],
++ dsp_ops_sum(dsp, &output[processed], &output[processed],
+ &conv->tailPrecalculated[conv->precalculatedPos],
+ processing);
+ conv->precalculatedPos += processing;
+
+- dsp_ops_copy(conv->dsp, conv->tailInput + conv->tailInputFill, input + processed, processing);
++ dsp_ops_copy(dsp, conv->tailInput + conv->tailInputFill, input + processed, processing);
+ conv->tailInputFill += processing;
+
+ if (conv->tailPrecalculated0 && (conv->tailInputFill % conv->headBlockSize == 0)) {
+ int blockOffset = conv->tailInputFill - conv->headBlockSize;
+- convolver1_run(conv->tailConvolver0,
++ convolver1_run(dsp, conv->tailConvolver0,
+ conv->tailInput + blockOffset,
+ conv->tailOutput0 + blockOffset,
+ conv->headBlockSize);
+@@ -392,7 +394,7 @@ int convolver_run(struct convolver *conv, const float *input, float *output, int
+ if (conv->tailPrecalculated &&
+ conv->tailInputFill == conv->tailBlockSize) {
+ SPA_SWAP(conv->tailPrecalculated, conv->tailOutput);
+- convolver1_run(conv->tailConvolver, conv->tailInput,
++ convolver1_run(dsp, conv->tailConvolver, conv->tailInput,
+ conv->tailOutput, conv->tailBlockSize);
+ }
+ if (conv->tailInputFill == conv->tailBlockSize) {
+--
+2.48.0
+
diff --git a/media-video/pipewire/files/1.2.7/0008-spa-initialize-all-fields-explicitly.patch b/media-video/pipewire/files/1.2.7/0008-spa-initialize-all-fields-explicitly.patch
new file mode 100644
index 000000000000..24b99891cee2
--- /dev/null
+++ b/media-video/pipewire/files/1.2.7/0008-spa-initialize-all-fields-explicitly.patch
@@ -0,0 +1,47 @@
+From 223569dc4a5778bf74f6d072b10e71912f8b5418 Mon Sep 17 00:00:00 2001
+Message-ID: <223569dc4a5778bf74f6d072b10e71912f8b5418.1737052666.git.sam@gentoo.org>
+In-Reply-To: <1993383ddf67e296334c7916d6afc699ee6300c7.1737052666.git.sam@gentoo.org>
+References: <1993383ddf67e296334c7916d6afc699ee6300c7.1737052666.git.sam@gentoo.org>
+From: Wim Taymans <wtaymans@redhat.com>
+Date: Mon, 30 Sep 2024 10:06:30 +0200
+Subject: [PATCH 8/8] spa: initialize all fields explicitly
+
+Patch by Petar Popovic
+
+Fixes #4325
+
+(cherry picked from commit 0ca64277b317b4836beccaa3248ab9055526811c)
+---
+ spa/include/spa/pod/builder.h | 2 +-
+ spa/include/spa/pod/parser.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/spa/include/spa/pod/builder.h b/spa/include/spa/pod/builder.h
+index 0564d94ea..6d3e9d54a 100644
+--- a/spa/include/spa/pod/builder.h
++++ b/spa/include/spa/pod/builder.h
+@@ -49,7 +49,7 @@ struct spa_pod_builder {
+ struct spa_callbacks callbacks;
+ };
+
+-#define SPA_POD_BUILDER_INIT(buffer,size) ((struct spa_pod_builder){ (buffer), (size), 0, {0}, {0} })
++#define SPA_POD_BUILDER_INIT(buffer,size) ((struct spa_pod_builder){ (buffer), (size), 0, {0,0,NULL},{NULL,NULL}})
+
+ static inline void
+ spa_pod_builder_get_state(struct spa_pod_builder *builder, struct spa_pod_builder_state *state)
+diff --git a/spa/include/spa/pod/parser.h b/spa/include/spa/pod/parser.h
+index 083f91171..4c1e72acc 100644
+--- a/spa/include/spa/pod/parser.h
++++ b/spa/include/spa/pod/parser.h
+@@ -33,7 +33,7 @@ struct spa_pod_parser {
+ struct spa_pod_parser_state state;
+ };
+
+-#define SPA_POD_PARSER_INIT(buffer,size) ((struct spa_pod_parser){ (buffer), (size), 0, {0} })
++#define SPA_POD_PARSER_INIT(buffer,size) ((struct spa_pod_parser){ (buffer), (size), 0, {0,0,NULL}})
+
+ static inline void spa_pod_parser_init(struct spa_pod_parser *parser,
+ const void *data, uint32_t size)
+--
+2.48.0
+
diff --git a/media-video/pipewire/pipewire-1.2.7-r1.ebuild b/media-video/pipewire/pipewire-1.2.7-r1.ebuild
new file mode 100644
index 000000000000..36f4674429fd
--- /dev/null
+++ b/media-video/pipewire/pipewire-1.2.7-r1.ebuild
@@ -0,0 +1,527 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# 1. Please regularly check (even at the point of bumping) Fedora's packaging
+# for needed backports at https://src.fedoraproject.org/rpms/pipewire/tree/rawhide.
+#
+# 2. Upstream also sometimes amend release notes for the previous release to mention
+# needed patches, e.g. https://gitlab.freedesktop.org/pipewire/pipewire/-/tags/0.3.55#distros
+#
+# 3. Keep an eye on git master (for both PipeWire and WirePlumber) as things
+# continue to move quickly. It's not uncommon for fixes to be made shortly
+# after releases.
+
+# TODO: Maybe get upstream to produce `meson dist` tarballs:
+# - https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3663
+# - https://gitlab.freedesktop.org/pipewire/pipewire/-/merge_requests/1788
+#
+# Generate using https://github.com/thesamesam/sam-gentoo-scripts/blob/main/niche/generate-pipewire-docs
+# Set to 1 if prebuilt, 0 if not
+# (the construct below is to allow overriding from env for script)
+: ${PIPEWIRE_DOCS_PREBUILT:=1}
+
+PIPEWIRE_DOCS_PREBUILT_DEV=sam
+PIPEWIRE_DOCS_VERSION="$(ver_cut 1-2).0"
+# Default to generating docs (inc. man pages) if no prebuilt; overridden later
+PIPEWIRE_DOCS_USEFLAG="+man"
+PYTHON_COMPAT=( python3_{10..13} )
+inherit meson-multilib optfeature prefix python-any-r1 systemd tmpfiles udev
+
+if [[ ${PV} == 9999 ]]; then
+ PIPEWIRE_DOCS_PREBUILT=0
+ EGIT_REPO_URI="https://gitlab.freedesktop.org/${PN}/${PN}.git"
+ inherit git-r3
+else
+ if [[ ${PV} == *_p* ]] ; then
+ MY_COMMIT=""
+ SRC_URI="https://gitlab.freedesktop.org/pipewire/pipewire/-/archive/${MY_COMMIT}/pipewire-${MY_COMMIT}.tar.bz2 -> ${P}.tar.bz2"
+ S="${WORKDIR}"/${PN}-${MY_COMMIT}
+ else
+ SRC_URI="https://gitlab.freedesktop.org/${PN}/${PN}/-/archive/${PV}/${P}.tar.bz2"
+ fi
+
+ if [[ ${PIPEWIRE_DOCS_PREBUILT} == 1 ]] ; then
+ SRC_URI+=" !man? ( https://dev.gentoo.org/~${PIPEWIRE_DOCS_PREBUILT_DEV}/distfiles/${CATEGORY}/${PN}/${PN}-${PIPEWIRE_DOCS_VERSION}-docs.tar.xz )"
+ PIPEWIRE_DOCS_USEFLAG="man"
+ fi
+
+ KEYWORDS="~amd64 ~arm ~arm64 ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
+fi
+
+DESCRIPTION="Multimedia processing graphs"
+HOMEPAGE="https://pipewire.org/"
+
+LICENSE="MIT LGPL-2.1+ GPL-2"
+# ABI was broken in 0.3.42 for https://gitlab.freedesktop.org/pipewire/wireplumber/-/issues/49
+SLOT="0/0.4"
+IUSE="${PIPEWIRE_DOCS_USEFLAG} bluetooth elogind dbus doc echo-cancel extra ffmpeg flatpak gstreamer gsettings ieee1394 jack-client jack-sdk liblc3 lv2"
+IUSE+=" modemmanager pipewire-alsa readline roc selinux sound-server ssl system-service systemd test v4l X zeroconf"
+
+# Once replacing system JACK libraries is possible, it's likely that
+# jack-client IUSE will need blocking to avoid users accidentally
+# configuring their systems to send PW sink output to the emulated
+# JACK's sink - doing so is likely to yield no audio, cause a CPU
+# cycles consuming loop (and may even cause GUI crashes)!
+
+# - TODO: There should be "sound-server? ( || ( alsa bluetooth ) )" here, but ALSA is always enabled
+# - TODO: Pulseaudio alsa plugin performs runtime check that pulseaudio server connection will work
+# which provides adequate guarantee that alsa-lib will be able to provide audio services.
+# If that works, pulseaudio defaults are loaded into alsa-lib runtime replacing default PCM and CTL.
+# When pipewire-alsa will be able to perform similar check, pipewire-alsa can be enabled unconditionally.
+# - ffmpeg is only used for pw-cat. We don't build the spa plugin which receives barely any activity.
+REQUIRED_USE="
+ ffmpeg? ( extra )
+ bluetooth? ( dbus )
+ jack-sdk? ( !jack-client )
+ modemmanager? ( bluetooth )
+ system-service? ( systemd )
+ !sound-server? ( !pipewire-alsa )
+ jack-client? ( dbus )
+"
+
+RESTRICT="!test? ( test )"
+
+BDEPEND="
+ >=dev-build/meson-0.59
+ virtual/pkgconfig
+ dbus? ( dev-util/gdbus-codegen )
+ doc? (
+ ${PYTHON_DEPS}
+ >=app-text/doxygen-1.9.8
+ media-gfx/graphviz
+ )
+ man? (
+ ${PYTHON_DEPS}
+ >=app-text/doxygen-1.9.8
+ )
+"
+# * While udev could technically be optional, it's needed for a number of options,
+# and not really worth it, bug #877769.
+#
+# * Supports both legacy webrtc-audio-processing:0 and new webrtc-audio-processing:1.
+# We depend on :1 as it prefers that, it's not legacy, and to avoid automagic.
+#
+# * Older Doxygen (<1.9.8) may work but inferior output is created:
+# - https://gitlab.freedesktop.org/pipewire/pipewire/-/merge_requests/1778
+# - https://github.com/doxygen/doxygen/issues/9254
+RDEPEND="
+ acct-group/audio
+ acct-group/pipewire
+ media-libs/alsa-lib[${MULTILIB_USEDEP}]
+ sys-libs/ncurses:=[unicode(+)]
+ virtual/libintl[${MULTILIB_USEDEP}]
+ virtual/libudev[${MULTILIB_USEDEP}]
+ bluetooth? (
+ dev-libs/glib
+ media-libs/fdk-aac
+ media-libs/libldac
+ media-libs/libfreeaptx
+ media-libs/opus
+ media-libs/sbc
+ >=net-wireless/bluez-4.101:=
+ virtual/libusb:1
+ )
+ elogind? ( sys-auth/elogind )
+ dbus? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ echo-cancel? ( >=media-libs/webrtc-audio-processing-1.2:1 )
+ extra? ( >=media-libs/libsndfile-1.0.20 )
+ ffmpeg? ( media-video/ffmpeg:= )
+ flatpak? ( dev-libs/glib )
+ gstreamer? (
+ >=dev-libs/glib-2.32.0:2
+ >=media-libs/gstreamer-1.10.0:1.0
+ media-libs/gst-plugins-base:1.0
+ )
+ gsettings? ( >=dev-libs/glib-2.26.0:2 )
+ ieee1394? ( media-libs/libffado[${MULTILIB_USEDEP}] )
+ jack-client? ( >=media-sound/jack2-1.9.10:2[dbus] )
+ jack-sdk? (
+ !media-sound/jack-audio-connection-kit
+ !media-sound/jack2
+ )
+ liblc3? ( media-sound/liblc3 )
+ lv2? ( media-libs/lilv )
+ modemmanager? ( >=net-misc/modemmanager-1.10.0 )
+ pipewire-alsa? ( >=media-libs/alsa-lib-1.1.7[${MULTILIB_USEDEP}] )
+ sound-server? ( !media-sound/pulseaudio-daemon )
+ roc? ( >=media-libs/roc-toolkit-0.3.0:= )
+ readline? ( sys-libs/readline:= )
+ selinux? ( sys-libs/libselinux )
+ ssl? ( dev-libs/openssl:= )
+ systemd? ( sys-apps/systemd )
+ system-service? ( acct-user/pipewire )
+ v4l? ( media-libs/libv4l )
+ X? (
+ media-libs/libcanberra
+ x11-libs/libX11
+ x11-libs/libXfixes
+ )
+ zeroconf? ( net-dns/avahi )
+"
+
+DEPEND="${RDEPEND}"
+
+PDEPEND=">=media-video/wireplumber-0.5.2"
+
+# Present RDEPEND that are currently always disabled due to the PW
+# code using them being required to be disabled by Gentoo guidelines
+# (i.e. developer binaries not meant for users) and unready code
+# media-libs/libsdl2
+# >=media-libs/vulkan-loader-1.1.69
+#
+# Ditto for DEPEND
+# >=dev-util/vulkan-headers-1.1.69
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-0.3.25-enable-failed-mlock-warning.patch
+)
+
+pkg_setup() {
+ if use doc || use man ; then
+ python-any-r1_pkg_setup
+ fi
+}
+
+src_prepare() {
+ default
+
+ # Used for upstream backports
+ [[ -d "${FILESDIR}"/${PV} ]] && eapply "${FILESDIR}"/${PV}
+}
+
+multilib_src_configure() {
+ local logind=disabled
+ if multilib_is_native_abi ; then
+ if use systemd ; then
+ logind=enabled
+ elif use elogind ; then
+ logind=enabled
+ fi
+ fi
+
+ local emesonargs=(
+ -Ddocdir="${EPREFIX}"/usr/share/doc/${PF}
+
+ $(meson_feature dbus)
+ $(meson_native_use_feature zeroconf avahi)
+ $(meson_native_use_feature doc docs)
+ $(meson_native_use_feature man)
+ $(meson_native_enabled examples) # TODO: Figure out if this is still important now that media-session gone
+ $(meson_feature test tests)
+ -Dinstalled_tests=disabled # Matches upstream; Gentoo never installs tests
+ $(meson_feature ieee1394 libffado)
+ $(meson_native_use_feature gstreamer)
+ $(meson_native_use_feature gstreamer gstreamer-device-provider)
+ $(meson_native_use_feature gsettings)
+ $(meson_native_use_feature systemd)
+ -Dlogind=${logind}
+ -Dlogind-provider=$(usex systemd 'libsystemd' 'libelogind')
+
+ $(meson_native_use_feature system-service systemd-system-service)
+ -Dsystemd-system-unit-dir="$(systemd_get_systemunitdir)"
+ -Dsystemd-user-unit-dir="$(systemd_get_userunitdir)"
+
+ $(meson_native_use_feature systemd systemd-user-service)
+ $(meson_feature pipewire-alsa) # Allows integrating ALSA apps into PW graph
+ $(meson_feature selinux)
+ -Dspa-plugins=enabled
+ -Dalsa=enabled # Allows using kernel ALSA for sound I/O (NOTE: media-session is gone so IUSE=alsa/spa_alsa/alsa-backend might be possible)
+ -Dcompress-offload=disabled # TODO: tinycompress unpackaged
+ -Daudiomixer=enabled # Matches upstream
+ -Daudioconvert=enabled # Matches upstream
+ $(meson_native_use_feature bluetooth bluez5)
+ $(meson_native_use_feature bluetooth bluez5-backend-hsp-native)
+ $(meson_native_use_feature bluetooth bluez5-backend-hfp-native)
+ # https://gitlab.freedesktop.org/pipewire/pipewire/-/merge_requests/1379
+ $(meson_native_use_feature modemmanager bluez5-backend-native-mm)
+ $(meson_native_use_feature bluetooth bluez5-backend-ofono)
+ $(meson_native_use_feature bluetooth bluez5-backend-hsphfpd)
+ $(meson_native_use_feature bluetooth bluez5-codec-aac)
+ $(meson_native_use_feature bluetooth bluez5-codec-aptx)
+ $(meson_native_use_feature bluetooth bluez5-codec-ldac)
+ $(meson_native_use_feature bluetooth opus)
+ $(meson_native_use_feature bluetooth bluez5-codec-opus)
+ $(meson_native_use_feature bluetooth libusb) # At least for now only used by bluez5 native (quirk detection of adapters)
+ $(meson_native_use_feature echo-cancel echo-cancel-webrtc) #807889
+ -Dcontrol=enabled # Matches upstream
+ -Daudiotestsrc=enabled # Matches upstream
+ -Dffmpeg=disabled # Disabled by upstream and no major developments to spa/plugins/ffmpeg/ since May 2020
+ $(meson_native_use_feature ffmpeg pw-cat-ffmpeg)
+ $(meson_native_use_feature flatpak)
+ -Dpipewire-jack=enabled # Allows integrating JACK apps into PW graph
+ $(meson_native_use_feature jack-client jack) # Allows PW to act as a JACK client
+ $(meson_use jack-sdk jack-devel)
+ $(usex jack-sdk "-Dlibjack-path=${EPREFIX}/usr/$(get_libdir)" '')
+ -Dsupport=enabled # Miscellaneous/common plugins, such as null sink
+ -Devl=disabled # Matches upstream
+ -Dtest=disabled # fakesink and fakesource plugins
+ -Dbluez5-codec-lc3plus=disabled # unpackaged
+ $(meson_native_use_feature liblc3 bluez5-codec-lc3)
+ $(meson_native_use_feature lv2)
+ $(meson_native_use_feature v4l v4l2)
+ -Dlibcamera=disabled # libcamera is not in Portage tree
+ $(meson_native_use_feature roc)
+ $(meson_native_use_feature readline)
+ $(meson_native_use_feature ssl raop)
+ -Dvideoconvert=enabled # Matches upstream
+ -Dvideotestsrc=enabled # Matches upstream
+ -Dvolume=enabled # Matches upstream
+ -Dvulkan=disabled # Uses pre-compiled Vulkan compute shader to provide a CGI video source (dev thing; disabled by upstream)
+ $(meson_native_use_feature extra pw-cat)
+ -Dudev=enabled
+ -Dudevrulesdir="${EPREFIX}$(get_udevdir)/rules.d"
+ -Dsdl2=disabled # Controls SDL2 dependent code (currently only examples when -Dinstalled_tests=enabled which we never install)
+ -Dlibmysofa=disabled # libmysofa is unpackaged
+ $(meson_native_use_feature extra sndfile) # Enables libsndfile dependent code (currently only pw-cat)
+ -Dsession-managers="[]" # All available session managers are now their own projects, so there's nothing to build
+
+ # We still have <5.16 kernels packaged in Gentoo and 6.1 (LTS) only
+ # just became stable, with 5.15 being the previous LTS. Many people
+ # are still on it.
+ -Dpam-defaults-install=true
+
+ # Just for bell sounds in X11 right now.
+ $(meson_native_use_feature X x11)
+ $(meson_native_use_feature X x11-xfixes)
+ $(meson_native_use_feature X libcanberra)
+
+ # TODO
+ -Dsnap=disabled
+ )
+
+ # This installs the schema file for pulseaudio-daemon, iff we are replacing
+ # the official sound-server
+ if use !sound-server; then
+ emesonargs+=( '-Dgsettings-pulse-schema=disabled' )
+ else
+ emesonargs+=(
+ $(meson_native_use_feature gsettings gsettings-pulse-schema)
+ )
+ fi
+
+ meson_src_configure
+}
+
+multilib_src_test() {
+ meson_src_test --timeout-multiplier 10
+}
+
+multilib_src_install() {
+ # Our custom DOCS do not exist in multilib source directory
+ DOCS= meson_src_install
+}
+
+multilib_src_install_all() {
+ einstalldocs
+
+ if ! use man && [[ ${PIPEWIRE_DOCS_PREBUILT} == 1 ]] ; then
+ doman "${WORKDIR}"/${PN}-${PIPEWIRE_DOCS_VERSION}-docs/man/*/*.[0-8]
+ fi
+
+ if use pipewire-alsa; then
+ dodir /etc/alsa/conf.d
+
+ # Install pipewire conf loader hook
+ insinto /usr/share/alsa/alsa.conf.d
+ doins "${FILESDIR}"/99-pipewire-default-hook.conf
+ eprefixify "${ED}"/usr/share/alsa/alsa.conf.d/99-pipewire-default-hook.conf
+
+ # These will break if someone has /etc that is a symbolic link to a subfolder! See #724222
+ # And the current dosym8 -r implementation is likely affected by the same issue, too.
+ dosym ../../../usr/share/alsa/alsa.conf.d/50-pipewire.conf /etc/alsa/conf.d/50-pipewire.conf
+ dosym ../../../usr/share/alsa/alsa.conf.d/99-pipewire-default-hook.conf /etc/alsa/conf.d/99-pipewire-default-hook.conf
+ fi
+
+ # Enable required wireplumber alsa and bluez monitors
+ if use sound-server; then
+ # Install sound-server enabler for wireplumber 0.5.0+ conf syntax
+ insinto /etc/wireplumber/wireplumber.conf.d
+ doins "${FILESDIR}"/gentoo-sound-server-enable-audio-bluetooth.conf
+ fi
+
+ if use system-service; then
+ newtmpfiles - pipewire.conf <<-EOF || die
+ d /run/pipewire 0755 pipewire pipewire - -
+ EOF
+ fi
+
+ if ! use systemd; then
+ insinto /etc/xdg/autostart
+ newins "${FILESDIR}"/pipewire.desktop-r2 pipewire.desktop
+
+ exeinto /usr/bin
+ newexe "${FILESDIR}"/gentoo-pipewire-launcher.in-r3 gentoo-pipewire-launcher
+
+ doman "${FILESDIR}"/gentoo-pipewire-launcher.1
+
+ # Disable pipewire-pulse if sound-server is disabled.
+ if ! use sound-server ; then
+ sed -i -s '/pipewire -c pipewire-pulse.conf/s/^/#/' "${ED}"/usr/bin/gentoo-pipewire-launcher || die
+ fi
+
+ eprefixify "${ED}"/usr/bin/gentoo-pipewire-launcher
+ fi
+}
+
+pkg_postrm() {
+ udev_reload
+}
+
+pkg_preinst() {
+ HAD_SOUND_SERVER=0
+ HAD_SYSTEM_SERVICE=0
+
+ if has_version "media-video/pipewire[sound-server(-)]" ; then
+ HAD_SOUND_SERVER=1
+ fi
+
+ if has_version "media-video/pipewire[system-service(-)]" ; then
+ HAD_SYSTEM_SERVICE=1
+ fi
+}
+
+pkg_postinst() {
+ udev_reload
+
+ use system-service && tmpfiles_process pipewire.conf
+
+ local ver
+ for ver in ${REPLACING_VERSIONS} ; do
+ if has_version kde-plasma/kwin[screencast] || has_version x11-wm/mutter[screencast] ; then
+ # https://bugs.gentoo.org/908490
+ # https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3243
+ ewarn "Please restart KWin/Mutter after upgrading PipeWire."
+ ewarn "Screencasting may not work until you do."
+ fi
+
+ if ver_test ${ver} -le 0.3.66-r1 ; then
+ elog ">=pipewire-0.3.66 uses the 'pipewire' group to manage permissions"
+ elog "and limits needed to function smoothly:"
+ elog
+ elog "1. Please make sure your user is in the 'pipewire' group for"
+ elog "the best experience with realtime scheduling (PAM limits behavior)!"
+ elog "You can add your account with:"
+ elog " usermod -aG pipewire <youruser>"
+ elog
+ elog "2. For the best experience with fast user switching, it is recommended"
+ elog "that you remove your user from the 'audio' group unless you rely on the"
+ elog "audio group for device access control or ACLs.:"
+ elog " usermod -rG audio <youruser>"
+ elog
+
+ if ! use jack-sdk ; then
+ elog
+ elog "JACK emulation is incomplete and not all programs will work. PipeWire's"
+ elog "alternative libraries have been installed to a non-default location."
+ elog "To use them, put pw-jack <application> before every JACK application."
+ elog "When using pw-jack, do not run jackd/jackdbus. However, a virtual/jack"
+ elog "provider is still needed to compile the JACK applications themselves."
+ elog
+ fi
+
+ if use systemd ; then
+ ewarn
+ ewarn "PipeWire daemon startup has been moved to a launcher script!"
+ ewarn "Make sure that ${EROOT}/etc/pipewire/pipewire.conf either does not exist or no"
+ ewarn "longer is set to start a session manager or PulseAudio compatibility daemon (all"
+ ewarn "lines similar to '{ path = /usr/bin/pipewire*' should be commented out)"
+ ewarn
+ ewarn "Those manually starting /usr/bin/pipewire via .xinitrc or similar _must_ from"
+ ewarn "now on start ${EROOT}/usr/bin/gentoo-pipewire-launcher instead! It is highly"
+ ewarn "advised that a D-Bus user session is set up before starting the script."
+ ewarn
+ fi
+
+ if use sound-server && ( has_version 'media-sound/pulseaudio[daemon]' || has_version 'media-sound/pulseaudio-daemon' ) ; then
+ elog
+ elog "This ebuild auto-enables PulseAudio replacement. Because of that, users"
+ elog "are recommended to edit pulseaudio client configuration files:"
+ elog "${EROOT}/etc/pulse/client.conf and ${EROOT}/etc/pulse/client.conf.d/enable-autospawn.conf"
+ elog "if it exists, and disable autospawning of the original daemon by setting:"
+ elog
+ elog " autospawn = no"
+ elog
+ elog "Please note that the semicolon (;) must _NOT_ be at the beginning of the line!"
+ elog
+ elog "Alternatively, if replacing PulseAudio daemon is not desired, edit"
+ elog "${EROOT}/usr/bin/gentoo-pipewire-launcher by commenting out the relevant"
+ elog "command:"
+ elog
+ elog "#${EROOT}/usr/bin/pipewire -c pipewire-pulse.conf &"
+ elog
+ fi
+
+ if has_version 'net-misc/ofono' ; then
+ ewarn "Native backend has become default. Please disable oFono via:"
+ if systemd_is_booted ; then
+ ewarn "systemctl disable ofono"
+ else
+ ewarn "rc-update delete ofono"
+ fi
+ fi
+ fi
+ done
+
+ if [[ ${HAD_SOUND_SERVER} -eq 0 || -z ${REPLACING_VERSIONS} ]] ; then
+ # TODO: We could drop most of this if we set up systemd presets?
+ # They're worth looking into because right now, the out-of-the-box experience
+ # is automatic on OpenRC, while it needs manual intervention on systemd.
+ if use sound-server && use systemd ; then
+ elog
+ elog "When switching from PulseAudio, you may need to disable PulseAudio:"
+ elog
+ elog " systemctl --user disable pulseaudio.service pulseaudio.socket"
+ elog
+ elog "To use PipeWire, the user units must be manually enabled"
+ elog "by running this command as each user you use for desktop activities:"
+ elog
+ elog " systemctl --user enable pipewire.socket pipewire-pulse.socket"
+ elog
+ elog "A reboot is recommended to avoid interferences from still running"
+ elog "PulseAudio daemon."
+ elog
+ elog "Both new users and those upgrading need to enable WirePlumber"
+ elog "for relevant users:"
+ elog
+ elog " systemctl --user disable pipewire-media-session.service"
+ elog " systemctl --user --force enable wireplumber.service"
+ elog
+ elog "Root user may replace --user with --global to change system default"
+ elog "configuration for all of the above commands."
+ elog
+ fi
+
+ if ! use sound-server ; then
+ ewarn
+ ewarn "USE=sound-server is disabled! If you want PipeWire to provide"
+ ewarn "your sound, please enable it. See the wiki at"
+ ewarn "https://wiki.gentoo.org/wiki/PipeWire#Replacing_PulseAudio"
+ ewarn "for more details."
+ ewarn
+ fi
+ fi
+
+ if use system-service && [[ ${HAD_SYSTEM_SERVICE} -eq 0 || -z ${REPLACING_VERSIONS} ]] ; then
+ ewarn
+ ewarn "You have enabled the system-service USE flag, which installs"
+ ewarn "the system-wide systemd units that enable PipeWire to run as a system"
+ ewarn "service. This is more than likely NOT what you want. You are strongly"
+ ewarn "advised not to enable this mode and instead stick with systemd user"
+ ewarn "units. The default configuration files will likely not work out of the"
+ ewarn "box, and you are on your own with configuration."
+ ewarn
+ fi
+
+ elog "For latest tips and tricks, troubleshooting information, and documentation"
+ elog "in general, please refer to https://wiki.gentoo.org/wiki/PipeWire"
+ elog
+
+ optfeature_header "The following can be installed for optional runtime features:"
+ optfeature "restricted realtime capabilities via D-Bus" sys-auth/rtkit
+
+ if use sound-server && ! use pipewire-alsa; then
+ optfeature "ALSA plugin to use PulseAudio interface for output" "media-plugins/alsa-plugins[pulseaudio]"
+ fi
+}
diff --git a/media-video/pipewire/pipewire-1.2.7.ebuild b/media-video/pipewire/pipewire-1.2.7.ebuild
index 63b0b609e159..bcfeeafff3df 100644
--- a/media-video/pipewire/pipewire-1.2.7.ebuild
+++ b/media-video/pipewire/pipewire-1.2.7.ebuild
@@ -188,7 +188,7 @@ src_prepare() {
default
# Used for upstream backports
- [[ -d "${FILESDIR}"/${PV} ]] && eapply "${FILESDIR}"/${PV}
+ #[[ -d "${FILESDIR}"/${PV} ]] && eapply "${FILESDIR}"/${PV}
}
multilib_src_configure() {