mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-10-14 20:02:38 +00:00
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.
This commit is contained in:
parent
b86e5cabfa
commit
8911e22793
|
@ -578,6 +578,7 @@ gst_pipewire_sink_render (GstBaseSink * bsink, GstBuffer * buffer)
|
||||||
GstPipeWireSink *pwsink;
|
GstPipeWireSink *pwsink;
|
||||||
GstFlowReturn res = GST_FLOW_OK;
|
GstFlowReturn res = GST_FLOW_OK;
|
||||||
const char *error = NULL;
|
const char *error = NULL;
|
||||||
|
gboolean unref_buffer = FALSE;
|
||||||
|
|
||||||
pwsink = GST_PIPEWIRE_SINK (bsink);
|
pwsink = GST_PIPEWIRE_SINK (bsink);
|
||||||
|
|
||||||
|
@ -620,6 +621,7 @@ gst_pipewire_sink_render (GstBaseSink * bsink, GstBuffer * buffer)
|
||||||
gst_buffer_unmap (b, &info);
|
gst_buffer_unmap (b, &info);
|
||||||
gst_buffer_resize (b, 0, gst_buffer_get_size (buffer));
|
gst_buffer_resize (b, 0, gst_buffer_get_size (buffer));
|
||||||
buffer = b;
|
buffer = b;
|
||||||
|
unref_buffer = TRUE;
|
||||||
|
|
||||||
pw_thread_loop_lock (pwsink->core->loop);
|
pw_thread_loop_lock (pwsink->core->loop);
|
||||||
if (pw_stream_get_state (pwsink->stream, &error) != PW_STREAM_STATE_STREAMING)
|
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");
|
GST_DEBUG ("push buffer");
|
||||||
do_send_buffer (pwsink, buffer);
|
do_send_buffer (pwsink, buffer);
|
||||||
|
if (unref_buffer)
|
||||||
|
gst_buffer_unref (buffer);
|
||||||
|
|
||||||
done_unlock:
|
done_unlock:
|
||||||
pw_thread_loop_unlock (pwsink->core->loop);
|
pw_thread_loop_unlock (pwsink->core->loop);
|
||||||
|
|
Loading…
Reference in a new issue