riff: fix division by zero for G726

Fixes CID717752
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-10-16 19:56:05 +02:00
parent 9de5b11d58
commit 340305646a

View File

@ -661,7 +661,7 @@ int ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size)
codec->sample_rate = 0; codec->sample_rate = 0;
} }
/* override bits_per_coded_sample for G.726 */ /* override bits_per_coded_sample for G.726 */
if (codec->codec_id == AV_CODEC_ID_ADPCM_G726) if (codec->codec_id == AV_CODEC_ID_ADPCM_G726 && codec->sample_rate)
codec->bits_per_coded_sample = codec->bit_rate / codec->sample_rate; codec->bits_per_coded_sample = codec->bit_rate / codec->sample_rate;
return 0; return 0;