On Sun, Sep 23, 2018 at 1:40 PM Michael Niedermayer <mich...@niedermayer.cc> wrote: > > On Sat, Sep 22, 2018 at 07:32:28PM +0200, Robert Nagy wrote: > > diff --git a/libavformat/cache.c b/libavformat/cache.c > > index 66bbbf54c9..48ff5ab363 100644 > > --- a/libavformat/cache.c > > +++ b/libavformat/cache.c > > @@ -153,6 +153,38 @@ fail: > > return ret; > > } > > > > +static int cache_read_ahead(URLContext *h) > > +{ > > + Context *c= h->priv_data; > > + int64_t r, read_ahead, pos; > > + uint8_t buf[32768]; > > + > > + pos = c->logical_pos; > > + read_ahead = c->read_ahead_limit < 0 > > + ? 512 * 512 > > + : FFMIN(512 * 512, c->read_ahead_limit); > > + > > + while (read_ahead > 0) { > > + r = ffurl_read(c->inner, buf, FFMIN(read_ahead, sizeof(buf))); > > + if (r == AVERROR_EOF) { > > + c->is_true_eof = 1; > > + av_assert0(c->end >= c->logical_pos); > > + } > > + if (r<=0) > > + break; > > + c->inner_pos += r; > > + > > + add_entry(h, buf, r); > > + c->logical_pos += r; > > + c->end = FFMAX(c->end, c->logical_pos); > > + read_ahead -= r; > > + } > > + > > + c->logical_pos = pos; > > + > > + return r < 0 ? r : 0; > > +} > > + > > static int cache_read(URLContext *h, unsigned char *buf, int size) > > { > > Context *c= h->priv_data; > > > @@ -215,6 +247,10 @@ static int cache_read(URLContext *h, unsigned > > char *buf, int size) > > still not cleanly applying (due to new lines) > > Applying: cache: read ahead to avoid excessive small requests > error: corrupt patch at line 45 > error: could not build fake ancestor > Patch failed at 0001 cache: read ahead to avoid excessive small requests > hint: Use 'git am --show-current-patch' to see the failed patch > When you have resolved this problem, run "git am --continue". > If you prefer to skip this patch, run "git am --skip" instead. > To restore the original branch and stop patching, run "git am --abort". > > > [...] > > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > The greatest way to live with honor in this world is to be what we pretend > to be. -- Socrates > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
0001-cache-read-ahead-to-avoid-excessive-small-requests.patch
Description: Binary data
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel