[FFmpeg-devel] [PATCH] fifo: add av_fifo_enlarge()
Nicolas George
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
something like:
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.
Regards,
--
Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120514/44db598e/attachment.asc>
More information about the ffmpeg-devel
mailing list