summaryrefslogtreecommitdiff
path: root/libavutil/fifo.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavutil/fifo.c')
-rw-r--r--libavutil/fifo.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavutil/fifo.c b/libavutil/fifo.c
index f2ace514bd..eda3558436 100644
--- a/libavutil/fifo.c
+++ b/libavutil/fifo.c
@@ -22,8 +22,9 @@
#include "common.h"
#include "fifo.h"
-int av_fifo_init(AVFifoBuffer *f, int size)
+int av_fifo_init(AVFifoBuffer *f, unsigned int size)
{
+ size= FFMAX(size, size+1);
f->wptr = f->rptr =
f->buffer = av_malloc(size);
f->end = f->buffer + size;
@@ -56,7 +57,7 @@ int av_fifo_read(AVFifoBuffer *f, uint8_t *buf, int buf_size)
void av_fifo_realloc(AVFifoBuffer *f, unsigned int new_size) {
unsigned int old_size= f->end - f->buffer;
- if(old_size < new_size){
+ if(old_size <= new_size){
int len= av_fifo_size(f);
AVFifoBuffer f2;