[FFmpeg-devel] [PATCH 1/2] avformat/aviobuf: Use a 512kb IO buffer for http* instead of 32kb

wm4 nfxjfg at googlemail.com
Thu Mar 27 13:07:10 CET 2014


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? This is going
to make startup of streams much slower.


More information about the ffmpeg-devel mailing list