[FFmpeg-cvslog] r14279 - trunk/libavcodec/flac.c

michael subversion
Fri Jul 18 13:38:54 CEST 2008


Author: michael
Date: Fri Jul 18 13:38:53 2008
New Revision: 14279

Log:
Only realloc() bitstream buffer when the needed size increased,
this is needed to prevent loosing bitstream data with large metadata.


Modified:
   trunk/libavcodec/flac.c

Modified: trunk/libavcodec/flac.c
==============================================================================
--- trunk/libavcodec/flac.c	(original)
+++ trunk/libavcodec/flac.c	Fri Jul 18 13:38:53 2008
@@ -139,7 +139,8 @@ static void allocate_buffers(FLACContext
         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,




More information about the ffmpeg-cvslog mailing list