mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
v4l2bufferpool: Re-enqueue buffer at stream start
This commit is contained in:
parent
a946a7cde6
commit
cb311d57f5
1 changed files with 29 additions and 0 deletions
|
@ -602,10 +602,34 @@ start_streaming (GstV4l2BufferPool * pool)
|
||||||
case GST_V4L2_IO_USERPTR:
|
case GST_V4L2_IO_USERPTR:
|
||||||
case GST_V4L2_IO_DMABUF:
|
case GST_V4L2_IO_DMABUF:
|
||||||
case GST_V4L2_IO_DMABUF_IMPORT:
|
case GST_V4L2_IO_DMABUF_IMPORT:
|
||||||
|
{
|
||||||
|
/* For capture device, we need to re-enqueue buffers before be can let
|
||||||
|
* the driver stream again */
|
||||||
|
if (!V4L2_TYPE_IS_OUTPUT (obj->type)) {
|
||||||
|
GstBufferPool *bpool = GST_BUFFER_POOL (pool);
|
||||||
|
GstBufferPoolAcquireParams params = { 0 };
|
||||||
|
GstFlowReturn ret;
|
||||||
|
|
||||||
|
while (pool->num_queued < pool->num_allocated) {
|
||||||
|
GstBuffer *buf;
|
||||||
|
|
||||||
|
params.flags = GST_BUFFER_POOL_ACQUIRE_FLAG_DONTWAIT;
|
||||||
|
ret = GST_BUFFER_POOL_CLASS (parent_class)->acquire_buffer (bpool,
|
||||||
|
&buf, ¶ms);
|
||||||
|
|
||||||
|
if (ret != GST_FLOW_OK)
|
||||||
|
goto requeue_failed;
|
||||||
|
|
||||||
|
gst_v4l2_buffer_pool_release_buffer (bpool, buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (pool, "STREAMON");
|
GST_DEBUG_OBJECT (pool, "STREAMON");
|
||||||
|
|
||||||
if (v4l2_ioctl (pool->video_fd, VIDIOC_STREAMON, &obj->type) < 0)
|
if (v4l2_ioctl (pool->video_fd, VIDIOC_STREAMON, &obj->type) < 0)
|
||||||
goto start_failed;
|
goto start_failed;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
break;
|
break;
|
||||||
|
@ -622,6 +646,11 @@ start_failed:
|
||||||
g_strerror (errno));
|
g_strerror (errno));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
requeue_failed:
|
||||||
|
{
|
||||||
|
GST_ERROR_OBJECT (pool, "failed to re-enqueue buffers");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue