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.
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,