diff options
author | Zhang Rui <bbcallen@gmail.com> | 2015-07-14 14:47:26 +0800 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-07-18 20:23:46 +0200 |
commit | a330aca126eb67d7374f821cbf4765eb6640d00c (patch) | |
tree | 8a479632236904c9dbc06c9c58cfd892fb770481 | |
parent | 2e7bd0f725c8124a3c040fce60e952d802925cdf (diff) | |
download | ffmpeg-a330aca126eb67d7374f821cbf4765eb6640d00c.tar.gz |
avutil/fifo: Fix the case where func() returns less bytes than requested in av_fifo_generic_write()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit fcbea93cf8777bbef2a393d26942b5d3c70a448d)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavutil/fifo.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavutil/fifo.c b/libavutil/fifo.c index 4ff3194c5f..f2fe93de75 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); |