bufferpool: Don't check size in config validation

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
This commit is contained in:
Nicolas Dufresne 2014-12-16 10:13:03 -05:00
parent 6f136b5399
commit a8d6653037
2 changed files with 7 additions and 5 deletions

View 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;

View 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");