public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: media-video/pipewire/files/0.3.83/, media-video/pipewire/
@ 2023-10-25  1:32 Sam James
  0 siblings, 0 replies; only message in thread
From: Sam James @ 2023-10-25  1:32 UTC (permalink / raw
  To: gentoo-commits

commit:     e78e092c510e751cab6bf1ea1a1d0b7c145c0be0
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 25 01:30:27 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Oct 25 01:31:39 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e78e092c

media-video/pipewire: backport recommended upstream patches to 0.3.83

Bug: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3592
Bug: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3593
Bug: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3600
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...1-stream-improve-queued_buffers-reporting.patch | 53 ++++++++++++++++++++++
 ...-module-echo-cancel-playback-source-async.patch | 36 +++++++++++++++
 .../0003-alsa-guard-against-null-areas.patch       | 52 +++++++++++++++++++++
 ...ire-0.3.83.ebuild => pipewire-0.3.83-r1.ebuild} |  0
 4 files changed, 141 insertions(+)

diff --git a/media-video/pipewire/files/0.3.83/0001-stream-improve-queued_buffers-reporting.patch b/media-video/pipewire/files/0.3.83/0001-stream-improve-queued_buffers-reporting.patch
new file mode 100644
index 000000000000..029a7930a60e
--- /dev/null
+++ b/media-video/pipewire/files/0.3.83/0001-stream-improve-queued_buffers-reporting.patch
@@ -0,0 +1,53 @@
+https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3592
+https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/3d8c7c40b5cc16eaf7bd1fb72c17783ce42e2d0e
+
+From 3d8c7c40b5cc16eaf7bd1fb72c17783ce42e2d0e Mon Sep 17 00:00:00 2001
+From: Wim Taymans <wtaymans@redhat.com>
+Date: Fri, 20 Oct 2023 09:57:52 +0200
+Subject: [PATCH] stream: improve queued_buffers reporting
+
+Also add the queued buffers in the converter to the pw_time.queued_buffers
+field. This means that queued_buffers + avail_buffers always equal the
+total amount of allocated buffers, which makes more sense.
+
+Fixes #3592
+--- a/src/pipewire/stream.c
++++ b/src/pipewire/stream.c
+@@ -2340,6 +2340,7 @@ int pw_stream_get_time_n(struct pw_stream *stream, struct pw_time *time, size_t
+ 	struct stream *impl = SPA_CONTAINER_OF(stream, struct stream, this);
+ 	uintptr_t seq1, seq2;
+ 	uint32_t buffered, quantum, index;
++	int32_t avail_buffers;
+ 
+ 	do {
+ 		seq1 = SPA_SEQ_READ(impl->seq);
+@@ -2358,19 +2359,23 @@ int pw_stream_get_time_n(struct pw_stream *stream, struct pw_time *time, size_t
+ 	time->delay += (impl->latency.min_rate + impl->latency.max_rate) / 2;
+ 	time->delay += ((impl->latency.min_ns + impl->latency.max_ns) / 2) * time->rate.denom / SPA_NSEC_PER_SEC;
+ 
++	avail_buffers = spa_ringbuffer_get_read_index(&impl->dequeued.ring, &index);
++	avail_buffers = SPA_CLAMP(avail_buffers, 0, (int32_t)impl->n_buffers);
++
+ 	if (size >= offsetof(struct pw_time, queued_buffers))
+ 		time->buffered = buffered;
+ 	if (size >= offsetof(struct pw_time, avail_buffers))
+-		time->queued_buffers = spa_ringbuffer_get_read_index(&impl->queued.ring, &index);
++		time->queued_buffers = impl->n_buffers - avail_buffers;
+ 	if (size >= sizeof(struct pw_time))
+-		time->avail_buffers = spa_ringbuffer_get_read_index(&impl->dequeued.ring, &index);
++		time->avail_buffers = avail_buffers;
+ 
+ 	pw_log_trace_fp("%p: %"PRIi64" %"PRIi64" %"PRIu64" %d/%d %"PRIu64" %"
+-			PRIu64" %"PRIu64" %"PRIu64" %"PRIu64, stream,
++			PRIu64" %"PRIu64" %"PRIu64" %"PRIu64" %d/%d", stream,
+ 			time->now, time->delay, time->ticks,
+ 			time->rate.num, time->rate.denom, time->queued,
+ 			impl->dequeued.outcount, impl->dequeued.incount,
+-			impl->queued.outcount, impl->queued.incount);
++			impl->queued.outcount, impl->queued.incount,
++			avail_buffers, impl->n_buffers);
+ 	return 0;
+ }
+ 
+-- 
+GitLab

diff --git a/media-video/pipewire/files/0.3.83/0002-module-echo-cancel-playback-source-async.patch b/media-video/pipewire/files/0.3.83/0002-module-echo-cancel-playback-source-async.patch
new file mode 100644
index 000000000000..ee96f949a2bb
--- /dev/null
+++ b/media-video/pipewire/files/0.3.83/0002-module-echo-cancel-playback-source-async.patch
@@ -0,0 +1,36 @@
+https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3593
+https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/93d5848031cd9101d830fb4c37c5a7404ac5f276
+
+From 93d5848031cd9101d830fb4c37c5a7404ac5f276 Mon Sep 17 00:00:00 2001
+From: Wim Taymans <wtaymans@redhat.com>
+Date: Sat, 21 Oct 2023 09:27:43 +0200
+Subject: [PATCH] module-echo-cancel: playback and source are async
+
+The playback and source streams don't dequeue/queue buffers from
+the process function and so need to be marked async.
+
+Fixes #3593
+--- a/src/modules/module-echo-cancel.c
++++ b/src/modules/module-echo-cancel.c
+@@ -1002,7 +1002,8 @@ static int setup_streams(struct impl *impl)
+ 			PW_DIRECTION_OUTPUT,
+ 			PW_ID_ANY,
+ 			PW_STREAM_FLAG_MAP_BUFFERS |
+-			PW_STREAM_FLAG_RT_PROCESS,
++			PW_STREAM_FLAG_RT_PROCESS |
++			PW_STREAM_FLAG_ASYNC,
+ 			params, n_params)) < 0) {
+ 		spa_pod_dynamic_builder_clean(&b);
+ 		return res;
+@@ -1036,7 +1037,8 @@ static int setup_streams(struct impl *impl)
+ 			PW_ID_ANY,
+ 			PW_STREAM_FLAG_AUTOCONNECT |
+ 			PW_STREAM_FLAG_MAP_BUFFERS |
+-			PW_STREAM_FLAG_RT_PROCESS,
++			PW_STREAM_FLAG_RT_PROCESS |
++			PW_STREAM_FLAG_ASYNC,
+ 			params, n_params)) < 0) {
+ 		spa_pod_dynamic_builder_clean(&b);
+ 		return res;
+-- 
+GitLab

diff --git a/media-video/pipewire/files/0.3.83/0003-alsa-guard-against-null-areas.patch b/media-video/pipewire/files/0.3.83/0003-alsa-guard-against-null-areas.patch
new file mode 100644
index 000000000000..e16b44538b1b
--- /dev/null
+++ b/media-video/pipewire/files/0.3.83/0003-alsa-guard-against-null-areas.patch
@@ -0,0 +1,52 @@
+https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3600
+https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/920beea3eb55ee7156bd8c00a201bdcafa0df5b0
+
+From 920beea3eb55ee7156bd8c00a201bdcafa0df5b0 Mon Sep 17 00:00:00 2001
+From: Wim Taymans <wtaymans@redhat.com>
+Date: Sun, 22 Oct 2023 17:26:25 +0200
+Subject: [PATCH] alsa: guard agaist NULL areas
+
+snd_pcm_ioplug_mmap_areas() can fail and return NULL
+
+Fixes #3600
+--- a/pipewire-alsa/alsa-plugins/pcm_pipewire.c
++++ b/pipewire-alsa/alsa-plugins/pcm_pipewire.c
+@@ -309,21 +309,21 @@ snd_pcm_pipewire_process(snd_pcm_pipewire_t *pw, struct pw_buffer *b,
+ 		xfer = nframes;
+ 		if (xfer > 0) {
+ 			const snd_pcm_channel_area_t *areas = snd_pcm_ioplug_mmap_areas(io);
+-			const snd_pcm_uframes_t offset = hw_ptr % io->buffer_size;
+-
+-			if (io->stream == SND_PCM_STREAM_PLAYBACK)
+-				snd_pcm_areas_copy_wrap(pwareas, 0, nframes,
+-						areas, offset,
+-						io->buffer_size,
+-						io->channels, xfer,
+-						io->format);
+-			else
+-				snd_pcm_areas_copy_wrap(areas, offset,
+-						io->buffer_size,
+-						pwareas, 0, nframes,
+-						io->channels, xfer,
+-						io->format);
+-
++			if (areas != NULL) {
++				const snd_pcm_uframes_t offset = hw_ptr % io->buffer_size;
++				if (io->stream == SND_PCM_STREAM_PLAYBACK)
++					snd_pcm_areas_copy_wrap(pwareas, 0, nframes,
++							areas, offset,
++							io->buffer_size,
++							io->channels, xfer,
++							io->format);
++				else
++					snd_pcm_areas_copy_wrap(areas, offset,
++							io->buffer_size,
++							pwareas, 0, nframes,
++							io->channels, xfer,
++							io->format);
++			}
+ 			hw_ptr += xfer;
+ 			if (hw_ptr >= pw->boundary)
+ 				hw_ptr -= pw->boundary;
+-- 
+GitLab

diff --git a/media-video/pipewire/pipewire-0.3.83.ebuild b/media-video/pipewire/pipewire-0.3.83-r1.ebuild
similarity index 100%
rename from media-video/pipewire/pipewire-0.3.83.ebuild
rename to media-video/pipewire/pipewire-0.3.83-r1.ebuild


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-10-25  1:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-25  1:32 [gentoo-commits] repo/gentoo:master commit in: media-video/pipewire/files/0.3.83/, media-video/pipewire/ Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox