[FFmpeg-devel] [PATCH] libavutil/fifo: Fix fifo grow step

Jan Sebechlebsky sebechlebskyjan at gmail.com
Sat Jun 4 14:42:57 CEST 2016



On 06/03/2016 07:55 PM, Michael Niedermayer wrote:
> On Fri, Jun 03, 2016 at 02:04:00PM +0200, sebechlebskyjan at gmail.com wrote:
>> From: Jan Sebechlebsky <sebechlebskyjan at gmail.com>
>>
>> Fifo was reallocating always to twice of the requested size.
>> This fixes it to reallocate to requested size, or twice of the
>> original size - whichever is greater.
>>
>> Signed-off-by: Jan Sebechlebsky <sebechlebskyjan at gmail.com>
>> ---
>>   I believe the intended behaviour was as described in commit message
>>   and FFMAX(size,2*size) is a mistake.
> the point behind teh FFMAX was to protect against a overflow of
> 2*size but your suggestion is probably better and would reduce memory
> use, so applied
>
> thanks
You're welcome, at least me missing the point was good for something :)
Would you mind if I added function av_fifo_generic_write_grow to 
libavutil/fifo.c which would grow the fifo if there is not enough space 
for the element to be added?

Regards,
Jan


More information about the ffmpeg-devel mailing list