va: allocator: Fix deadlock caused by double lock
authorSeungha Yang <seungha@centricular.com>
Mon, 11 Jan 2021 15:13:22 +0000 (00:13 +0900)
committerSeungha Yang <seungha@centricular.com>
Tue, 12 Jan 2021 12:28:04 +0000 (21:28 +0900)
Trivial bug fix for deadlock

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1949>

sys/va/gstvaallocator.c

index e114046..c1d35be 100644 (file)
@@ -1437,11 +1437,11 @@ gst_va_allocator_wait_for_memory (GstAllocator * allocator, GstBuffer * buffer)
 
   GST_VA_MEMORY_POOL_LOCK (&self->pool);
   if (!gst_va_memory_pool_wait_unlocked (&self->pool)) {
-    GST_VA_MEMORY_POOL_LOCK (&self->pool);
+    GST_VA_MEMORY_POOL_UNLOCK (&self->pool);
     return FALSE;
   }
   surface = gst_va_allocator_prepare_buffer_unlocked (self, buffer);
-  GST_VA_MEMORY_POOL_LOCK (&self->pool);
+  GST_VA_MEMORY_POOL_UNLOCK (&self->pool);
 
   if (surface != VA_INVALID_ID) {
     GST_TRACE_OBJECT (self, "Prepared surface %#x in buffer %p", surface,