diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2021-03-16 20:07:20 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2021-03-20 02:45:10 +0100 |
commit | 77616c5fb4ee6e1223c1c4d30cc76412a9e7e9d0 (patch) | |
tree | d071d428c6208c2c29e01fa9b50ab0f5edd22f1f /libavcodec/decode.c | |
parent | 746796ceb49b3dab88d3c05f26c2406eceadf4ed (diff) | |
download | ffmpeg-77616c5fb4ee6e1223c1c4d30cc76412a9e7e9d0.tar.gz |
avcodec/avcodec: Move decoder channel count check to ff_decode_preinit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/decode.c')
-rw-r--r-- | libavcodec/decode.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/decode.c b/libavcodec/decode.c index cbd41c8cc8..390147908d 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -2026,6 +2026,11 @@ FF_DISABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS #endif + if (avctx->codec_type == AVMEDIA_TYPE_AUDIO && avctx->channels == 0 && + !(avctx->codec->capabilities & AV_CODEC_CAP_CHANNEL_CONF)) { + av_log(avctx, AV_LOG_ERROR, "Decoder requires channel count but channels not set\n"); + return AVERROR(EINVAL); + } 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", avctx->codec->max_lowres); |