diff options
-rw-r--r-- | sys/v4l2/gstv4l2bufferpool.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c index 5cc44adf4..11a856155 100644 --- a/sys/v4l2/gstv4l2bufferpool.c +++ b/sys/v4l2/gstv4l2bufferpool.c @@ -1266,6 +1266,7 @@ gst_v4l2_buffer_pool_process (GstV4l2BufferPool * pool, GstBuffer * buf) case GST_V4L2_IO_MMAP: { GstBuffer *to_queue; + gboolean just_started; if (buf->pool == bpool) { /* nothing, we can queue directly */ @@ -1303,13 +1304,14 @@ gst_v4l2_buffer_pool_process (GstV4l2BufferPool * pool, GstBuffer * buf) if ((ret = gst_v4l2_buffer_pool_qbuf (pool, to_queue)) != GST_FLOW_OK) goto done; + just_started = !pool->streaming; /* if we are not streaming yet (this is the first buffer, start * streaming now */ if (!pool->streaming) if (!start_streaming (pool)) goto start_failed; - if (pool->num_queued > pool->obj->min_queued) { + while (!just_started && (pool->num_queued > pool->obj->min_queued)) { GstBuffer *out; /* all buffers are queued, try to dequeue one and release it back * into the pool so that _acquire can get to it again. */ @@ -1333,6 +1335,7 @@ gst_v4l2_buffer_pool_process (GstV4l2BufferPool * pool, GstBuffer * buf) GstStructure *config; GstCaps *caps; guint size, old_min, old_max; + gboolean just_started; gboolean retry = FALSE; @@ -1384,13 +1387,14 @@ gst_v4l2_buffer_pool_process (GstV4l2BufferPool * pool, GstBuffer * buf) } gst_buffer_ref (buf); + just_started = !pool->streaming; /* if we are not streaming yet (this is the first buffer, start * streaming now */ if (!pool->streaming) if (!start_streaming (pool)) goto start_failed; - if (pool->num_queued > pool->obj->min_queued) { + while (!just_started && (pool->num_queued > pool->obj->min_queued)) { /* >1 buffer are queued, try to dequeue one and release it back * into the pool so that _acquire can get to it again. */ ret = gst_v4l2_buffer_pool_dqbuf (pool, &buf); |