diff mbox series

[FFmpeg-devel,06/12] avcodec/aac/aacdec: Avoid branch to set sample_fmt

Message ID GV1P250MB0737B88A7575C525736EC20F8F1C2@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 41ea317ced70cc4da17ea814be124de650c3f0af
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
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/aac/aacdec.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/aac/aacdec.c b/libavcodec/aac/aacdec.c
index a78a669602..1dc4af8a0d 100644
--- a/libavcodec/aac/aacdec.c
+++ b/libavcodec/aac/aacdec.c
@@ -1200,11 +1200,6 @@  static av_cold int aac_decode_init_internal(AVCodecContext *avctx)
     ac->avctx = avctx;
     ac->oc[1].m4ac.sample_rate = avctx->sample_rate;
 
-    if (ac->is_fixed)
-        avctx->sample_fmt = AV_SAMPLE_FMT_S32P;
-    else
-        avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
-
     if (avctx->extradata_size > 0) {
         if ((ret = decode_audio_specific_config(ac, ac->avctx, &ac->oc[1].m4ac,
                                                 avctx->extradata,
@@ -1254,14 +1249,20 @@  static av_cold int aac_decode_init_internal(AVCodecContext *avctx)
 static av_cold int aac_decode_init(AVCodecContext *avctx)
 {
     AACDecContext *ac = avctx->priv_data;
+
     ac->is_fixed = 0;
+    avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
+
     return aac_decode_init_internal(avctx);
 }
 
 static av_cold int aac_decode_init_fixed(AVCodecContext *avctx)
 {
     AACDecContext *ac = avctx->priv_data;
+
     ac->is_fixed = 1;
+    avctx->sample_fmt = AV_SAMPLE_FMT_S32P;
+
     return aac_decode_init_internal(avctx);
 }