[FFmpeg-cvslog] avio: Do not consider the end-of-buffer position valid

Luca Barbato git at videolan.org
Wed Jan 28 21:16:00 CET 2015


ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Sat Jan 24 13:06:19 2015 +0100| [3c18a7b18807de81566381a1bcbe9f6103c0296b] | committer: Luca Barbato

avio: Do not consider the end-of-buffer position valid

Trigger a refill if the seek action moves the pointer
at the end of the buffer.

Before this patch the read action following the seek would trigger
the refill, while write action would write outside the buffer.

In the Libav codebase few muxers seek forward outside of what
already has been written so it is quite unlikely to experience
the problem with the default buffer size.

CC: libav-stable at libav.org

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

 libavformat/aviobuf.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 6923b78..5f848b2 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -206,7 +206,7 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
     }
     offset1 = offset - pos;
     if (!s->must_flush &&
-        offset1 >= 0 && offset1 <= (s->buf_end - s->buffer)) {
+        offset1 >= 0 && offset1 < (s->buf_end - s->buffer)) {
         /* can do the seek inside the buffer */
         s->buf_ptr = s->buffer + offset1;
     } else if ((!s->seekable ||



More information about the ffmpeg-cvslog mailing list