aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2007-04-29 13:25:32 +0000
committerAlex Beregszaszi <alex@rtfs.hu>2007-04-29 13:25:32 +0000
commit07d84a4e9f37a42a390418928cc086246f846e3f (patch)
tree241dc651085bbf1b5586b5e204eff36aea1fc6e3
parentb46d68c634cf5154bc33077b292ecdcef0419456 (diff)
downloadffmpeg-07d84a4e9f37a42a390418928cc086246f846e3f.tar.gz
check for channels<=0 and print a reasonable error message
Originally committed as revision 8857 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/mpegaudio.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/mpegaudio.c b/libavcodec/mpegaudio.c
index aa93442d57..c8f25d114e 100644
--- a/libavcodec/mpegaudio.c
+++ b/libavcodec/mpegaudio.c
@@ -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;