Commit 555e2921 authored by Michael Niedermayer's avatar Michael Niedermayer

flac_parser: speedup fifo realloc

Fixes Ticket1121
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 5edd4fce
......@@ -561,8 +561,8 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
/* Fill the buffer. */
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) {
av_log(avctx, AV_LOG_ERROR,
"couldn't reallocate buffer of size %td\n",
(read_end - read_start) + av_fifo_size(fpc->fifo_buf));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment