aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-06-03 17:12:26 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-06-07 00:55:25 +0200
commit320704f739e831b13f5c4e9a7770d46fa9d24bde (patch)
treead357b4b099b0d627d6b44b5e60101b1113eb89a
parentbe1d65031fecdce619de8831b7802bfba1932869 (diff)
downloadffmpeg-320704f739e831b13f5c4e9a7770d46fa9d24bde.tar.gz
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> (cherry picked from commit a5ad3c2382ac27cf712aaba6a222ec12f5eb88da) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/utils.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 2cfe8491fa..dc3a30abbe 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2194,8 +2194,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;