Browse Source

check for channels<=0 and print a reasonable error message

Originally committed as revision 8857 to svn://svn.ffmpeg.org/ffmpeg/trunk
tags/v0.5
Alex Beregszaszi 19 years ago
parent
commit
07d84a4e9f
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      libavcodec/mpegaudio.c

+ 3
- 1
libavcodec/mpegaudio.c View File

@@ -70,8 +70,10 @@ static int MPA_encode_init(AVCodecContext *avctx)
int i, v, table;
float a;

if (channels > 2)
if (channels <= 0 || channels > 2){
av_log(avctx, AV_LOG_ERROR, "encoding %d channel(s) is not allowed in mp2\n", channels);
return -1;
}
bitrate = bitrate / 1000;
s->nb_channels = channels;
s->freq = freq;


Loading…
Cancel
Save