diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2013-04-30 13:07:37 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2013-09-13 16:29:46 +0200 |
commit | bbc92d25bc2c0af33e8f1b7877505475145bbf9e (patch) | |
tree | 261252402d51d899606d13dbd5a6f23951ca0dcb | |
parent | 72069f8b8a5ccf3b248035ffa164d360169cf159 (diff) | |
download | gst-plugins-good-bbc92d25bc2c0af33e8f1b7877505475145bbf9e.tar.gz gst-plugins-good-bbc92d25bc2c0af33e8f1b7877505475145bbf9e.tar.xz |
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
-rw-r--r-- | sys/v4l2/gstv4l2bufferpool.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c index 274b44e39..0019c4819 100644 --- a/sys/v4l2/gstv4l2bufferpool.c +++ b/sys/v4l2/gstv4l2bufferpool.c @@ -198,11 +198,12 @@ gst_v4l2_buffer_pool_alloc_buffer (GstBufferPool * bpool, GstBuffer ** buffer, if (obj->mode == GST_V4L2_IO_DMABUF) { struct v4l2_exportbuffer expbuf; + memset (&expbuf, 0, sizeof (struct v4l2_exportbuffer)); expbuf.type = meta->vbuffer.type; expbuf.index = meta->vbuffer.index; expbuf.flags = O_CLOEXEC; if (v4l2_ioctl (pool->video_fd, VIDIOC_EXPBUF, &expbuf) < 0) - goto mmap_failed; + goto expbuf_failed; meta->vbuffer.memory = V4L2_MEMORY_DMABUF; gst_buffer_append_memory (newbuf, @@ -269,6 +270,17 @@ mmap_failed: errno = errnosave; 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 |