mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-19 05:45:58 +00:00
bufferlist: Add test to ensure that buffers in an non-writable list are not writable
https://bugzilla.gnome.org/show_bug.cgi?id=796692
This commit is contained in:
parent
6fa351407a
commit
13a45c0a38
1 changed files with 26 additions and 0 deletions
|
@ -483,6 +483,31 @@ GST_START_TEST (test_new_sized_0)
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
|
GST_START_TEST (test_multiple_mutable_buffer_references)
|
||||||
|
{
|
||||||
|
GstBufferList *b = gst_buffer_list_new_sized (1);
|
||||||
|
GstBuffer *buf1, *buf2;
|
||||||
|
|
||||||
|
gst_buffer_list_add (b, gst_buffer_new ());
|
||||||
|
gst_buffer_list_ref (b);
|
||||||
|
|
||||||
|
buf1 = gst_buffer_list_get (b, 0);
|
||||||
|
buf2 = gst_buffer_list_get (b, 0);
|
||||||
|
|
||||||
|
fail_if (gst_buffer_list_is_writable (b));
|
||||||
|
fail_if (gst_buffer_is_writable (buf1));
|
||||||
|
fail_if (gst_buffer_is_writable (buf2));
|
||||||
|
|
||||||
|
/* Immutable operations that have optimizations for writable buffers
|
||||||
|
* will cause problems now, e.g. read-mapping the buffer and merging
|
||||||
|
* together all the memories and replacing them in the buffer */
|
||||||
|
|
||||||
|
gst_buffer_list_unref (b);
|
||||||
|
gst_buffer_list_unref (b);
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_END_TEST;
|
||||||
|
|
||||||
static Suite *
|
static Suite *
|
||||||
gst_buffer_list_suite (void)
|
gst_buffer_list_suite (void)
|
||||||
{
|
{
|
||||||
|
@ -501,6 +526,7 @@ gst_buffer_list_suite (void)
|
||||||
tcase_add_test (tc_chain, test_get_writable);
|
tcase_add_test (tc_chain, test_get_writable);
|
||||||
tcase_add_test (tc_chain, test_calc_size);
|
tcase_add_test (tc_chain, test_calc_size);
|
||||||
tcase_add_test (tc_chain, test_new_sized_0);
|
tcase_add_test (tc_chain, test_new_sized_0);
|
||||||
|
tcase_add_test (tc_chain, test_multiple_mutable_buffer_references);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue