aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-05-06 11:49:05 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-05-06 23:58:58 +0200
commit41ea317ced70cc4da17ea814be124de650c3f0af (patch)
treecade0e11ccb3622b8614d3890881033f19185c50
parentef16882e8f95e99ba44e7d27f01bbc8d4572ea92 (diff)
downloadffmpeg-41ea317ced70cc4da17ea814be124de650c3f0af.tar.gz
avcodec/aac/aacdec: Avoid branch to set sample_fmt
Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavcodec/aac/aacdec.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libavcodec/aac/aacdec.c b/libavcodec/aac/aacdec.c
index 0d4daeeebd..470e46b00f 100644
--- a/libavcodec/aac/aacdec.c
+++ b/libavcodec/aac/aacdec.c
@@ -1193,11 +1193,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,
@@ -1247,14 +1242,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);
}