[FFmpeg-devel] [PATCH 1/2] avformat/aviobuf: Use a 512kb IO buffer for http* instead of 32kb
Michael Niedermayer
michaelni at gmx.at
Thu Mar 27 18:56:50 CET 2014
On Thu, Mar 27, 2014 at 01:07:10PM +0100, wm4 wrote:
> On Thu, 27 Mar 2014 00:24:24 +0100
> Michael Niedermayer <michaelni at gmx.at> wrote:
>
> > This makes it possible to avoid some excessive seeking
> > although the next commit is needed too
> >
> > The special case for http could be replaced by using the network
> > flag but that would require testing each protocol.
> > Its easier to add protocols one at a time when they are tested
> > and at the end replace the list by using the network flag
> >
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > ---
> > libavformat/aviobuf.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
> > index be4dd7a..622f22c 100644
> > --- a/libavformat/aviobuf.c
> > +++ b/libavformat/aviobuf.c
> > @@ -737,6 +737,8 @@ int ffio_fdopen(AVIOContext **s, URLContext *h)
> > } else {
> > buffer_size = IO_BUFFER_SIZE;
> > }
> > + if (h->prot && !strncmp(h->prot->name, "http", 4))
> > + buffer_size = FFMAX(buffer_size, 1<<19);
> > buffer = av_malloc(buffer_size);
> > if (!buffer)
> > return AVERROR(ENOMEM);
>
> Doesn't this enforce loading 512kb before doing anything?
no
the buffer is filled and used with what is provided by the protocol.
the tcp implementation uses recv and SOCK_STREAM
POSIX says this:
"For stream-based sockets, such as SOCK_STREAM, message boundaries
shall be ignored. In this case, data shall be returned to the user
as soon as it becomes available, and no data shall be discarded."
Ive also checked this, and yes, revc does return nice 4-12kb chunks
for large requests. If this untrue on some platform that we support
i can limit the size of the request
if so what limit would you suggest ?
> This is going
> to make startup of streams much slower.
actually this patch is fixing the startup time together with the
other patch and makes it much faster.
But if you have a case where it becomes slower iam quite interrested
to take a look at that. I do want to fix slow startup time ...
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The real ebay dictionary, page 3
"Rare item" - "Common item with rare defect or maybe just a lie"
"Professional" - "'Toy' made in china, not functional except as doorstop"
"Experts will know" - "The seller hopes you are not an expert"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140327/83523048/attachment.asc>
More information about the ffmpeg-devel
mailing list