[FFmpeg-cvslog] aac: move sample_fmt selection before decoder configuration.

Hendrik Leppkes git at videolan.org
Thu Jun 21 13:35:36 CEST 2012


ffmpeg | branch: master | Hendrik Leppkes <h.leppkes at gmail.com> | Tue Jun 12 10:05:29 2012 +0200| [f77fd34bc34c93a555eee99226d01d947d02a2a3] | committer: 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: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f77fd34bc34c93a555eee99226d01d947d02a2a3
---

 libavcodec/aacdec.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index b638e3b..6928b48 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -842,6 +842,14 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
     ac->avctx = avctx;
     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 (decode_audio_specific_config(ac, ac->avctx, &ac->oc[1].m4ac,
                                          avctx->extradata,
@@ -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( 1, 270);
     AAC_INIT_VLC_STATIC( 2, 550);



More information about the ffmpeg-cvslog mailing list