summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-06-03 17:12:26 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-06-03 17:12:57 +0200
commita5ad3c2382ac27cf712aaba6a222ec12f5eb88da (patch)
treea15854493180c6c68c97d23374fd5f2d2dd329bd /libavcodec
parent6df1cfa7e4d488051d7b5033c0c69df970db9f82 (diff)
av_get_audio_frame_duration: fix FPE
Fixes ticket1392 Found-by: Piotr Bandurski <ami_stuff@o2.pl> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/utils.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 6b6586305f..5d3fafea65 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2199,8 +2199,12 @@ int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
/* calc from frame_bytes, channels, and bits_per_coded_sample */
switch (avctx->codec_id) {
case CODEC_ID_PCM_DVD:
+ if(bps<4)
+ return 0;
return 2 * (frame_bytes / ((bps * 2 / 8) * ch));
case CODEC_ID_PCM_BLURAY:
+ if(bps<4)
+ return 0;
return frame_bytes / ((FFALIGN(ch, 2) * bps) / 8);
case CODEC_ID_S302M:
return 2 * (frame_bytes / ((bps + 4) / 4)) / ch;