Mercurial > libavcodec.hg
comparison flac.c @ 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 |
comparison
equal
deleted
inserted
replaced
7301:aab7f1fb59ea | 7302:3d8cf33fbafb |
---|---|
137 for (i = 0; i < s->channels; i++) | 137 for (i = 0; i < s->channels; i++) |
138 { | 138 { |
139 s->decoded[i] = av_realloc(s->decoded[i], sizeof(int32_t)*s->max_blocksize); | 139 s->decoded[i] = av_realloc(s->decoded[i], sizeof(int32_t)*s->max_blocksize); |
140 } | 140 } |
141 | 141 |
142 s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize); | 142 if(s->allocated_bitstream_size < s->max_framesize) |
143 s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize); | |
143 } | 144 } |
144 | 145 |
145 void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s, | 146 void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s, |
146 const uint8_t *buffer) | 147 const uint8_t *buffer) |
147 { | 148 { |