Commit 6989cb2d authored by Justin Ruggles's avatar Justin Ruggles Committed by Ronald S. Bultje

vmdaudio: correct the silent chunk count in the first block.

This fixes A/V sync with several samples, notably:
http://samples.mplayerhq.hu/game-formats/sierra-vmd/swat_*.vmdSigned-off-by: 's avatarRonald S. Bultje <rsbultje@gmail.com>
parent 9b73f786
...@@ -520,11 +520,7 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, ...@@ -520,11 +520,7 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx,
uint32_t flags = AV_RB32(p); uint32_t flags = AV_RB32(p);
int raw_block_size = s->block_align * int raw_block_size = s->block_align *
(av_get_bits_per_sample_fmt(avctx->sample_fmt) / 8); (av_get_bits_per_sample_fmt(avctx->sample_fmt) / 8);
int silent_chunks; int silent_chunks = av_popcount(flags);
if(flags == 0xFFFFFFFF)
silent_chunks = 32;
else
silent_chunks = av_log2(flags + 1);
if(*data_size < (s->block_align*silent_chunks + buf_size - 20) * 2) if(*data_size < (s->block_align*silent_chunks + buf_size - 20) * 2)
return -1; return -1;
*data_size = 0; *data_size = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment