[FFmpeg-cvslog] av_get_audio_frame_duration: fix FPE

Michael Niedermayer git at videolan.org
Sun Jun 3 17:48:01 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Jun  3 17:12:26 2012 +0200| [a5ad3c2382ac27cf712aaba6a222ec12f5eb88da] | committer: Michael Niedermayer

av_get_audio_frame_duration: fix FPE

Fixes ticket1392

Found-by: Piotr Bandurski <ami_stuff at o2.pl>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a5ad3c2382ac27cf712aaba6a222ec12f5eb88da
---

 libavcodec/utils.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 6b65863..5d3fafe 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;



More information about the ffmpeg-cvslog mailing list