diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2013-08-24 15:00:08 +0200 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2013-08-26 09:23:39 +0200 |
commit | 9e7b62f0fb7462a902330fcc82cf596388f0187b (patch) | |
tree | aae1f336a70d250e218f219b875f95c457404668 /libavcodec/metasound.c | |
parent | b89e8759e053792704741d08cbc41c9ac3c7ed63 (diff) | |
download | ffmpeg-9e7b62f0fb7462a902330fcc82cf596388f0187b.tar.gz |
twinvq: set block align for codecs and use it in size checks
This both allows factoring out size check for both MetaSound and TwinVQ-VQF
decoders and fixes the situation when there are several MetaSound frames
stuffed together (that happens in 8kHz @ 8kbps MetaSound in ASF for example).
Diffstat (limited to 'libavcodec/metasound.c')
-rw-r--r-- | libavcodec/metasound.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/libavcodec/metasound.c b/libavcodec/metasound.c index b1245368f3..88cbff6b21 100644 --- a/libavcodec/metasound.c +++ b/libavcodec/metasound.c @@ -170,12 +170,6 @@ static int metasound_read_bitstream(AVCodecContext *avctx, TwinVQContext *tctx, GetBitContext gb; int i, j, k; - if (buf_size * 8 < avctx->bit_rate * mtab->size / avctx->sample_rate) { - av_log(avctx, AV_LOG_ERROR, - "Frame too small (%d bytes). Truncated file?\n", buf_size); - return AVERROR(EINVAL); - } - init_get_bits(&gb, buf, buf_size * 8); bits->window_type = get_bits(&gb, TWINVQ_WINDOW_TYPE_BITS); @@ -323,6 +317,9 @@ static av_cold int metasound_decode_init(AVCodecContext *avctx) return AVERROR(ENOSYS); } + avctx->block_align = (avctx->bit_rate * tctx->mtab->size + / avctx->sample_rate + 7) / 8; + tctx->codec = TWINVQ_CODEC_METASOUND; tctx->read_bitstream = metasound_read_bitstream; tctx->dec_bark_env = dec_bark_env; |