From ca893022342aa2563d4d47a3322d4d4e246e9ab1 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Wed, 21 Mar 2018 20:02:50 -0400 Subject: [PATCH] test: Pool now try to reset the size As a side effect, buffers are no longer expected to be discarded on resize. --- tests/check/gst/gstbufferpool.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/check/gst/gstbufferpool.c b/tests/check/gst/gstbufferpool.c index 8b9b0b3514..f0c3c8d8e7 100644 --- a/tests/check/gst/gstbufferpool.c +++ b/tests/check/gst/gstbufferpool.c @@ -179,7 +179,6 @@ GST_START_TEST (test_buffer_modify_discard) gst_buffer_pool_set_active (pool, TRUE); gst_buffer_pool_acquire_buffer (pool, &buf, NULL); fail_unless (buf != NULL); - prev = buf; buffer_track_destroy (buf, &dcount); /* remove all memory, pool should not reuse this buffer */ gst_buffer_remove_all_memory (buf); @@ -189,25 +188,24 @@ GST_START_TEST (test_buffer_modify_discard) fail_unless_equals_int (dcount, 1); gst_buffer_pool_acquire_buffer (pool, &buf, NULL); - prev = buf; buffer_track_destroy (buf, &dcount); - /* do resize, pool should not reuse this buffer */ + /* do resize, as we didn't modify the memory, pool should reuse this buffer */ gst_buffer_resize (buf, 5, 2); gst_buffer_unref (buf); - /* buffer should've been destroyed instead of going back into pool */ - fail_unless_equals_int (dcount, 2); + /* buffer should've gone back into pool */ + fail_unless_equals_int (dcount, 1); gst_buffer_pool_acquire_buffer (pool, &buf, NULL); prev = buf; - buffer_track_destroy (buf, &dcount); + fail_unless (buf == prev, "got a fresh buffer instead of previous"); /* keep ref to memory, not exclusive so pool should reuse this buffer */ mem = gst_buffer_get_memory (buf, 0); gst_buffer_unref (buf); gst_memory_unref (mem); /* buffer should not have been destroyed and gone back into pool */ - fail_unless_equals_int (dcount, 2); + fail_unless_equals_int (dcount, 1); gst_buffer_pool_acquire_buffer (pool, &buf, NULL); fail_unless (buf == prev, "got a fresh buffer instead of previous"); @@ -221,7 +219,7 @@ GST_START_TEST (test_buffer_modify_discard) /* buffer should have been destroyed and not gone back into pool because * of the exclusive lock */ - fail_unless_equals_int (dcount, 3); + fail_unless_equals_int (dcount, 2); gst_buffer_pool_set_active (pool, FALSE); gst_object_unref (pool);