X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=sys%2Fv4l2%2Fgstv4l2bufferpool.c;h=49f222b6eadb94b718e59e30e6e9cb12b3706fb1;hb=fba94862a9e8205c7a83bdf15adcee5e8535f605;hp=282a02e3f3f68f0100b10b1b6091fcf79656e322;hpb=e49cbdb39e0684a0e6057bcab0b7cef0aca75749;p=platform%2Fupstream%2Fgst-plugins-good.git diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c index 282a02e..49f222b 100644 --- a/sys/v4l2/gstv4l2bufferpool.c +++ b/sys/v4l2/gstv4l2bufferpool.c @@ -650,12 +650,14 @@ gst_v4l2_buffer_pool_streamon (GstV4l2BufferPool * pool) case GST_V4L2_IO_DMABUF: case GST_V4L2_IO_DMABUF_IMPORT: if (!V4L2_TYPE_IS_OUTPUT (pool->obj->type)) { + guint i; + /* For captures, we need to enqueue buffers before we start streaming, * so the driver don't underflow immediatly. As we have put then back * into the base class queue, resurrect them, then releasing will queue * them back. */ - while (gst_v4l2_buffer_pool_resurrect_buffer (pool) == GST_FLOW_OK) - continue; + for (i = 0; i < pool->num_allocated; i++) + gst_v4l2_buffer_pool_resurrect_buffer (pool); } if (obj->ioctl (pool->video_fd, VIDIOC_STREAMON, &obj->type) < 0) @@ -791,6 +793,7 @@ gst_v4l2_buffer_pool_start (GstBufferPool * bpool) count = gst_v4l2_allocator_start (pool->vallocator, min_buffers, V4L2_MEMORY_MMAP); + pool->num_allocated = count; if (count < GST_V4L2_MIN_BUFFERS) { min_buffers = count; @@ -1003,11 +1006,16 @@ gst_v4l2_buffer_pool_orphan (GstBufferPool ** bpool) */ ret = gst_v4l2_buffer_pool_stop (*bpool); if (!ret) - gst_v4l2_allocator_orphan (pool->vallocator); + ret = gst_v4l2_allocator_orphan (pool->vallocator); + + if (!ret) + goto orphan_failed; pool->orphaned = TRUE; gst_object_unref (*bpool); *bpool = NULL; + +orphan_failed: return ret; }