bufferpool: Don't check size in config validation
authorNicolas Dufresne <nicolas.dufresne@collabora.co.uk>
Tue, 16 Dec 2014 15:13:03 +0000 (10:13 -0500)
committerNicolas Dufresne <nicolas.dufresne@collabora.co.uk>
Tue, 16 Dec 2014 15:20:37 +0000 (10:20 -0500)
Pools are allowed to change the size in order to adapt padding. So
don't check the size. Normally pool will change the size without
failing set_config(), but it they endup changing the size before
the validate method may fail on a false positive.

https://bugzilla.gnome.org/show_bug.cgi?id=741420

gst/gstbufferpool.c
tests/check/gst/gstbufferpool.c

index eaf434b..60cc77c 100644 (file)
@@ -1049,9 +1049,11 @@ gst_buffer_pool_config_get_allocator (GstStructure * config,
  * Validate that changes made to @config are still valid in the context of the
  * expected parameters. This function is a helper that can be used to validate
  * changes made by a pool to a config when gst_buffer_pool_set_config()
- * returns %FALSE. This expects that @caps and @size haven't changed, and that
- * @min_buffers aren't lower then what we initially expected. This does not check
- * if options or allocator parameters.
+ * returns %FALSE. This expects that @caps haven't changed and that
+ * @min_buffers aren't lower then what we initially expected.
+ * This does not check if options or allocator parameters are still valid,
+ * won't check if size have changed, since changing the size is valid to adapt
+ * padding.
  *
  * Since: 1.4
  *
@@ -1069,7 +1071,7 @@ gst_buffer_pool_config_validate_params (GstStructure * config, GstCaps * caps,
 
   gst_buffer_pool_config_get_params (config, &newcaps, &newsize, &newmin, NULL);
 
-  if (gst_caps_is_equal (caps, newcaps) && (size == newsize)
+  if (gst_caps_is_equal (caps, newcaps) && (newsize >= size)
       && (newmin >= min_buffers))
     ret = TRUE;
 
index 7dcf1bf..96769cb 100644 (file)
@@ -228,8 +228,8 @@ GST_START_TEST (test_pool_config_validate)
 
   fail_unless (gst_buffer_pool_config_validate_params (config, caps, 5, 4, 0));
   fail_unless (gst_buffer_pool_config_validate_params (config, caps, 5, 2, 0));
+  fail_unless (gst_buffer_pool_config_validate_params (config, caps, 4, 4, 0));
   fail_if (gst_buffer_pool_config_validate_params (config, caps, 5, 6, 0));
-  fail_if (gst_buffer_pool_config_validate_params (config, caps, 4, 4, 0));
 
   gst_caps_unref (caps);
   caps = gst_caps_new_empty_simple ("test/data2");