basesrc: always activate the pool we get

Activate the pool when we get it from the allocation query.
This commit is contained in:
Wim Taymans 2011-06-20 17:32:11 +02:00
parent 3822eea7cf
commit fc5b0b09da

View file

@ -2600,13 +2600,18 @@ null_buffer:
} }
} }
static void static gboolean
gst_base_src_set_allocation (GstBaseSrc * basesrc, GstBufferPool * pool, gst_base_src_set_allocation (GstBaseSrc * basesrc, GstBufferPool * pool,
const GstMemoryAllocator * allocator, guint prefix, guint alignment) const GstMemoryAllocator * allocator, guint prefix, guint alignment)
{ {
GstBufferPool *oldpool; GstBufferPool *oldpool;
GstBaseSrcPrivate *priv = basesrc->priv; GstBaseSrcPrivate *priv = basesrc->priv;
if (pool) {
if (!gst_buffer_pool_set_active (pool, TRUE))
goto activate_failed;
}
GST_OBJECT_LOCK (basesrc); GST_OBJECT_LOCK (basesrc);
oldpool = priv->pool; oldpool = priv->pool;
priv->pool = pool; priv->pool = pool;
@ -2621,6 +2626,14 @@ gst_base_src_set_allocation (GstBaseSrc * basesrc, GstBufferPool * pool,
gst_buffer_pool_set_active (oldpool, FALSE); gst_buffer_pool_set_active (oldpool, FALSE);
gst_object_unref (oldpool); gst_object_unref (oldpool);
} }
return TRUE;
/* ERRORS */
activate_failed:
{
GST_ERROR_OBJECT (basesrc, "failed to activate bufferpool.");
return FALSE;
}
} }
static gboolean static gboolean
@ -2689,22 +2702,13 @@ gst_base_src_prepare_allocation (GstBaseSrc * basesrc, GstCaps * caps)
gst_buffer_pool_config_set (config, caps, size, min, max, prefix, gst_buffer_pool_config_set (config, caps, size, min, max, prefix,
alignment); alignment);
gst_buffer_pool_set_config (pool, config); gst_buffer_pool_set_config (pool, config);
if (!gst_buffer_pool_set_active (pool, TRUE))
goto activate_failed;
} }
result =
gst_base_src_set_allocation (basesrc, pool, allocator, prefix, alignment); gst_base_src_set_allocation (basesrc, pool, allocator, prefix, alignment);
return result; return result;
/* ERRORS */
activate_failed:
{
GST_ERROR_OBJECT (basesrc, "failed to activate bufferpool.");
gst_object_unref (pool);
return FALSE;
}
} }
/* default negotiation code. /* default negotiation code.