[FFmpeg-cvslog] libmp3lame: log error message in case of invalid number of channels

Stefano Sabatini git at videolan.org
Sun Oct 30 21:13:33 CET 2011


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Fri Oct 28 18:44:28 2011 +0200| [5b1a06b1c9c596b3c406ea632a252dcccbee25ed] | committer: Stefano Sabatini

libmp3lame: log error message in case of invalid number of channels

Also return meaningful error number in place of -1.
Improve feedback.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5b1a06b1c9c596b3c406ea632a252dcccbee25ed
---

 libavcodec/libmp3lame.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c
index fcefa29..b540362 100644
--- a/libavcodec/libmp3lame.c
+++ b/libavcodec/libmp3lame.c
@@ -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;
 



More information about the ffmpeg-cvslog mailing list