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>
Tue, 14 Jul 2015 15:28:55 +0000 (17:28 +0200)
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);