[FFmpeg-devel] [PATCH] Fix unnecessary buffer reallocotion in ffio_ensure_seekback().

Michael Niedermayer michael at niedermayer.cc
Wed Dec 19 20:49:25 EET 2018


On Wed, Dec 19, 2018 at 02:33:49PM +0200, Artyom Lebedev wrote:
> It was reallocated even if the exisiting buffer is larger than needed one,
> thus unnecessary shrinking it.

>  aviobuf.c |    3 +++
>  1 file changed, 3 insertions(+)
> 17a6a27b38d8fc7336d7177338b915b507a69033  0001-Fix-unnecessary-buffer-reallocotion-in-ffio_ensure_s.patch
> From 2b8cea72a69abe6564367fb2149be936d2ffb916 Mon Sep 17 00:00:00 2001
> From: Artyom Lebedev <vagran.ast at gmail.com>
> Date: Wed, 19 Dec 2018 11:49:22 +0200
> Subject: [PATCH] Fix unnecessary buffer reallocotion in
>  ffio_ensure_seekback().
> To: ffmpeg-devel at ffmpeg.org
> 
> ---
>  libavformat/aviobuf.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
> index 5a33f82..b867fdd 100644
> --- a/libavformat/aviobuf.c
> +++ b/libavformat/aviobuf.c
> @@ -1063,6 +1063,9 @@ int ffio_ensure_seekback(AVIOContext *s, int64_t buf_size)
>          return 0;
>      av_assert0(!s->write_flag);
>  
> +    if (s->buffer_size >= buf_size)
> +        return 0;

Theres a check which returns out for unnecessary reallocation
a few lines above
if that is incorrect that should be corrected
also theres a typo in the commit message

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 1
"Used only once"    - "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20181219/e4d13fbd/attachment.sig>


More information about the ffmpeg-devel mailing list