X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Faviobuf.c;h=dfefe62ecdc7d322b51eddc6a9aef129032b79f5;hb=2cbadf51e80a5b155c0e3444f0bd302096398139;hp=45400cd01da7ca4cb351dd0fb57d121e148755d8;hpb=77510a96986176b1be791944861e3a6e44abd3d1;p=ffmpeg diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 45400cd01da..dfefe62ecdc 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -97,6 +97,7 @@ int ffio_init_context(AVIOContext *s, s->seekable = seek ? AVIO_SEEKABLE_NORMAL : 0; s->max_packet_size = 0; s->update_checksum = NULL; + s->short_seek_threshold = SHORT_SEEK_THRESHOLD; if (!read_packet && !write_flag) { s->pos = buffer_size; @@ -232,7 +233,7 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence) /* can do the seek inside the buffer */ s->buf_ptr = s->buffer + offset1; } else if ((!s->seekable || - offset1 <= s->buf_end + SHORT_SEEK_THRESHOLD - s->buffer) && + offset1 <= s->buf_end + s->short_seek_threshold - s->buffer) && !s->write_flag && offset1 >= 0 && (!s->direct || !s->seek) && (whence != SEEK_END || force)) {