v4l2allocator: Add protection against driver bug

v4l2loopback driver has a this nasty bug that if the queue is larger
then 2 buffers, it returns random index on dqbuf. So far we assumed
that the index was always right, which would lead to memory being
unref twice, and eventually crash.
This commit is contained in:
Nicolas Dufresne 2015-01-07 18:48:58 -05:00
parent 3e876215b7
commit f7c682f802

View file

@ -1305,6 +1305,13 @@ gst_v4l2_allocator_dqbuf (GstV4l2Allocator * allocator)
goto error;
group = allocator->groups[buffer.index];
if (!IS_QUEUED (group->buffer)) {
GST_ERROR_OBJECT (allocator,
"buffer %i was not queued, this indicate a driver bug.", buffer.index);
return NULL;
}
group->buffer = buffer;
GST_LOG_OBJECT (allocator, "dequeued buffer %i (flags 0x%X)", buffer.index,