1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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>
This commit is contained in:
Michael Niedermayer 2012-06-03 17:12:26 +02:00
parent 6df1cfa7e4
commit a5ad3c2382

View File

@ -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 */ /* calc from frame_bytes, channels, and bits_per_coded_sample */
switch (avctx->codec_id) { switch (avctx->codec_id) {
case CODEC_ID_PCM_DVD: case CODEC_ID_PCM_DVD:
if(bps<4)
return 0;
return 2 * (frame_bytes / ((bps * 2 / 8) * ch)); return 2 * (frame_bytes / ((bps * 2 / 8) * ch));
case CODEC_ID_PCM_BLURAY: case CODEC_ID_PCM_BLURAY:
if(bps<4)
return 0;
return frame_bytes / ((FFALIGN(ch, 2) * bps) / 8); return frame_bytes / ((FFALIGN(ch, 2) * bps) / 8);
case CODEC_ID_S302M: case CODEC_ID_S302M:
return 2 * (frame_bytes / ((bps + 4) / 4)) / ch; return 2 * (frame_bytes / ((bps + 4) / 4)) / ch;