summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.co.uk>2015-03-01 13:15:40 -0500
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2015-03-14 12:00:53 +0000
commitc740bad1a003e43c732183f18ed242b602e085a2 (patch)
treebef3f1130f4082f9ebf6bb29ef08514e0184f549
parent5e15d4aa603305d71cad5dd8b76fa9f5b25f4779 (diff)
bufferpool: Don't stop the pool in set_config()
Don't stop the pool in set_config(). Instead, let the controlling element manage it. Most of the time, when an active pool is being configured is because the caps didn't change. https://bugzilla.gnome.org/show_bug.cgi?id=745377
-rw-r--r--gst/gstbufferpool.c22
-rw-r--r--tests/check/gst/gstbufferpool.c20
2 files changed, 8 insertions, 34 deletions
diff --git a/gst/gstbufferpool.c b/gst/gstbufferpool.c
index 60cc77ca3..f8657909c 100644
--- a/gst/gstbufferpool.c
+++ b/gst/gstbufferpool.c
@@ -609,9 +609,9 @@ wrong_config:
*
* Set the configuration of the pool. If the pool is already configured, and
* the configuration haven't change, this function will return %TRUE. If the
- * pool is active, this function will try deactivating it. Buffers allocated
- * form this pool must be returned or else this function will do nothing and
- * return %FALSE.
+ * pool is active, this method will return %FALSE and active configuration
+ * will remain. Buffers allocated form this pool must be returned or else this
+ * function will do nothing and return %FALSE.
*
* @config is a #GstStructure that contains the configuration parameters for
* the pool. A default and mandatory set of parameters can be configured with
@@ -645,18 +645,8 @@ gst_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
goto config_unchanged;
/* can't change the settings when active */
- if (priv->active) {
- GST_BUFFER_POOL_UNLOCK (pool);
- if (!gst_buffer_pool_set_active (pool, FALSE)) {
- GST_BUFFER_POOL_LOCK (pool);
- goto was_active;
- }
- GST_BUFFER_POOL_LOCK (pool);
-
- /* not likely but as we released the lock */
- if (priv->active)
- goto was_active;
- }
+ if (priv->active)
+ goto was_active;
/* we can't change when outstanding buffers */
if (g_atomic_int_get (&priv->outstanding) != 0)
@@ -694,7 +684,7 @@ config_unchanged:
was_active:
{
gst_structure_free (config);
- GST_WARNING_OBJECT (pool, "can't change config, we are active");
+ GST_INFO_OBJECT (pool, "can't change config, we are active");
GST_BUFFER_POOL_UNLOCK (pool);
return FALSE;
}
diff --git a/tests/check/gst/gstbufferpool.c b/tests/check/gst/gstbufferpool.c
index 96769cb93..8dd265a13 100644
--- a/tests/check/gst/gstbufferpool.c
+++ b/tests/check/gst/gstbufferpool.c
@@ -179,7 +179,6 @@ GST_START_TEST (test_pool_activation_and_config)
GstBufferPool *pool = gst_buffer_pool_new ();
GstStructure *config = gst_buffer_pool_get_config (pool);
GstCaps *caps = gst_caps_new_empty_simple ("test/data");
- GstBuffer *buffer = NULL;
/* unconfigured pool cannot be activated */
fail_if (gst_buffer_pool_set_active (pool, TRUE));
@@ -192,26 +191,11 @@ GST_START_TEST (test_pool_activation_and_config)
config = gst_buffer_pool_get_config (pool);
fail_unless (gst_buffer_pool_set_config (pool, config));
- /* setting a different config should deactivate the pool */
+ /* setting a different config on active pool should fail */
config = gst_buffer_pool_get_config (pool);
gst_buffer_pool_config_set_params (config, caps, 12, 10, 0);
- fail_unless (gst_buffer_pool_set_config (pool, config));
- fail_if (gst_buffer_pool_is_active (pool));
-
- /* though it should fail if there is outstanding buffers */
- gst_buffer_pool_set_active (pool, TRUE);
- gst_buffer_pool_acquire_buffer (pool, &buffer, NULL);
- fail_if (buffer == NULL);
- config = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_set_params (config, caps, 10, 10, 0);
fail_if (gst_buffer_pool_set_config (pool, config));
-
- /* and work when last buffer is back */
- config = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_set_params (config, caps, 10, 10, 0);
- gst_buffer_unref (buffer);
- fail_unless (gst_buffer_pool_set_config (pool, config));
- fail_unless (gst_buffer_pool_set_active (pool, TRUE));
+ fail_unless (gst_buffer_pool_is_active (pool));
gst_buffer_pool_set_active (pool, FALSE);
gst_object_unref (pool);