From a8d665303757db75da32aebbd2a5d9716e9c528a Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Tue, 16 Dec 2014 10:13:03 -0500 Subject: [PATCH] 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 --- gst/gstbufferpool.c | 10 ++++++---- tests/check/gst/gstbufferpool.c | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/gst/gstbufferpool.c b/gst/gstbufferpool.c index eaf434b47d..60cc77ca38 100644 --- a/gst/gstbufferpool.c +++ b/gst/gstbufferpool.c @@ -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; diff --git a/tests/check/gst/gstbufferpool.c b/tests/check/gst/gstbufferpool.c index 7dcf1bf5d6..96769cb93b 100644 --- a/tests/check/gst/gstbufferpool.c +++ b/tests/check/gst/gstbufferpool.c @@ -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");