Fix endless loop when opening corrupt FLV files (issue 699).
authorAndrew Wason <rectalogic@rectalogic.com>
Tue, 28 Oct 2008 23:49:04 +0000 (23:49 +0000)
committerCarl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at>
Tue, 28 Oct 2008 23:49:04 +0000 (23:49 +0000)
Patch by Andrew Wason, rectalogic A rectalogic D com

Originally committed as revision 15738 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/flvdec.c

index 08008836fadaa89fbaf34945c3fe24b5ce66c802..0b25a25e96a738e62b1dc6ba57de3bdeef69f6fa 100644 (file)
@@ -386,7 +386,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
     }
 
     if(is_audio){
-        if(!st->codec->sample_rate || !st->codec->bits_per_coded_sample || (!st->codec->codec_id && !st->codec->codec_tag)) {
+        if(!st->codec->channels || !st->codec->sample_rate || !st->codec->bits_per_coded_sample || (!st->codec->codec_id && !st->codec->codec_tag)) {
             st->codec->channels = (flags & FLV_AUDIO_CHANNEL_MASK) == FLV_STEREO ? 2 : 1;
             st->codec->sample_rate = (44100 << ((flags & FLV_AUDIO_SAMPLERATE_MASK) >> FLV_AUDIO_SAMPLERATE_OFFSET) >> 3);
             st->codec->bits_per_coded_sample = (flags & FLV_AUDIO_SAMPLESIZE_MASK) ? 16 : 8;