diff --git a/gst/vaapi/gstvaapivideomemory.c b/gst/vaapi/gstvaapivideomemory.c index 99a2b57190..91b33cec09 100644 --- a/gst/vaapi/gstvaapivideomemory.c +++ b/gst/vaapi/gstvaapivideomemory.c @@ -298,11 +298,12 @@ gst_video_meta_map_vaapi_memory (GstVideoMeta * meta, guint plane, GstAllocator *allocator; GstVaapiVideoMemory *const mem = GST_VAAPI_VIDEO_MEMORY_CAST (gst_buffer_peek_memory (meta->buffer, 0)); + g_return_val_if_fail (mem, FALSE); + g_return_val_if_fail (mem->meta, FALSE); allocator = GST_MEMORY_CAST (mem)->allocator; g_return_val_if_fail (GST_VAAPI_IS_VIDEO_ALLOCATOR (allocator), FALSE); - g_return_val_if_fail (mem->meta, FALSE); g_mutex_lock (&mem->lock); if (mem->map_type && mem->map_type != GST_VAAPI_VIDEO_MEMORY_MAP_TYPE_PLANAR) @@ -340,14 +341,15 @@ gst_video_meta_unmap_vaapi_memory (GstVideoMeta * meta, guint plane, GstAllocator *allocator; GstVaapiVideoMemory *const mem = GST_VAAPI_VIDEO_MEMORY_CAST (gst_buffer_peek_memory (meta->buffer, 0)); - g_return_val_if_fail (mem, FALSE); - allocator = GST_MEMORY_CAST (mem)->allocator; - g_return_val_if_fail (GST_VAAPI_IS_VIDEO_ALLOCATOR (allocator), FALSE); + g_return_val_if_fail (mem, FALSE); g_return_val_if_fail (mem->meta, FALSE); g_return_val_if_fail (mem->surface, FALSE); g_return_val_if_fail (mem->image, FALSE); + allocator = GST_MEMORY_CAST (mem)->allocator; + g_return_val_if_fail (GST_VAAPI_IS_VIDEO_ALLOCATOR (allocator), FALSE); + g_mutex_lock (&mem->lock); if (--mem->map_count == 0) { mem->map_type = 0;