summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2008-07-18 11:38:53 +0000
committerMichael Niedermayer <michaelni@gmx.at>2008-07-18 11:38:53 +0000
commitcfcd396bae11de94ad4a729361bc9b7b05f04c27 (patch)
treec0973efc7c46b26d6a7e8f38566d79d37d6feeb1
parent2b4b8c824e9d49800185b8f04fa5de6ce4bde07b (diff)
Only realloc() bitstream buffer when the needed size increased,
this is needed to prevent loosing bitstream data with large metadata. Originally committed as revision 14279 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/flac.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/flac.c b/libavcodec/flac.c
index a7ba01606e..5745210950 100644
--- a/libavcodec/flac.c
+++ b/libavcodec/flac.c
@@ -139,7 +139,8 @@ static void allocate_buffers(FLACContext *s){
s->decoded[i] = av_realloc(s->decoded[i], sizeof(int32_t)*s->max_blocksize);
}
- s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize);
+ if(s->allocated_bitstream_size < s->max_framesize)
+ s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize);
}
void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,