changeset 510:b7593ce78422 libavutil

Make av_fifo*_read() ignore the available amount of data. This is more efficient as in practice the check is redundant most of the time. Callers which do not know if enough data is available have to check it with av_fifo_size(). Doing the check in *read() means the caller has no choice to skip the check when its known to be redundant. Also the return value was never documented in a public header so changing it should not break the API. Besides this fixes the case where read() failed on a 100% full fifo.
author michael
date Sun, 25 May 2008 22:20:39 +0000
parents 8e2f8b81f59f
children 5accd0bccc76
files fifo.c
diffstat 1 files changed, 0 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/fifo.c	Fri May 23 12:37:52 2008 +0000
+++ b/fifo.c	Sun May 25 22:20:39 2008 +0000
@@ -45,9 +45,6 @@
     return size;
 }
 
-/**
- * Get data from the fifo (returns -1 if not enough data).
- */
 int av_fifo_read(AVFifoBuffer *f, uint8_t *buf, int buf_size)
 {
     return av_fifo_generic_read(f, buf_size, NULL, buf);
@@ -97,13 +94,8 @@
 }
 
 
-/** get data from the fifo (return -1 if not enough data) */
 int av_fifo_generic_read(AVFifoBuffer *f, int buf_size, void (*func)(void*, void*, int), void* dest)
 {
-    int size = av_fifo_size(f);
-
-    if (size < buf_size)
-        return -1;
     do {
         int len = FFMIN(f->end - f->rptr, buf_size);
         if(func) func(dest, f->rptr, len);