diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-05-06 11:43:06 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-05-06 23:58:31 +0200 |
commit | ef16882e8f95e99ba44e7d27f01bbc8d4572ea92 (patch) | |
tree | df86d6bbc54b8dd10d3b86c12404855c4eddc3ec | |
parent | e4e9144a5c6fbf42c0d48bbd323c12bc7d5409d8 (diff) | |
download | ffmpeg-ef16882e8f95e99ba44e7d27f01bbc8d4572ea92.tar.gz |
avcodec/aac/aacdec: Move channel number check out of init_dsp()
Also move initializing random_state.
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r-- | libavcodec/aac/aacdec.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libavcodec/aac/aacdec.c b/libavcodec/aac/aacdec.c index 64ac0ff88b..0d4daeeebd 100644 --- a/libavcodec/aac/aacdec.c +++ b/libavcodec/aac/aacdec.c @@ -1152,13 +1152,6 @@ static av_cold int init_dsp(AVCodecContext *avctx) const float *const scalep = is_fixed ? &scale_fixed : &scale_float; enum AVTXType tx_type = is_fixed ? AV_TX_INT32_MDCT : AV_TX_FLOAT_MDCT; - if (avctx->ch_layout.nb_channels > MAX_CHANNELS) { - av_log(avctx, AV_LOG_ERROR, "Too many channels\n"); - return AVERROR_INVALIDDATA; - } - - ac->random_state = 0x1f2e3d4c; - #define MDCT_INIT(s, fn, len, sval) \ scale_fixed = (sval) * 128.0f; \ scale_float = (sval) / 32768.0f; \ @@ -1241,6 +1234,13 @@ static av_cold int aac_decode_init_internal(AVCodecContext *avctx) } } + if (avctx->ch_layout.nb_channels > MAX_CHANNELS) { + av_log(avctx, AV_LOG_ERROR, "Too many channels\n"); + return AVERROR_INVALIDDATA; + } + + ac->random_state = 0x1f2e3d4c; + return init_dsp(avctx); } |