libs: videopool: fix a condition race for pool allocate.

This commit is contained in:
He Junyan 2020-02-07 23:56:13 +08:00 committed by GStreamer Merge Bot
parent da008baac2
commit 5e612aeb84

View file

@ -179,6 +179,13 @@ gst_vaapi_video_pool_get_object_unlocked (GstVaapiVideoPool * pool)
g_mutex_lock (&pool->mutex);
if (!object)
return NULL;
/* Others already allocated a new one before us during we
release the mutex */
if (pool->capacity && pool->used_count >= pool->capacity) {
gst_mini_object_unref (object);
return NULL;
}
}
++pool->used_count;