Commit graph

122 commits

Author SHA1 Message Date
Nicolas Dufresne
c740bad1a0 bufferpool: Don't stop the pool in set_config()
Don't stop the pool in set_config(). Instead, let the controlling
element manage it. Most of the time, when an active pool is being
configured is because the caps didn't change.

https://bugzilla.gnome.org/show_bug.cgi?id=745377
2015-03-14 12:00:53 +00:00
Nicolas Dufresne
a8d6653037 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
2014-12-16 10:20:37 -05:00
Wim Taymans
6f136b5399 bufferpool: log reason for discarded buffers
PERFORMANCE log the reason why a buffer could not be recycled in the
bufferpool.
2014-12-16 12:22:56 +01:00
Mohammed Sameer
59749833bb bufferpool: Add missing error checking to default_alloc_buffer()
default_alloc_buffer() calls gst_buffer_new_allocate() but does not check for
failed allocation.

This patch makes default_alloc_buffer() return an error (GST_FLOW_ERROR) if
buffer allocation fails.

https://bugzilla.gnome.org/show_bug.cgi?id=733974
2014-07-30 09:02:20 -04:00
Evan Nemerson
5abc82e9f3 introspection: Assorted minor introspection and documentation fixes
https://bugzilla.gnome.org/show_bug.cgi?id=732534
2014-07-01 09:03:41 +02:00
Evan Nemerson
4088363aea introspection: add some missing allow-none annotations to in params
https://bugzilla.gnome.org/show_bug.cgi?id=730957
2014-06-26 19:00:58 +02:00
Evan Nemerson
e10266e3f3 docs: convert NULL, TRUE, and FALSE to %NULL, %TRUE, and %FALSE
This should help improve documentation generated for
languages other than C.

https://bugzilla.gnome.org/show_bug.cgi?id=730961
2014-05-30 00:20:27 +01:00
Evan Nemerson
4397150d54 bufferpool: fix gst_buffer_pool_has_option() documentation
https://bugzilla.gnome.org/show_bug.cgi?id=730962
2014-05-29 23:18:18 +01:00
Nicolas Dufresne
103a40b6ce bufferpool: Add method and virtuals to set flushing state
Currently there is no other way to unlock a buffer pool other then
stopping it. This may have the effect of freeing all the buffers,
which is too heavy for a seek. This patch add a method to enter and
leave flushing state. As a convenience, flush_start/flush_stop
virtual are added so pool implementation can also unblock their own
internal poll atomically with the rest of the pool.  This is fully
backward compatible with doing stop/start to actually flush the pool
(as being done in GstBaseSrc).

https://bugzilla.gnome.org/show_bug.cgi?id=727611
2014-05-26 13:31:21 -04:00
Nicolas Dufresne
194db480e0 bufferpool: Add an helper to validate config
When we call gst_buffer_pool_set_config() the pool may return FALSE and
slightly change the parameters. This helper is useful to do the minial required
validation before accepting the modified configuration.

https://bugzilla.gnome.org/show_bug.cgi?id=727916
2014-05-08 13:11:14 -04:00
Nicolas Dufresne
43acfbbb86 bufferpool: Update the configure even if set_config() returned false
According to the documentation, when set_config() return false, it should be
possible to read the modified version of the config. This patch fixes the
implementation so it is now according to the documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=727916
2014-05-08 13:08:21 -04:00
Nicolas Dufresne
6079666a71 bufferpool: Add support for reconfiguring a pool
If a pool config is being configured again, check if the configuration have changed.
If not, skip that step. Finally, if the pool is active, try deactivating it.

https://bugzilla.gnome.org/show_bug.cgi?id=728268
2014-05-08 13:08:21 -04:00
Stian Selnes
40c8208ad2 bufferpool: fix log message of buffer pointer 2014-05-01 10:03:39 +02:00
Tim-Philipp Müller
6eb6d9ec38 docs: remove outdated and pointless 'Last reviewed' lines from docs
They are very confusing for people, and more often than not
also just not very accurate. Seeing 'last reviewed: 2005' in
your docs is not very confidence-inspiring. Let's just remove
those comments.
2014-04-26 21:21:51 +01:00
Nicolas Dufresne
ec69ad4e8a buffer: Only set TAG_MEMORY if the memory has been replaced
Currently we set TAG_MEMORY as soon a resize changes the size of one
of the memory. This has the side effect that buffer pool cannot know if
the memory have simply been resized, or if the memorys has been replaced.
This make it hard to actually implement _reset(). Instead, only set the
TAG_MEMORY if one or more memory has been replaced, and do a light
sanity check of the size.

https://bugzilla.gnome.org/show_bug.cgi?id=727109
2014-04-26 15:03:04 -04:00
Tim-Philipp Müller
313f01ab79 buffer: invert meaning of GST_BUFFER_FLAG_TAG_MEMORY
It's nicer to only have it set when something noteworthy
happened and otherwise unset.

https://bugzilla.gnome.org/show_bug.cgi?id=725862
2014-03-07 20:43:44 +00:00
Sebastian Rasmussen
034a3ab86f docs: Fix typos and remove unknown annotations
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=725517
2014-03-02 21:47:52 +01:00
Wim Taymans
7691150c45 bufferpool: only release buffers with writable memory
Check if the memory is writable before releasing the buffer into the
pool again.
Add unit test for this scenario.
2014-02-27 16:40:34 +01:00
Wim Taymans
f22d8f08e0 bufferpool: Use TAG_MEMORY to check memory before releasing
Tag allocated buffers with TAG_MEMORY. When they are released later,
only add them back to the pool if the tag is still there and the memory
has not been changed, otherwise throw the buffer away.
Add unit test to check various scenarios.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=724481
2014-02-27 15:43:13 +01:00
Wim Taymans
301fa0e935 bufferpool: refactor free_buffer
Make a do_free_buffer method to also decrements the number of allocated
buffers. Stop will now be successful when all buffers are freed.
2014-02-27 15:43:13 +01:00
Brendan Long
f605472230 docs: gst_pad_new_from_*_template and gst_buffer_pool_new constructors return floating references
https://bugzilla.gnome.org/show_bug.cgi?id=710342
2014-02-06 22:50:53 +01:00
Stefan Sauer
c42780db66 bufferpool: more tests and small doc fixes 2014-01-31 08:36:55 +01:00
Stefan Sauer
1bad32b577 bufferpool: misc cleanups
Review the documentation, comments and logging. Set the initial size to 16 as
the size is rounded up to the next power of two anyway.
2014-01-30 12:43:45 +01:00
Wim Taymans
878621f6f5 bufferpool: avoid excessive GstPoll activity
Keep an extra write ref on the control socket. This ensures that we
avoid a read/write on the socket when going from non-empty->empty->not-empty.
We remove the write ref only when we actually are empty and we need to
wait for flushing or a new buffer.

This makes the bufferpool benchmark about 30% faster than the pure
malloc implementation.
2014-01-30 12:31:48 +01:00
Edward Hervey
2e1db58e11 gstvalue: Add _append_and_take_value() public variants
API: gst_value_array_append_and_take_value
API: gst_value_list_append_and_take_value

We were already using this internally, this makes it public for code
which frequently appends values which are expensive to copy (like
structures, arrays, caps, ...).

Avoids copies of the values for users. The passed GValue will also
be 0-memset'ed for re-use.

New users can replace this kind of code:
gst_value_*_append_value(mycontainer, &myvalue);
g_value_unset(&myvalue);

by:

gst_value_*_append_and_take_value(mycontainer, &myvalue);

https://bugzilla.gnome.org/show_bug.cgi?id=701632
2013-06-05 12:58:05 +02:00
Wim Taymans
ff0deeed9a bufferpool: fix docs 2013-04-04 16:39:23 +02:00
Matthew Waters
718b6b2471 bufferpool: lock before unlock in _get_config
Fixes deadlock on Windows

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=687896
2012-11-08 09:08:09 +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
Tim-Philipp Müller
dddcc31c42 docs: fix up docs a bit 2012-08-11 23:41:33 +01:00
Wim Taymans
fb78756679 bufferpool: fix max_buffers handling
When max_buffers > 0 and the pool is empty, actually try to allocate more
buffers up to the max_buffers limit.
We need to add a counter for this to count how many buffers we allocated and
check this against the max_buffers limit.
Reorganise and clean up some code.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=681153
2012-08-10 12:23:03 +02:00
Wim Taymans
f362f643ac memory: Make GstAllocator a GstObject
Make GstAllocator a GstObject instead of a GstMiniObject, like bufferpool.
Make a new gstallocator.c file. Make a GstAllocator subclass for the default
allocator.
2012-07-09 16:28:22 +02:00
Wim Taymans
95f016b795 bufferpool: update docs a little 2012-06-18 12:15:57 +02:00
Wim Taymans
2d19ed41c8 bufferpool:check caps argument
Caps should be NULL or fixed when configured in a bufferpool
2012-06-18 10:13:38 +02:00
Wim Taymans
b67be761e0 bufferpool: Reset the buffer before releasing into pool
Reset the buffer not after we acquire but before we release into the pool. This
makes sure that the pool only has buffers in a clean state and that we can set
extra metadata on buffers in the acquire method. this means that we need to
remove an argument from the method.
2012-04-25 09:09:01 +02:00
Wim Taymans
6fae137027 meta: add LOCKED flag
Add a new LOCKED flag to the metadata. Refuse removing LOCKED metadata from
a buffer.
Mark the metadata from the bufferpool LOCKED.
Add unit test for LOCKED flag
2012-04-17 15:55:10 +02:00
Wim Taymans
9aa9751938 review some docs 2012-03-28 18:12:23 +02:00
Wim Taymans
08f33d8d93 bufferpool: remove const from get/set_param
Remove the const from the GstCaps in get/set_param. set_param modifies
the refcount of the caps.
Don't increment the refcount of the caps result of get_param like we
do with other objects.
Update some annotiations.
2012-03-27 12:48:59 +02:00
Wim Taymans
f09ab3b007 bufferpool: fix annotation for _release
_release takes ownership of the buffer
2012-03-27 12:48:59 +02:00
Wim Taymans
3776eb9e25 bufferpool: check min/max_buffers 2012-03-26 17:38:50 +02:00
Wim Taymans
a7e6c7d2a8 bufferpool: split bufferpool configuration
Make separate methods to control the bufferpool and the allocator used by the
bufferpool.
Make it possible to change the allocator of a pool.
2012-03-15 22:09:02 +01:00
Wim Taymans
9a1cd17136 GstBufferPoolParams -> GstBufferPoolAcquireParams
Because those flags are not from the bufferpool but for the acquire function.
2012-03-15 14:01:44 +01:00
Wim Taymans
85c9543841 memory: group allocation parameters in a struct
Group the extra allocation parameters in a GstAllocationParams structure to make
it easier to deal with them and so that we can extend them later if needed.
Make gst_buffer_new_allocate() take the GstAllocationParams for added
functionality.
Add boxed type for GstAllocationParams.
2012-03-15 13:42:17 +01:00
Wim Taymans
edd2ffe4d4 memory: Add 0 padding
Change gst_allocator_alloc() so that we can also spicify flags and padding.
Add 2 new flags to mark the memory 0 prefixed/padded. This allows us to
remove some resizes in the base classes.
When allocating memory, memset prefix and padding with 0 when the flags tell
us to.
On resize, clear the zero padding flags if we can't guarantee the memory is
still 0 filled.
Update tests.
2012-03-14 21:32:22 +01:00
Wim Taymans
3d76e6011c query: also include padding in ALLOCATION query
Negotiating padding is needed on second thought so include it in the
ALLOCATION query.
Make the bufferpool take padding into account when allocating.
Make basesrc take padding into account.
Use padding and prefix when allocating in basetransform.
2012-03-14 19:47:10 +01:00
Mark Nauwelaerts
f2d81f4c3d bufferpool: free owned discarded pool config 2012-03-14 17:20:01 +01:00
Wim Taymans
b3c8264a14 bufferpool: add more debug info 2012-03-02 17:03:49 +01:00
Wim Taymans
b95ceeb09b remove some useless includes in .h 2012-02-27 09:48:06 +01:00
Wim Taymans
10056f1833 bufferpool: make more stuff private 2012-02-27 09:11:36 +01:00
Wim Taymans
7ab1d62c24 GST_FLOW_WRONG_STATE -> GST_FLOW_FLUSHING 2012-02-08 16:18:04 +01:00
Tim-Philipp Müller
78ccf77fa3 bufferpool: use GstValueArray instead of GValueArray for storing options in the config
Since GValueArray is deprecated. It's all only internal anywhere here,
but if we use GstValueArray the option strings get serialized nicely
in the debug logs at least.
2012-01-26 10:44:11 +00:00