mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
avformat/aviobuf: increase default read buffer size to 2*max_buffer_size for streamed data
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>
This commit is contained in:
parent
25ced19aa3
commit
a11cc04786
@ -938,6 +938,11 @@ int ffio_fdopen(AVIOContext **s, URLContext *h)
|
|||||||
} else {
|
} else {
|
||||||
buffer_size = IO_BUFFER_SIZE;
|
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);
|
buffer = av_malloc(buffer_size);
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user