Commit f77fd34b authored by Hendrik Leppkes's avatar Hendrik Leppkes Committed by Michael Niedermayer

aac: move sample_fmt selection before decoder configuration.

The decoder configuration initializes the sbr mdct, which needs to know about the sample format to properly take the scale factor into account.
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 24e7a22e
...@@ -842,6 +842,14 @@ static av_cold int aac_decode_init(AVCodecContext *avctx) ...@@ -842,6 +842,14 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
ac->avctx = avctx; ac->avctx = avctx;
ac->oc[1].m4ac.sample_rate = avctx->sample_rate; ac->oc[1].m4ac.sample_rate = avctx->sample_rate;
if (avctx->request_sample_fmt == AV_SAMPLE_FMT_FLT) {
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
output_scale_factor = 1.0 / 32768.0;
} else {
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
output_scale_factor = 1.0;
}
if (avctx->extradata_size > 0) { if (avctx->extradata_size > 0) {
if (decode_audio_specific_config(ac, ac->avctx, &ac->oc[1].m4ac, if (decode_audio_specific_config(ac, ac->avctx, &ac->oc[1].m4ac,
avctx->extradata, avctx->extradata,
...@@ -877,14 +885,6 @@ static av_cold int aac_decode_init(AVCodecContext *avctx) ...@@ -877,14 +885,6 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
} }
} }
if (avctx->request_sample_fmt == AV_SAMPLE_FMT_FLT) {
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
output_scale_factor = 1.0 / 32768.0;
} else {
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
output_scale_factor = 1.0;
}
AAC_INIT_VLC_STATIC( 0, 304); AAC_INIT_VLC_STATIC( 0, 304);
AAC_INIT_VLC_STATIC( 1, 270); AAC_INIT_VLC_STATIC( 1, 270);
AAC_INIT_VLC_STATIC( 2, 550); AAC_INIT_VLC_STATIC( 2, 550);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment