Commit 5b1a06b1 authored by Stefano Sabatini's avatar Stefano Sabatini

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

Also return meaningful error number in place of -1.
Improve feedback.
parent b264e5ca
...@@ -49,8 +49,11 @@ static av_cold int MP3lame_encode_init(AVCodecContext *avctx) ...@@ -49,8 +49,11 @@ static av_cold int MP3lame_encode_init(AVCodecContext *avctx)
{ {
Mp3AudioContext *s = avctx->priv_data; Mp3AudioContext *s = avctx->priv_data;
if (avctx->channels > 2) if (avctx->channels > 2) {
return -1; 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; s->stereo = avctx->channels > 1 ? 1 : 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment