v4l2: fix and cleanup VIDIOC_EXPBUF handling
clear the struct, and provide a correct error message https://bugzilla.gnome.org/show_bug.cgi?id=699337
This commit is contained in:
parent
4d3f6850ca
commit
eebe5fc70d
@ -196,11 +196,12 @@ gst_v4l2_buffer_pool_alloc_buffer (GstBufferPool * bpool, GstBuffer ** buffer,
|
|||||||
if (obj->mode == GST_V4L2_IO_DMABUF) {
|
if (obj->mode == GST_V4L2_IO_DMABUF) {
|
||||||
struct v4l2_exportbuffer expbuf;
|
struct v4l2_exportbuffer expbuf;
|
||||||
|
|
||||||
|
memset (&expbuf, 0, sizeof (struct v4l2_exportbuffer));
|
||||||
expbuf.type = meta->vbuffer.type;
|
expbuf.type = meta->vbuffer.type;
|
||||||
expbuf.index = meta->vbuffer.index;
|
expbuf.index = meta->vbuffer.index;
|
||||||
expbuf.flags = O_CLOEXEC;
|
expbuf.flags = O_CLOEXEC;
|
||||||
if (v4l2_ioctl (pool->video_fd, VIDIOC_EXPBUF, &expbuf) < 0)
|
if (v4l2_ioctl (pool->video_fd, VIDIOC_EXPBUF, &expbuf) < 0)
|
||||||
goto mmap_failed;
|
goto expbuf_failed;
|
||||||
|
|
||||||
meta->vbuffer.memory = V4L2_MEMORY_DMABUF;
|
meta->vbuffer.memory = V4L2_MEMORY_DMABUF;
|
||||||
gst_buffer_append_memory (newbuf,
|
gst_buffer_append_memory (newbuf,
|
||||||
@ -267,6 +268,17 @@ mmap_failed:
|
|||||||
errno = errnosave;
|
errno = errnosave;
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
|
#if HAVE_DECL_V4L2_MEMORY_DMABUF
|
||||||
|
expbuf_failed:
|
||||||
|
{
|
||||||
|
gint errnosave = errno;
|
||||||
|
|
||||||
|
GST_WARNING ("Failed EXPBUF: %s", g_strerror (errnosave));
|
||||||
|
gst_buffer_unref (newbuf);
|
||||||
|
errno = errnosave;
|
||||||
|
return GST_FLOW_ERROR;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
Loading…
x
Reference in New Issue
Block a user