[FFmpeg-cvslog] avutil/fifo: Fix the case where func() returns less bytes than requested in av_fifo_generic_write()

Zhang Rui git at videolan.org
Thu Aug 20 14:53:48 CEST 2015


ffmpeg | branch: release/2.4 | Zhang Rui <bbcallen at gmail.com> | Tue Jul 14 14:47:26 2015 +0800| [7a7ec3ccd9b63e898bb9bafe31ff2475c47cd210] | committer: Michael Niedermayer

avutil/fifo: Fix the case where func() returns less bytes than requested in av_fifo_generic_write()

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit fcbea93cf8777bbef2a393d26942b5d3c70a448d)

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7a7ec3ccd9b63e898bb9bafe31ff2475c47cd210
---

 libavutil/fifo.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavutil/fifo.c b/libavutil/fifo.c
index 77391ee..7cb212e 100644
--- a/libavutil/fifo.c
+++ b/libavutil/fifo.c
@@ -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);



More information about the ffmpeg-cvslog mailing list