[FFmpeg-devel] [PATCH] fifo: add av_fifo_enlarge()
nicolas.george at normalesup.org
Mon May 14 20:54:35 CEST 2012
Le sextidi 26 floréal, an CCXX, Michael Niedermayer a écrit :
> + * Enlarge an AVFifoBuffer.
> + * In case of reallocation failure, the old FIFO is kept unchanged.
> + * The new fifo size may be larger than the requested size.
> + *
> + * @param f AVFifoBuffer to resize
> + * @param size new AVFifoBuffer size in bytes
> + * @return <0 for failure, >=0 otherwise
> + */
> +int av_fifo_enlarge(AVFifoBuffer *f, unsigned int new_size);
If I report it to your flac_parser patch, I believe most use-cases will use
av_fifo_enlarge(f, av_fifo_size(f) + needed_space);
It would therefore make sense to include the "av_fifo_size(f) +" in the API
itself, so that the argument "size" means: after that, I can add size bytes
to the fifo without overflowing.
In particular, that would help checking for overflows in the addition, which
is often forgotten.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 198 bytes
Desc: Digital signature
More information about the ffmpeg-devel