v4l2bufferpool: Cleanly handle v4l2_allocator_new failure

This commit is contained in:
Nicolas Dufresne 2014-06-12 16:36:24 -04:00
parent 25c26a4c4c
commit 0fb59dbdba

View file

@ -1418,6 +1418,8 @@ gst_v4l2_buffer_pool_new (GstV4l2Object * obj, GstCaps * caps)
pool->vallocator = pool->vallocator =
gst_v4l2_allocator_new (GST_OBJECT (pool), obj->video_fd, &obj->format); gst_v4l2_allocator_new (GST_OBJECT (pool), obj->video_fd, &obj->format);
if (pool->vallocator == NULL)
goto allocator_failed;
gst_object_ref (obj->element); gst_object_ref (obj->element);
@ -1435,6 +1437,11 @@ dup_failed:
GST_ERROR ("failed to dup fd %d (%s)", errno, g_strerror (errno)); GST_ERROR ("failed to dup fd %d (%s)", errno, g_strerror (errno));
return NULL; return NULL;
} }
allocator_failed:
{
GST_ERROR_OBJECT (pool, "Failed to create V4L2 allocator");
return NULL;
}
} }
static GstFlowReturn static GstFlowReturn