Message ID | 20200929211021.25030-9-cus@passwd.hu |
---|---|
State | Accepted |
Commit | a11cc04786c298a8e4df3da12d8e275eaaf6b333 |
Headers | show |
Series | [FFmpeg-devel,1/9] avformat/aviobuf: write data into the IO buffer till the very end of the buffer | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
On Tue, Sep 29, 2020 at 11:10:21PM +0200, Marton Balint wrote: > 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> > --- > libavformat/aviobuf.c | 5 +++++ > 1 file changed, 5 insertions(+) > This patch set fixes demuxing chained oggs via pipe, so I'm not against it.
On Wed, 30 Sep 2020, Paul B Mahol wrote: > On Tue, Sep 29, 2020 at 11:10:21PM +0200, Marton Balint wrote: >> 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> >> --- >> libavformat/aviobuf.c | 5 +++++ >> 1 file changed, 5 insertions(+) >> > > This patch set fixes demuxing chained oggs via pipe, > so I'm not against it. Thanks for testing. Is there anybody who would like to comment on the patch series before I push it? I know that some regression tests for avio would be good, but it is not something I plan working on. Thanks, Marton
On Tue, 6 Oct 2020, Marton Balint wrote: > > > On Wed, 30 Sep 2020, Paul B Mahol wrote: > >> On Tue, Sep 29, 2020 at 11:10:21PM +0200, Marton Balint wrote: >>> 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> >>> --- >>> libavformat/aviobuf.c | 5 +++++ >>> 1 file changed, 5 insertions(+) >>> >> >> This patch set fixes demuxing chained oggs via pipe, >> so I'm not against it. > > Thanks for testing. > > Is there anybody who would like to comment on the patch series > before I push it? > > I know that some regression tests for avio would be good, but it is not > something I plan working on. Last ping, will apply soon. Thanks, Marton
On Thu, 8 Oct 2020, Marton Balint wrote: > > > On Tue, 6 Oct 2020, Marton Balint wrote: > >> >> >> On Wed, 30 Sep 2020, Paul B Mahol wrote: >> >>> On Tue, Sep 29, 2020 at 11:10:21PM +0200, Marton Balint wrote: >>>> 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> >>>> --- >>>> libavformat/aviobuf.c | 5 +++++ >>>> 1 file changed, 5 insertions(+) >>>> >>> >>> This patch set fixes demuxing chained oggs via pipe, >>> so I'm not against it. >> >> Thanks for testing. >> >> Is there anybody who would like to comment on the patch series >> before I push it? >> >> I know that some regression tests for avio would be good, but it is not >> something I plan working on. > > Last ping, will apply soon. Applied the series. Regards, Marton
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index c4195e310b..15d91f91bc 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_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);
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> --- libavformat/aviobuf.c | 5 +++++ 1 file changed, 5 insertions(+)