kmsbufferpool: error only if no allocator

Do not expect an allocator from the configuration, but expect to have already
one set.
This commit is contained in:
Víctor Manuel Jáquez Leal 2016-05-20 19:25:57 +02:00
parent 3b872650aa
commit f778a3f19a

View file

@ -85,13 +85,14 @@ gst_kms_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
gst_buffer_pool_config_get_allocator (config, &allocator, &params); gst_buffer_pool_config_get_allocator (config, &allocator, &params);
/* not our allocator, not our buffers */ /* not our allocator, not our buffers */
if (!allocator || !GST_IS_KMS_ALLOCATOR (allocator)) if (allocator && GST_IS_KMS_ALLOCATOR (allocator)) {
goto wrong_allocator; if (priv->allocator)
gst_object_unref (priv->allocator);
if (priv->allocator) if ((priv->allocator = allocator))
gst_object_unref (priv->allocator); gst_object_ref (allocator);
if ((priv->allocator = allocator)) }
gst_object_ref (allocator); if (!priv->allocator)
goto no_allocator;
priv->vinfo = vinfo; priv->vinfo = vinfo;
@ -118,9 +119,9 @@ wrong_caps:
"failed getting geometry from caps %" GST_PTR_FORMAT, caps); "failed getting geometry from caps %" GST_PTR_FORMAT, caps);
return FALSE; 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; return FALSE;
} }
} }