mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-30 12:10:37 +00:00
libs: videopool: fix a condition race for pool allocate.
This commit is contained in:
parent
da008baac2
commit
5e612aeb84
1 changed files with 7 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue