diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index da05251279..37a6f6dee3 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -130,6 +130,8 @@ int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence) { int64_t offset1; int64_t pos; + int force = whence & AVSEEK_FORCE; + whence &= ~AVSEEK_FORCE; if(!s) return AVERROR(EINVAL); @@ -151,8 +153,7 @@ int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence) /* can do the seek inside the buffer */ s->buf_ptr = s->buffer + offset1; } else if(s->is_streamed && !s->write_flag && offset1 >= 0 && - ( offset1 < (s->buf_end - s->buffer) + (1<<16) - || (whence & AVSEEK_FORCE))){ + (offset1 < (s->buf_end - s->buffer) + (1<<16) || force)) { while(s->pos < offset && !s->eof_reached) fill_buffer(s); if (s->eof_reached)