mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 13:41:48 +00:00
v4l2bufferpool: Remove duplicate check
We were calling gst_v4l2_is_buffer_valid() before and inside gst_v4l2_buffer_pool_qbuf() as we needed to access the group. The second check failed since the writability of the buffer get inherited from the GstMemory, which lead to pipeline failure. As we cannot avoid the extra ref, it would be racy otherwise, just pass the group to _dbuf() so it does not have to call gst_v4l2_is_buffer_valid() again. https://bugzilla.gnome.org/show_bug.cgi?id=796692
This commit is contained in:
parent
ac6e77acad
commit
38b68cbbd7
1 changed files with 8 additions and 9 deletions
|
@ -1057,18 +1057,13 @@ no_buffers:
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_v4l2_buffer_pool_qbuf (GstV4l2BufferPool * pool, GstBuffer * buf)
|
gst_v4l2_buffer_pool_qbuf (GstV4l2BufferPool * pool, GstBuffer * buf,
|
||||||
|
GstV4l2MemoryGroup * group)
|
||||||
{
|
{
|
||||||
GstV4l2MemoryGroup *group = NULL;
|
|
||||||
const GstV4l2Object *obj = pool->obj;
|
const GstV4l2Object *obj = pool->obj;
|
||||||
GstClockTime timestamp;
|
GstClockTime timestamp;
|
||||||
gint index;
|
gint index;
|
||||||
|
|
||||||
if (!gst_v4l2_is_buffer_valid (buf, &group)) {
|
|
||||||
GST_ERROR_OBJECT (pool, "invalid buffer %p", buf);
|
|
||||||
return GST_FLOW_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
index = group->buffer.index;
|
index = group->buffer.index;
|
||||||
|
|
||||||
if (pool->buffers[index] != NULL)
|
if (pool->buffers[index] != NULL)
|
||||||
|
@ -1415,7 +1410,7 @@ gst_v4l2_buffer_pool_release_buffer (GstBufferPool * bpool, GstBuffer * buffer)
|
||||||
/* queue back in the device */
|
/* queue back in the device */
|
||||||
if (pool->other_pool)
|
if (pool->other_pool)
|
||||||
gst_v4l2_buffer_pool_prepare_buffer (pool, buffer, NULL);
|
gst_v4l2_buffer_pool_prepare_buffer (pool, buffer, NULL);
|
||||||
if (gst_v4l2_buffer_pool_qbuf (pool, buffer) != GST_FLOW_OK)
|
if (gst_v4l2_buffer_pool_qbuf (pool, buffer, group) != GST_FLOW_OK)
|
||||||
pclass->release_buffer (bpool, buffer);
|
pclass->release_buffer (bpool, buffer);
|
||||||
} else {
|
} else {
|
||||||
/* Simply release invalide/modified buffer, the allocator will
|
/* Simply release invalide/modified buffer, the allocator will
|
||||||
|
@ -1915,9 +1910,13 @@ gst_v4l2_buffer_pool_process (GstV4l2BufferPool * pool, GstBuffer ** buf)
|
||||||
gst_buffer_unref (to_queue);
|
gst_buffer_unref (to_queue);
|
||||||
goto prepare_failed;
|
goto prepare_failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* retreive the group */
|
||||||
|
gst_v4l2_is_buffer_valid (to_queue, &group);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ret = gst_v4l2_buffer_pool_qbuf (pool, to_queue)) != GST_FLOW_OK)
|
if ((ret = gst_v4l2_buffer_pool_qbuf (pool, to_queue, group))
|
||||||
|
!= GST_FLOW_OK)
|
||||||
goto queue_failed;
|
goto queue_failed;
|
||||||
|
|
||||||
/* if we are not streaming yet (this is the first buffer, start
|
/* if we are not streaming yet (this is the first buffer, start
|
||||||
|
|
Loading…
Reference in a new issue