summaryrefslogtreecommitdiffstats
path: root/libhb/fifo.c
diff options
context:
space:
mode:
Diffstat (limited to 'libhb/fifo.c')
-rw-r--r--libhb/fifo.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libhb/fifo.c b/libhb/fifo.c
index 42af6d9eb..7b5660673 100644
--- a/libhb/fifo.c
+++ b/libhb/fifo.c
@@ -196,6 +196,21 @@ void hb_buffer_realloc( hb_buffer_t * b, int size )
}
}
+void hb_buffer_reduce( hb_buffer_t * b, int size )
+{
+ if ( size < b->alloc / 8 || b->data == NULL )
+ {
+ uint32_t orig = b->alloc;
+ size = size_to_pool( size )->buffer_size;
+ b->data = realloc( b->data, size );
+ b->alloc = size;
+
+ hb_lock(buffers.lock);
+ buffers.allocated += size - orig;
+ hb_unlock(buffers.lock);
+ }
+}
+
// Frees the specified buffer list.
void hb_buffer_close( hb_buffer_t ** _b )
{