mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-06 07:40:00 +08:00
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. Originally committed as revision 13404 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
@ -45,9 +45,6 @@ int av_fifo_size(AVFifoBuffer *f)
|
||||
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 @@ int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void
|
||||
}
|
||||
|
||||
|
||||
/** 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);
|
||||
|
Reference in New Issue
Block a user