diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 7e0a8cff48..bd9babc073 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -635,9 +635,10 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD } if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0) { - av_log(avctx, AV_LOG_WARNING, "The maximum value for lowres supported by the decoder is %d\n", + av_log(avctx, AV_LOG_ERROR, "The maximum value for lowres supported by the decoder is %d\n", avctx->codec->max_lowres); - avctx->lowres = avctx->codec->max_lowres; + ret = AVERROR(EINVAL); + goto free_and_end; } if (avctx->codec->encode) { int i;