mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 08:11:16 +00:00
videopool: Release lock while allocating new object
The video pool can be accessed with the display lock held, for example, when releasing a buffer from inside vaapisink_render, but allocating a new object can may also take the display lock. Which means a possible deadlock. https://bugzilla.gnome.org/show_bug.cgi?id=747944
This commit is contained in:
parent
504fdedf84
commit
0adb36b658
1 changed files with 7 additions and 1 deletions
|
@ -177,7 +177,9 @@ gst_vaapi_video_pool_get_object_unlocked (GstVaapiVideoPool * pool)
|
|||
|
||||
object = g_queue_pop_head (&pool->free_objects);
|
||||
if (!object) {
|
||||
g_mutex_unlock (&pool->mutex);
|
||||
object = gst_vaapi_video_pool_alloc_object (pool);
|
||||
g_mutex_lock (&pool->mutex);
|
||||
if (!object)
|
||||
return NULL;
|
||||
}
|
||||
|
@ -354,7 +356,11 @@ gst_vaapi_video_pool_reserve_unlocked (GstVaapiVideoPool * pool, guint n)
|
|||
n = pool->capacity;
|
||||
|
||||
for (i = num_allocated; i < n; i++) {
|
||||
gpointer const object = gst_vaapi_video_pool_alloc_object (pool);
|
||||
gpointer object;
|
||||
|
||||
g_mutex_unlock (&pool->mutex);
|
||||
object = gst_vaapi_video_pool_alloc_object (pool);
|
||||
g_mutex_lock (&pool->mutex);
|
||||
if (!object)
|
||||
return FALSE;
|
||||
g_queue_push_tail (&pool->free_objects, object);
|
||||
|
|
Loading…
Reference in a new issue