mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 22:16:22 +00:00
v4l2: Workaround libv4l2 RW emulation bug
When libv4l2 emulates RW mode on top of MMAP devices, the queues are only initialized on first read. The problem is that poll() will fail if called before the queues are initialized and streaming. Workaround this by doing a zero size read when pool is started in that IO mode. https://bugzilla.gnome.org/show_bug.cgi?id=740633
This commit is contained in:
parent
0e05faf91a
commit
eb1dcd841a
1 changed files with 9 additions and 0 deletions
|
@ -646,6 +646,15 @@ gst_v4l2_buffer_pool_start (GstBufferPool * bpool)
|
|||
switch (obj->mode) {
|
||||
case GST_V4L2_IO_RW:
|
||||
can_allocate = TRUE;
|
||||
#ifdef HAVE_LIBV4L2
|
||||
/* This workaround a unfixable bug in libv4l2 when RW is emulated on top
|
||||
* of MMAP. In this case, the first read initialize the queues, but the
|
||||
* poll before that will always fail. Doing an empty read, forces the
|
||||
* queue to be initialized now. We only do this if we have a streaming
|
||||
* driver. */
|
||||
if (obj->vcap.capabilities & V4L2_CAP_STREAMING)
|
||||
v4l2_read (obj->video_fd, NULL, 0);
|
||||
#endif
|
||||
break;
|
||||
case GST_V4L2_IO_DMABUF:
|
||||
case GST_V4L2_IO_MMAP:
|
||||
|
|
Loading…
Reference in a new issue