Message ID | 20200920085253.7107-3-cus@passwd.hu |
---|---|
State | Accepted |
Headers | show |
Series | [FFmpeg-devel,1/3] avformat/aviobuf: read till the very end of the IO buffer | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
On Sun, Sep 20, 2020 at 10:52:53AM +0200, Marton Balint wrote: > This should increase the effectiveness of ffio_ensure_seekback. > > Note: increasing buffer size to non-streamed or write buffer should also > work, but they both cause fate failures... The reason for that should be > checked. > > Signed-off-by: Marton Balint <cus@passwd.hu> > --- > libavformat/aviobuf.c | 5 +++++ > 1 file changed, 5 insertions(+) this is an interresting idea have you done some tests/benchmarks that show specific advantages ? thx [...]
On Sun, 20 Sep 2020, Michael Niedermayer wrote: > On Sun, Sep 20, 2020 at 10:52:53AM +0200, Marton Balint wrote: >> This should increase the effectiveness of ffio_ensure_seekback. >> >> Note: increasing buffer size to non-streamed or write buffer should also >> work, but they both cause fate failures... The reason for that should be >> checked. >> >> Signed-off-by: Marton Balint <cus@passwd.hu> >> --- >> libavformat/aviobuf.c | 5 +++++ >> 1 file changed, 5 insertions(+) > > this is an interresting idea > have you done some tests/benchmarks that show specific advantages ? No, it is just a blind attempt for now. Regards, Marton
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index aa1d6c0830..13cad7f5f0 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -938,6 +938,11 @@ int ffio_fdopen(AVIOContext **s, URLContext *h) } else { buffer_size = IO_BUFFER_SIZE; } + if (h->flags & AVIO_FLAG_READ && 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);
This should increase the effectiveness of ffio_ensure_seekback. Note: increasing buffer size to non-streamed or write buffer should also work, but they both cause fate failures... The reason for that should be checked. Signed-off-by: Marton Balint <cus@passwd.hu> --- libavformat/aviobuf.c | 5 +++++ 1 file changed, 5 insertions(+)