[FFmpeg-cvslog] flac_parser: speedup fifo realloc

Nicolas George nicolas.george at normalesup.org
Mon May 14 08:21:22 CEST 2012


Le sextidi 26 floréal, an CCXX, Michael Niedermayer a écrit :
> -        if (av_fifo_realloc2(fpc->fifo_buf,
> -                             (read_end - read_start) + av_fifo_size(fpc->fifo_buf)) < 0) {
> +        if (   av_fifo_space(fpc->fifo_buf) < read_end - read_start
> +            && av_fifo_realloc2(fpc->fifo_buf, (read_end - read_start) + 2*av_fifo_size(fpc->fifo_buf)) < 0) {

Isn't there a risk of integer overflow?

And as a side note, since reallocating exponentially is a common practice,
it may be a builtin of av_fifo.

Regards,

-- 
  Nicolas George


More information about the ffmpeg-cvslog mailing list