plugins: avoid to get/set pool config twice
authorVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Tue, 24 May 2016 11:39:25 +0000 (13:39 +0200)
committerVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Tue, 24 May 2016 11:39:25 +0000 (13:39 +0200)
This patch is a bit of optimization, since the bufferpool configuration is get
when the pool is created. Hence, we only need to request it when the pool from
the allocation query is reused.

gst/vaapi/gstvaapipluginbase.c

index f7fc2ee..90e935c 100644 (file)
@@ -734,6 +734,7 @@ gst_vaapi_plugin_base_decide_allocation (GstVaapiPluginBase * plugin,
     min = max = 0;
   }
 
+  config = NULL;
   if (!pool) {
     pool = gst_vaapi_video_buffer_pool_new (plugin->display);
     if (!pool)
@@ -743,11 +744,10 @@ gst_vaapi_plugin_base_decide_allocation (GstVaapiPluginBase * plugin,
     gst_buffer_pool_config_set_params (config, caps, size, min, max);
     gst_buffer_pool_config_add_option (config,
         GST_BUFFER_POOL_OPTION_VAAPI_VIDEO_META);
-    if (!gst_buffer_pool_set_config (pool, config))
-      goto error_config_failed;
   }
 
-  config = gst_buffer_pool_get_config (pool);
+  if (!config)
+    config = gst_buffer_pool_get_config (pool);
 
   /* Check whether GstVideoMeta, or GstVideoAlignment, is needed (raw video) */
   if (has_video_meta) {