]> git.sesse.net Git - ffmpeg/commitdiff
libmp3lame: log error message in case of invalid number of channels
authorStefano Sabatini <stefasab@gmail.com>
Fri, 28 Oct 2011 16:44:28 +0000 (18:44 +0200)
committerStefano Sabatini <stefasab@gmail.com>
Sun, 30 Oct 2011 20:10:54 +0000 (21:10 +0100)
Also return meaningful error number in place of -1.
Improve feedback.

libavcodec/libmp3lame.c

index fcefa2915ea32c585c889a22be20a79038986e4d..b540362d5c62f23648c728b6a1ba927254cc11ab 100644 (file)
@@ -49,8 +49,11 @@ static av_cold int MP3lame_encode_init(AVCodecContext *avctx)
 {
     Mp3AudioContext *s = avctx->priv_data;
 
-    if (avctx->channels > 2)
-        return -1;
+    if (avctx->channels > 2) {
+        av_log(avctx, AV_LOG_ERROR,
+               "Invalid number of channels %d, must be <= 2\n", avctx->channels);
+        return AVERROR(EINVAL);
+    }
 
     s->stereo = avctx->channels > 1 ? 1 : 0;