Also move initializing random_state.
Showing the changes to libavcodec/aac (1 of 1 file). Show all
Unified · Split
| @@ -1152,13 +1152,6 @@ static av_cold int init_dsp(AVCodecContext *avctx) · 1151 unmodified lines | |||
| 1152 | const float *const scalep = is_fixed ? &scale_fixed : &scale_float; | 1152 | const float *const scalep = is_fixed ? &scale_fixed : &scale_float; |
| 1153 | enum AVTXType tx_type = is_fixed ? AV_TX_INT32_MDCT : AV_TX_FLOAT_MDCT; | 1153 | enum AVTXType tx_type = is_fixed ? AV_TX_INT32_MDCT : AV_TX_FLOAT_MDCT; |
| 1154 | 1154 | ||
| 1155 | if (avctx->ch_layout.nb_channels > MAX_CHANNELS) { | ||
| 1156 | av_log(avctx, AV_LOG_ERROR, "Too many channels\n"); | ||
| 1157 | return AVERROR_INVALIDDATA; | ||
| 1158 | } | ||
| 1159 | |||
| 1160 | ac->random_state = 0x1f2e3d4c; | ||
| 1161 | |||
| 1162 | #define MDCT_INIT(s, fn, len, sval) \ | 1155 | #define MDCT_INIT(s, fn, len, sval) \ |
| 1163 | scale_fixed = (sval) * 128.0f; \ | 1156 | scale_fixed = (sval) * 128.0f; \ |
| 1164 | scale_float = (sval) / 32768.0f; \ | 1157 | scale_float = (sval) / 32768.0f; \ |
| @@ -1241,6 +1234,13 @@ static av_cold int aac_decode_init_internal(AVCodecContext *avctx) · 76 unmodified lines | |||
| 1241 | } | 1234 | } |
| 1242 | } | 1235 | } |
| 1243 | 1236 | ||
| 1237 | if (avctx->ch_layout.nb_channels > MAX_CHANNELS) { | ||
| 1238 | av_log(avctx, AV_LOG_ERROR, "Too many channels\n"); | ||
| 1239 | return AVERROR_INVALIDDATA; | ||
| 1240 | } | ||
| 1241 | |||
| 1242 | ac->random_state = 0x1f2e3d4c; | ||
| 1243 | |||
| 1244 | return init_dsp(avctx); | 1244 | return init_dsp(avctx); |
| 1245 | } | 1245 | } |
| 1246 | 1246 | ||