summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2014-07-03 15:29:54 -0400
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2014-07-03 15:29:54 -0400
commit3f15e6792312354e70cc4d550555e69fc15c7d8f (patch)
tree63e7b28d07bc2f3db8755011ce9dfaf913550f0a
parent652ed3bceb4e31fcd5dea9fdc9525fafb3350968 (diff)
v4l2bufferpool: Handle FD error during poll
This will ensure we fail earlier if something unrecoverable happens.
-rw-r--r--sys/v4l2/gstv4l2bufferpool.c13
-rw-r--r--sys/v4l2/gstv4l2bufferpool.h1
2 files changed, 9 insertions, 5 deletions
diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c
index eb63a5713..b3a3b8006 100644
--- a/sys/v4l2/gstv4l2bufferpool.c
+++ b/sys/v4l2/gstv4l2bufferpool.c
@@ -969,6 +969,9 @@ again:
}
}
+ if (gst_poll_fd_has_error (pool->poll, &pool->pollfd))
+ goto select_error;
+
done:
return GST_FLOW_OK;
@@ -1410,7 +1413,6 @@ gst_v4l2_buffer_pool_new (GstV4l2Object * obj, GstCaps * caps)
GstStructure *config;
gchar *name, *parent_name;
gint fd;
- GstPollFD pollfd = GST_POLL_FD_INIT;
fd = v4l2_dup (obj->video_fd);
if (fd < 0)
@@ -1426,12 +1428,13 @@ gst_v4l2_buffer_pool_new (GstV4l2Object * obj, GstCaps * caps)
"name", name, NULL);
g_free (name);
- pollfd.fd = fd;
- gst_poll_add_fd (pool->poll, &pollfd);
+ gst_poll_fd_init (&pool->pollfd);
+ pool->pollfd.fd = fd;
+ gst_poll_add_fd (pool->poll, &pool->pollfd);
if (V4L2_TYPE_IS_OUTPUT (obj->type))
- gst_poll_fd_ctl_write (pool->poll, &pollfd, TRUE);
+ gst_poll_fd_ctl_write (pool->poll, &pool->pollfd, TRUE);
else
- gst_poll_fd_ctl_read (pool->poll, &pollfd, TRUE);
+ gst_poll_fd_ctl_read (pool->poll, &pool->pollfd, TRUE);
pool->video_fd = fd;
pool->obj = obj;
diff --git a/sys/v4l2/gstv4l2bufferpool.h b/sys/v4l2/gstv4l2bufferpool.h
index e805615a0..8601a3277 100644
--- a/sys/v4l2/gstv4l2bufferpool.h
+++ b/sys/v4l2/gstv4l2bufferpool.h
@@ -51,6 +51,7 @@ struct _GstV4l2BufferPool
GstV4l2Object *obj; /* the v4l2 object */
gint video_fd; /* a dup(2) of the v4l2object's video_fd */
GstPoll *poll; /* a poll for video_fd */
+ GstPollFD pollfd;
gboolean can_poll_device;
gboolean empty;