mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
bufferpool: improve _new function
This commit is contained in:
parent
9c087d7d85
commit
23656bbb72
1 changed files with 6 additions and 7 deletions
|
@ -523,13 +523,14 @@ GstBufferPool *
|
||||||
gst_v4l2_buffer_pool_new (GstV4l2Object * obj)
|
gst_v4l2_buffer_pool_new (GstV4l2Object * obj)
|
||||||
{
|
{
|
||||||
GstV4l2BufferPool *pool;
|
GstV4l2BufferPool *pool;
|
||||||
|
gint fd;
|
||||||
|
|
||||||
pool = (GstV4l2BufferPool *) g_object_new (GST_TYPE_V4L2_BUFFER_POOL, NULL);
|
fd = v4l2_dup (obj->video_fd);
|
||||||
|
if (fd < 0)
|
||||||
pool->video_fd = v4l2_dup (obj->video_fd);
|
|
||||||
if (pool->video_fd < 0)
|
|
||||||
goto dup_failed;
|
goto dup_failed;
|
||||||
|
|
||||||
|
pool = (GstV4l2BufferPool *) g_object_new (GST_TYPE_V4L2_BUFFER_POOL, NULL);
|
||||||
|
pool->video_fd = fd;
|
||||||
pool->obj = obj;
|
pool->obj = obj;
|
||||||
|
|
||||||
return GST_BUFFER_POOL_CAST (pool);
|
return GST_BUFFER_POOL_CAST (pool);
|
||||||
|
@ -537,9 +538,7 @@ gst_v4l2_buffer_pool_new (GstV4l2Object * obj)
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
dup_failed:
|
dup_failed:
|
||||||
{
|
{
|
||||||
gint errnosave = errno;
|
GST_DEBUG ("failed to dup fd %d (%s)", errno, g_strerror (errno));
|
||||||
gst_object_unref (pool);
|
|
||||||
errno = errnosave;
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue