aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-02-23 13:11:03 -0500
committerMichael Niedermayer <michaelni@gmx.at>2011-02-26 03:16:02 +0100
commit2be17a71ae1be0cdd8e7f50470f863dcb596c916 (patch)
tree7c52ea66bd2dcb500be05be56651b80135fc4818
parentc11c79222e2d8d1799e768b156808cae90c8d692 (diff)
downloadffmpeg-2be17a71ae1be0cdd8e7f50470f863dcb596c916.tar.gz
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_*.vmd Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com> (cherry picked from commit 6989cb2dae85ea455ffcc8a36a763134fb311e29)
-rw-r--r--libavcodec/vmdav.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c
index c6043e94d2..53d40a997c 100644
--- a/libavcodec/vmdav.c
+++ b/libavcodec/vmdav.c
@@ -520,11 +520,7 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx,
uint32_t flags = AV_RB32(p);
int raw_block_size = s->block_align *
(av_get_bits_per_sample_fmt(avctx->sample_fmt) / 8);
- int silent_chunks;
- if(flags == 0xFFFFFFFF)
- silent_chunks = 32;
- else
- silent_chunks = av_log2(flags + 1);
+ int silent_chunks = av_popcount(flags);
if(*data_size < (s->block_align*silent_chunks + buf_size - 20) * 2)
return -1;
*data_size = 0;