kmsbufferpool: error only if no allocator
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Fri, 20 May 2016 17:25:57 +0000 (19:25 +0200)
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Mon, 23 May 2016 20:06:29 +0000 (22:06 +0200)
Do not expect an allocator from the configuration, but expect to have already
one set.

sys/kms/gstkmsbufferpool.c

index c69a4f3..329135c 100644 (file)
@@ -85,13 +85,14 @@ gst_kms_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
   gst_buffer_pool_config_get_allocator (config, &allocator, &params);
 
   /* not our allocator, not our buffers */
-  if (!allocator || !GST_IS_KMS_ALLOCATOR (allocator))
-    goto wrong_allocator;
-
-  if (priv->allocator)
-    gst_object_unref (priv->allocator);
-  if ((priv->allocator = allocator))
-    gst_object_ref (allocator);
+  if (allocator && GST_IS_KMS_ALLOCATOR (allocator)) {
+    if (priv->allocator)
+      gst_object_unref (priv->allocator);
+    if ((priv->allocator = allocator))
+      gst_object_ref (allocator);
+  }
+  if (!priv->allocator)
+    goto no_allocator;
 
   priv->vinfo = vinfo;
 
@@ -118,9 +119,9 @@ wrong_caps:
         "failed getting geometry from caps %" GST_PTR_FORMAT, caps);
     return FALSE;
   }
-wrong_allocator:
+no_allocator:
   {
-    GST_WARNING_OBJECT (pool, "invalid allocator: %" GST_PTR_FORMAT, allocator);
+    GST_WARNING_OBJECT (pool, "no valid allocator in pool");
     return FALSE;
   }
 }