This should increase the effectiveness of ffio_ensure_seekback by reducing the
number of buffer reallocations and memmoves/memcpys because even a small
seekback window requires max_buffer_size+window_size buffer space.
Signed-off-by: Marton Balint <cus@passwd.hu>
} else {
buffer_size = IO_BUFFER_SIZE;
}
+ if (!(h->flags & AVIO_FLAG_WRITE) && h->is_streamed) {
+ if (buffer_size > INT_MAX/2)
+ return AVERROR(EINVAL);
+ buffer_size *= 2;
+ }
buffer = av_malloc(buffer_size);
if (!buffer)
return AVERROR(ENOMEM);