]> git.tuebingen.mpg.de Git - paraslash.git/commit
btr: Introduce btr_add_output_dont_free().
authorAndre Noll <maan@systemlinux.org>
Tue, 23 Aug 2011 19:04:02 +0000 (21:04 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 8 Jul 2012 17:06:39 +0000 (17:06 +0000)
commit6d9c357ff64e799dfeacda6a176012de10c7f5c1
tree3cb8a78f863c4215c6ff4912f16055bdf449ff71
parent4ac3134c050ba28b57e0ae9686eb1f6d83e6d586
btr: Introduce btr_add_output_dont_free().

At the moment, all buffers which are fed to a buffer tree must be
allocated on the heap since the buffer tree code automatically frees
the buffer once its refcount dropped to zero.

The new afh receiver, however, mmaps the audio file and likes to feed
chunks of this memory map into the buffer tree. This is currently
impossible because such buffers must not be freed.

This patch adds the new public function btr_add_output_dont_free()
which works like btr_add_output() but sets the new dont_free bit
which prevents the buffer from being deallocated.

Also btr_inplace_ok() is changed to return "false" whenever there
exists a buffer in the input queue with the dont_free bit set.
buffer_tree.c
buffer_tree.h