v4l2bufferpool: check set_config return value in gst_v4l2_buffer_pool_new

https://bugzilla.gnome.org/show_bug.cgi?id=720568
This commit is contained in:
Julien Isorce 2014-01-07 11:58:23 +00:00 committed by Nicolas Dufresne
parent b39c838ece
commit 55da3bc885

View file

@ -1298,7 +1298,8 @@ GstBufferPool *
gst_v4l2_buffer_pool_new (GstV4l2Object * obj, GstCaps * caps)
{
GstV4l2BufferPool *pool;
GstStructure *s;
GstStructure *config;
gboolean res = FALSE;
gint fd;
fd = v4l2_dup (obj->video_fd);
@ -1310,9 +1311,12 @@ gst_v4l2_buffer_pool_new (GstV4l2Object * obj, GstCaps * caps)
pool->obj = obj;
pool->can_alloc = TRUE;
s = gst_buffer_pool_get_config (GST_BUFFER_POOL_CAST (pool));
gst_buffer_pool_config_set_params (s, caps, obj->sizeimage, 2, 0);
gst_buffer_pool_set_config (GST_BUFFER_POOL_CAST (pool), s);
config = gst_buffer_pool_get_config (GST_BUFFER_POOL_CAST (pool));
gst_buffer_pool_config_set_params (config, caps, obj->sizeimage, 2, 0);
res = gst_buffer_pool_set_config (GST_BUFFER_POOL_CAST (pool), config);
if (!res)
goto config_failed;
gst_object_ref (obj->element);
@ -1324,6 +1328,11 @@ dup_failed:
GST_DEBUG ("failed to dup fd %d (%s)", errno, g_strerror (errno));
return NULL;
}
config_failed:
{
GST_WARNING ("failed to set pool config");
return NULL;
}
}
static GstFlowReturn