avutil/fifo: Fix the case where func() returns less bytes than requested in av_fifo_g...
authorZhang Rui <bbcallen@gmail.com>
Tue, 14 Jul 2015 06:47:26 +0000 (14:47 +0800)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 18 Jul 2015 18:23:46 +0000 (20:23 +0200)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit fcbea93cf8777bbef2a393d26942b5d3c70a448d)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavutil/fifo.c

index 4ff3194..f2fe93d 100644 (file)
@@ -129,7 +129,8 @@ int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size,
     do {
         int len = FFMIN(f->end - wptr, size);
         if (func) {
-            if (func(src, wptr, len) <= 0)
+            len = func(src, wptr, len);
+            if (len <= 0)
                 break;
         } else {
             memcpy(wptr, src, len);