mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-05 06:46:28 -04:00
gst: add retry mechanism when producer gets a busy buffer
Producer streams get busy buffers when slow consumers hold on to buffers and not release them on time. Add a retry mechanism as there can be non busy buffers available and producer can go on generating the output.
This commit is contained in:
parent
70d2b0eeb4
commit
46c4776dc2
1 changed files with 11 additions and 0 deletions
|
|
@ -161,6 +161,7 @@ acquire_buffer (GstBufferPool * pool, GstBuffer ** buffer,
|
||||||
GstPipeWirePool *p = GST_PIPEWIRE_POOL (pool);
|
GstPipeWirePool *p = GST_PIPEWIRE_POOL (pool);
|
||||||
GstPipeWirePoolData *data;
|
GstPipeWirePoolData *data;
|
||||||
struct pw_buffer *b;
|
struct pw_buffer *b;
|
||||||
|
guint retry = 0;
|
||||||
|
|
||||||
GST_OBJECT_LOCK (pool);
|
GST_OBJECT_LOCK (pool);
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
|
|
@ -169,6 +170,16 @@ acquire_buffer (GstBufferPool * pool, GstBuffer ** buffer,
|
||||||
|
|
||||||
if ((b = pw_stream_dequeue_buffer(p->stream)))
|
if ((b = pw_stream_dequeue_buffer(p->stream)))
|
||||||
break;
|
break;
|
||||||
|
else if (errno == EBUSY) {
|
||||||
|
if (!retry) {
|
||||||
|
struct pw_time time;
|
||||||
|
pw_stream_get_time_n (p->stream, &time, sizeof(time));
|
||||||
|
retry = time.avail_buffers + time.queued_buffers + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(--retry)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (params && (params->flags & GST_BUFFER_POOL_ACQUIRE_FLAG_DONTWAIT))
|
if (params && (params->flags & GST_BUFFER_POOL_ACQUIRE_FLAG_DONTWAIT))
|
||||||
goto no_more_buffers;
|
goto no_more_buffers;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue