vaapivideobufferpool: check for vaapi meta first
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Wed, 29 Jan 2020 10:54:38 +0000 (11:54 +0100)
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Sun, 2 Feb 2020 16:22:43 +0000 (17:22 +0100)
If the configured meta doesn't request vaapi meta then it is not a
vaapi buffer pool. Bail out as soon as possible.

gst/vaapi/gstvaapivideobufferpool.c

index 09744f9..d6f4752 100644 (file)
@@ -154,6 +154,10 @@ gst_vaapi_video_buffer_pool_set_config (GstBufferPool * pool,
   if (!gst_video_info_from_caps (&new_allocation_vinfo, caps))
     goto error_invalid_caps;
 
+  if (!gst_buffer_pool_config_has_option (config,
+          GST_BUFFER_POOL_OPTION_VAAPI_VIDEO_META))
+    goto error_no_vaapi_video_meta_option;
+
   allocator = NULL;
   if (!gst_buffer_pool_config_get_allocator (config, &allocator, NULL))
     goto error_invalid_allocator;
@@ -198,10 +202,6 @@ gst_vaapi_video_buffer_pool_set_config (GstBufferPool * pool,
     }
   }
 
-  if (!gst_buffer_pool_config_has_option (config,
-          GST_BUFFER_POOL_OPTION_VAAPI_VIDEO_META))
-    goto error_no_vaapi_video_meta_option;
-
   /* create a new allocator if needed */
   if (!allocator) {
     if (priv->use_dmabuf_memory) {