diff mbox series

[FFmpeg-devel,05/12] avcodec/aac/aacdec: Move channel number check out of init_dsp()

Message ID GV1P250MB07378D68558B0289EAC726728F1C2@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit ef16882e8f95e99ba44e7d27f01bbc8d4572ea92
Headers show
Series [FFmpeg-devel,1/3] avcodec/aactab: Provide ff_ltp_coef, ff_tns_tmp2_map unconditionally | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt May 6, 2024, 12:14 p.m. UTC
Also move initializing random_state.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/aac/aacdec.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/aac/aacdec.c b/libavcodec/aac/aacdec.c
index f6a7266123..a78a669602 100644
--- a/libavcodec/aac/aacdec.c
+++ b/libavcodec/aac/aacdec.c
@@ -1159,13 +1159,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;                                         \
@@ -1248,6 +1241,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);
 }