aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2012-12-01 14:52:22 +0000
committerPaul B Mahol <onemda@gmail.com>2013-07-05 18:10:27 +0000
commit6516a25f04edc90b8dbc8b7f48120b08b7517ae2 (patch)
treef64a179d4e4cd919bfa0c1867f1ead31b3da194b /libavcodec/utils.c
parent48f2750de8a47671aa4e09e91d7ab811558d2c2f (diff)
downloadffmpeg-6516a25f04edc90b8dbc8b7f48120b08b7517ae2.tar.gz
ADPCM IMA WAV 2, 3 and 5 bits decoder
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index f26e260d3d..d77b5ec661 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2899,7 +2899,9 @@ int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
int blocks = frame_bytes / ba;
switch (avctx->codec_id) {
case AV_CODEC_ID_ADPCM_IMA_WAV:
- return blocks * (1 + (ba - 4 * ch) / (4 * ch) * 8);
+ if (bps < 2 || bps > 5)
+ return 0;
+ return blocks * (1 + (ba - 4 * ch) / (bps * ch) * 8);
case AV_CODEC_ID_ADPCM_IMA_DK3:
return blocks * (((ba - 16) * 2 / 3 * 4) / ch);
case AV_CODEC_ID_ADPCM_IMA_DK4: