changeset 7302:3d8cf33fbafb libavcodec

Only realloc() bitstream buffer when the needed size increased, this is needed to prevent loosing bitstream data with large metadata.
author michael
date Fri, 18 Jul 2008 11:38:53 +0000
parents aab7f1fb59ea
children f0fc58bb9780
files flac.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/flac.c	Fri Jul 18 11:08:15 2008 +0000
+++ b/flac.c	Fri Jul 18 11:38:53 2008 +0000
@@ -139,7 +139,8 @@
         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,