summaryrefslogtreecommitdiffstats
path: root/meta-pipewire/recipes-multimedia
diff options
context:
space:
mode:
Diffstat (limited to 'meta-pipewire/recipes-multimedia')
-rw-r--r--meta-pipewire/recipes-multimedia/pipewire/pipewire/0001-pipewiresink-use-all-the-available-dest-memory-when-.patch33
-rw-r--r--meta-pipewire/recipes-multimedia/pipewire/pipewire/0002-pipewiresink-release-manually-acquired-buffers-back-.patch52
-rw-r--r--meta-pipewire/recipes-multimedia/pipewire/pipewire_0.3.27.bbappend5
3 files changed, 90 insertions, 0 deletions
diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0001-pipewiresink-use-all-the-available-dest-memory-when-.patch b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0001-pipewiresink-use-all-the-available-dest-memory-when-.patch
new file mode 100644
index 000000000..a3bde14bc
--- /dev/null
+++ b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0001-pipewiresink-use-all-the-available-dest-memory-when-.patch
@@ -0,0 +1,33 @@
+From b86e5cabfae3ab354f350f8f7589b21a153a8a5d Mon Sep 17 00:00:00 2001
+From: George Kiagiadakis <george.kiagiadakis@collabora.com>
+Date: Mon, 10 May 2021 17:12:12 +0300
+Subject: pipewiresink: use all the available dest memory when copying buffer
+
+When pipewiresink needs to copy data, it has to resize the destination
+buffer (to a smaller size) in order to send the correct data size to
+pipewire. When this dest buffer is reused later, it will still have
+this smaller size as its total size and the copy may discard data
+from upstream if the new upstream buffer is bigger than the last one
+that was copied on the same dest buffer.
+
+Upstream-Status: Backport [from master/0.3.28]
+---
+ src/gst/gstpipewiresink.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/gst/gstpipewiresink.c b/src/gst/gstpipewiresink.c
+index 966b12c7..031b3ae0 100644
+--- a/src/gst/gstpipewiresink.c
++++ b/src/gst/gstpipewiresink.c
+@@ -616,7 +616,7 @@ gst_pipewire_sink_render (GstBaseSink * bsink, GstBuffer * buffer)
+ goto done;
+
+ gst_buffer_map (b, &info, GST_MAP_WRITE);
+- gst_buffer_extract (buffer, 0, info.data, info.size);
++ gst_buffer_extract (buffer, 0, info.data, info.maxsize);
+ gst_buffer_unmap (b, &info);
+ gst_buffer_resize (b, 0, gst_buffer_get_size (buffer));
+ buffer = b;
+--
+2.30.2
+
diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0002-pipewiresink-release-manually-acquired-buffers-back-.patch b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0002-pipewiresink-release-manually-acquired-buffers-back-.patch
new file mode 100644
index 000000000..aeafae616
--- /dev/null
+++ b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0002-pipewiresink-release-manually-acquired-buffers-back-.patch
@@ -0,0 +1,52 @@
+From 8911e22793ed3713ceb78be5414eeb03ebde962e Mon Sep 17 00:00:00 2001
+From: George Kiagiadakis <george.kiagiadakis@collabora.com>
+Date: Mon, 10 May 2021 17:25:57 +0300
+Subject: pipewiresink: release manually acquired buffers back to the pool
+
+When we manually acquire buffers from the pool, we never release them.
+But because gst_buffer_pool_acquire_buffer() adds a reference to the pool,
+this leaks the pool eventually.
+
+To fix this, just unref the buffer after it has been sent. This releases
+it back to the pool and unrefs the pool.
+
+This has no significant effect to the stream, since the underlying
+pw buffers are actually pooled in the pw_stream. It just prevents leaking.
+
+Upstream-Status: Backport [from master/0.3.28]
+---
+ src/gst/gstpipewiresink.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/gst/gstpipewiresink.c b/src/gst/gstpipewiresink.c
+index 031b3ae0..2f79a4f7 100644
+--- a/src/gst/gstpipewiresink.c
++++ b/src/gst/gstpipewiresink.c
+@@ -578,6 +578,7 @@ gst_pipewire_sink_render (GstBaseSink * bsink, GstBuffer * buffer)
+ GstPipeWireSink *pwsink;
+ GstFlowReturn res = GST_FLOW_OK;
+ const char *error = NULL;
++ gboolean unref_buffer = FALSE;
+
+ pwsink = GST_PIPEWIRE_SINK (bsink);
+
+@@ -620,6 +621,7 @@ gst_pipewire_sink_render (GstBaseSink * bsink, GstBuffer * buffer)
+ gst_buffer_unmap (b, &info);
+ gst_buffer_resize (b, 0, gst_buffer_get_size (buffer));
+ buffer = b;
++ unref_buffer = TRUE;
+
+ pw_thread_loop_lock (pwsink->core->loop);
+ if (pw_stream_get_state (pwsink->stream, &error) != PW_STREAM_STATE_STREAMING)
+@@ -628,6 +630,8 @@ gst_pipewire_sink_render (GstBaseSink * bsink, GstBuffer * buffer)
+
+ GST_DEBUG ("push buffer");
+ do_send_buffer (pwsink, buffer);
++ if (unref_buffer)
++ gst_buffer_unref (buffer);
+
+ done_unlock:
+ pw_thread_loop_unlock (pwsink->core->loop);
+--
+2.30.2
+
diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire_0.3.27.bbappend b/meta-pipewire/recipes-multimedia/pipewire/pipewire_0.3.27.bbappend
index cc2308e95..22700ae67 100644
--- a/meta-pipewire/recipes-multimedia/pipewire/pipewire_0.3.27.bbappend
+++ b/meta-pipewire/recipes-multimedia/pipewire/pipewire_0.3.27.bbappend
@@ -5,3 +5,8 @@ PACKAGECONFIG = "\
${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \
gstreamer v4l2 \
"
+
+SRC_URI += "\
+ file://0001-pipewiresink-use-all-the-available-dest-memory-when-.patch \
+ file://0002-pipewiresink-release-manually-acquired-buffers-back-.patch \
+"