diff options
Diffstat (limited to 'uvc-gadget.c')
-rw-r--r-- | uvc-gadget.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/uvc-gadget.c b/uvc-gadget.c index a0d8004..df9d80a 100644 --- a/uvc-gadget.c +++ b/uvc-gadget.c @@ -163,6 +163,12 @@ uvc_video_stream(struct uvc_device *dev, int enable) return ret; } + ret = v4l2_mmap_buffers(dev->vdev); + if (ret < 0) { + printf("Failed to mmap buffers.\n"); + goto error; + } + for (i = 0; i < dev->vdev->nbufs; ++i) { struct v4l2_video_buffer *buf = &dev->vdev->buffers[i]; @@ -170,13 +176,17 @@ uvc_video_stream(struct uvc_device *dev, int enable) ret = v4l2_queue_buffer(dev->vdev, buf); if (ret < 0) - return ret; + goto error; } v4l2_stream_on(dev->vdev); events_watch_fd(&dev->events, dev->vdev->fd, EVENT_WRITE, uvc_video_process, dev); + return 0; + +error: + v4l2_free_buffers(dev->vdev); return ret; } |