]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/aviobuf.c
avformat/aviobuf: Allow seeking to the end of the buffer for read only buffers
[ffmpeg] / libavformat / aviobuf.c
index 0b0748e954680c0b952d71f1cdc829cbb36f5444..3d77a7ff25427b3ab08fb111fa50b9986cac0a03 100644 (file)
@@ -228,7 +228,7 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
 
     offset1 = offset - pos;
     if (!s->must_flush && (!s->direct || !s->seek) &&
-        offset1 >= 0 && offset1 <= buffer_size) {
+        offset1 >= 0 && offset1 <= buffer_size - s->write_flag) {
         /* can do the seek inside the buffer */
         s->buf_ptr = s->buffer + offset1;
     } else if ((!s->seekable ||