Commit graph

25 commits

Author SHA1 Message Date
Miguel Paris
2ef0fd1862 bufferlist: foreach: always remove as parent if buffer is changed
In case the buffer is not writable, the parent (the BufferList) is not
removed before calling func. So if it is changed, the parent (the BufferList)
of the previous buffer should be removed after calling func.
2020-03-18 14:43:08 +01:00
Sebastian Dröge
cb51bd6b31 bufferlist: Prevent gst_buffer_list_foreach() from modifying non-writeable lists
Previously gst_buffer_list_foreach() could modify (drop or replace)
buffers in non-writable lists, which could cause all kinds of problems
if other code also has a reference to the list and assumes that it stays
the same.

https://bugzilla.gnome.org/show_bug.cgi?id=796692
2018-07-09 09:45:45 +02:00
Sebastian Dröge
13a45c0a38 bufferlist: Add test to ensure that buffers in an non-writable list are not writable
https://bugzilla.gnome.org/show_bug.cgi?id=796692
2018-07-09 09:45:45 +02:00
Tim-Philipp Müller
a5ecb465a9 bufferlist: fix abort due to underflow when creating 0-sized list
gst_buffer_list_new_sized(0) will cause an underflow in a calculation
which then makes it try to allocate huge amounts of memory, which
may lead to aborts.

https://bugzilla.gnome.org/show_bug.cgi?id=795758
2018-05-05 16:20:05 +02:00
Tim-Philipp Müller
3b54dace2d tests: include config.h and don't include unix headers
In many cases the unistd.h includes weren't actually needed.

Preparation for making tests work on Windows with MSVC.
2017-11-24 13:41:20 +01:00
Tim-Philipp Müller
8f26af8b02 bufferlist: add gst_buffer_list_calculate_size()
Returns size in bytes.
2017-09-17 12:35:25 +01:00
Tim-Philipp Müller
177c4ffe6a bufferlist: add gst_buffer_list_get_writable()
Ensures buffer is writable. Useful if we want to change
metadata on it such as timestamps.

https://bugzilla.gnome.org/show_bug.cgi?id=750241
2017-09-17 12:24:25 +01:00
Hyunjun Ko
7ecef53dbb bufferlist: add new api gst_buffer_list_copy_deep
https://bugzilla.gnome.org/show_bug.cgi?id=751420
2015-06-24 10:52:56 +02:00
Tim-Philipp Müller
14ae3cf56c tests: don't use post-GLib 2.32 API in bufferlist test
g_ptr_array_insert() is GLib >= 2.40
2014-07-02 08:41:44 +01:00
Tim-Philipp Müller
ddd5e30726 tests: add another buffer list test case 2014-06-26 14:16:20 +01:00
Tim-Philipp Müller
9823a5f7b4 tests: port and re-enable buffer list tests
And remove some which don't apply any more.
2014-06-26 14:16:16 +01:00
Tim-Philipp Müller
5c62bce85c tests: remove some cruft from the bufferlist test
Buffers no longer carry caps, and bufferlists don't have
groups where buffers may need to be merged into one any more.
2014-06-17 14:39:00 +01:00
Tim-Philipp Müller
b314ac8291 tests: add test for gst_buffer_list_remove() 2014-06-16 20:30:32 +01:00
Tim-Philipp Müller
666c8c11c6 Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-03 20:44:48 +00:00
Wim Taymans
88e12228cf bufferlist: clean up API
gst_buffer_list_len() -> gst_buffer_list_length()
gst_buffer_list_sized_new() -> gst_buffer_list_new_sized()
2011-11-02 08:59:43 +01:00
Wim Taymans
021f09d622 tests: fix compilation 2011-10-27 17:09:51 +02:00
Wim Taymans
468ec5bc40 bufferlist: simplify bufferlists
We now have multiple memory blocks as part of the buffers and we can therefore
reduce the bufferlist to a simple array of buffers.
2011-03-31 17:51:02 +02:00
Wim Taymans
121ab46aa6 memory: remove memory metadata again 2011-03-28 20:08:46 +02:00
Wim Taymans
4a9a59df08 tests: make some tests compile 2011-03-28 20:08:46 +02:00
Jonas Holmberg
c4c06a2b88 bufferlist: Use a GQueue instead of a GList
Adding a buffer to the end of a GstBufferList is supposed to be a fast
operation, but it was not since the iterator does not advance its
nextpointer when adding buffers and GList does not have a tail pointer.
Using a GQueue to store the buffers makes it easier to add buffers to
the end of the list and this operation will now be much more efficient.

Adding an entire GList of buffers using
gst_buffer_list_iterator_add_list() will however have to iterate over
the list being added to be able to update the tail pointer in the
GQueue.
2011-03-11 14:31:14 +01:00
Wim Taymans
0447e72c97 bufferlist: add function to add a list of buffers
Add a function to add a list of buffers to the bufferlist.
2010-09-17 17:35:45 +02:00
Benjamin Otte
a9d1a493a7 Fixes for -Wwrite-strings
This changes some APIs in compatible ways:
- Some functions now take "const char *" arguments, not "char *"
- Some structs now have "conts char *" members, not "char *"
The changes may cause warnings when compiling with the right warning
flags. You've been warned.

Also adds -Wwrite-strings as a warning flag in configure.ac.

https://bugzilla.gnome.org/show_bug.cgi?id=611692
2010-03-10 20:50:10 +01:00
Tim-Philipp Müller
2b4d127ca0 tests: fix crash and leak in bufferlists unit test
Don't access already-freed iterator, makes check-valgrind work and fixes
crash on PPC; unref buffer we're going to steal to make valgrind happy.
2009-06-21 14:43:08 +01:00
Wim Taymans
6438f6f9b9 bufferlist: Various cleanups
Add new method to iterate a bufferlist without having to allocate an iterator.
Add convenience method for getting an item from the list based on the group and
index.
Remove redundant _do_data callback and method.
Update unit-tests and add some more for the new methods.
2009-06-19 15:31:53 +02:00
Jonas Holmberg
d99cf4db1b bufferlist: add docs/build/debug/unittest
See #572285
2009-05-12 15:18:52 +02:00