Commit f81b99b8 authored by Michael Niedermayer's avatar Michael Niedermayer

simplify

Originally committed as revision 7568 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 80036204
...@@ -50,15 +50,12 @@ int av_fifo_size(AVFifoBuffer *f) ...@@ -50,15 +50,12 @@ int av_fifo_size(AVFifoBuffer *f)
*/ */
int av_fifo_read(AVFifoBuffer *f, uint8_t *buf, int buf_size) int av_fifo_read(AVFifoBuffer *f, uint8_t *buf, int buf_size)
{ {
int len; int size = av_fifo_size(f);
int size = f->wptr - f->rptr;
if (size < 0)
size += f->end - f->buffer;
if (size < buf_size) if (size < buf_size)
return -1; return -1;
while (buf_size > 0) { while (buf_size > 0) {
len = FFMIN(f->end - f->rptr, buf_size); int len = FFMIN(f->end - f->rptr, buf_size);
memcpy(buf, f->rptr, len); memcpy(buf, f->rptr, len);
buf += len; buf += len;
f->rptr += len; f->rptr += len;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment