From d36a867788bf64c8b53983dedcbead49ff759494 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 17 Jan 2025 17:08:07 +0100 Subject: [PATCH] gst: only return the custom flag when in _render() Make a custom ACQUIRE flag and if it's set, return the custom error when the pool is empty. --- src/gst/gstpipewirepool.c | 11 +++++++---- src/gst/gstpipewiresink.c | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gst/gstpipewirepool.c b/src/gst/gstpipewirepool.c index e018a8eb6..578d61bb0 100644 --- a/src/gst/gstpipewirepool.c +++ b/src/gst/gstpipewirepool.c @@ -168,11 +168,14 @@ acquire_buffer (GstBufferPool * pool, GstBuffer ** buffer, break; } - if (params && (params->flags & GST_BUFFER_POOL_ACQUIRE_FLAG_DONTWAIT)) - goto no_more_buffers; + if (params) { + if (params->flags & GST_BUFFER_POOL_ACQUIRE_FLAG_DONTWAIT) + goto no_more_buffers; - if (p->paused) - goto paused; + if ((params->flags & GST_BUFFER_POOL_ACQUIRE_FLAG_LAST) && + p->paused) + goto paused; + } GST_WARNING_OBJECT (pool, "failed to dequeue buffer: %s", strerror(errno)); g_cond_wait (&p->cond, GST_OBJECT_GET_LOCK (pool)); diff --git a/src/gst/gstpipewiresink.c b/src/gst/gstpipewiresink.c index 14dec52a2..f945c7260 100644 --- a/src/gst/gstpipewiresink.c +++ b/src/gst/gstpipewiresink.c @@ -873,6 +873,7 @@ gst_pipewire_sink_render (GstBaseSink * bsink, GstBuffer * buffer) pw_thread_loop_unlock (pwsink->stream->core->loop); + params.flags = GST_BUFFER_POOL_ACQUIRE_FLAG_LAST; res = gst_buffer_pool_acquire_buffer (GST_BUFFER_POOL_CAST (pwsink->stream->pool), &b, ¶ms); if (res == GST_FLOW_CUSTOM_ERROR_1) {