summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorAlex Converse <alex.converse@gmail.com>2010-03-07 23:46:40 +0000
committerAlex Converse <alex.converse@gmail.com>2010-03-07 23:46:40 +0000
commit54f158bda2c431d78429887b9519f90d3f678d5d (patch)
treee2f324b51df6d9760c49be36893b1b6c5606edfc /libavcodec
parent663322c1b86053c56d6c25e002f4d3374d2ea085 (diff)
AAC: Set codec parameters in the first frame rather than in .init()
Originally committed as revision 22298 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/aac.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libavcodec/aac.c b/libavcodec/aac.c
index 994c73352f..ac3e49ccd4 100644
--- a/libavcodec/aac.c
+++ b/libavcodec/aac.c
@@ -509,17 +509,14 @@ static av_cold int aac_decode_init(AVCodecContext *avccontext)
int i;
ac->avccontext = avccontext;
+ ac->m4ac.sample_rate = avccontext->sample_rate;
if (avccontext->extradata_size > 0) {
if (decode_audio_specific_config(ac, avccontext->extradata, avccontext->extradata_size))
return -1;
- avccontext->sample_rate = ac->m4ac.sample_rate;
- } else if (avccontext->channels > 0) {
- ac->m4ac.sample_rate = avccontext->sample_rate;
}
avccontext->sample_fmt = SAMPLE_FMT_S16;
- avccontext->frame_size = 1024;
AAC_INIT_VLC_STATIC( 0, 304);
AAC_INIT_VLC_STATIC( 1, 270);
@@ -1950,6 +1947,7 @@ static int aac_decode_frame(AVCodecContext *avccontext, void *data,
enum RawDataBlockType elem_type;
int err, elem_id, data_size_tmp;
int buf_consumed;
+ int samples = 1024, multiplier;
init_get_bits(&gb, buf, buf_size * 8);
@@ -2036,6 +2034,13 @@ static int aac_decode_frame(AVCodecContext *avccontext, void *data,
spectral_to_sample(ac);
+ multiplier = 1;
+ samples <<= multiplier;
+ if (ac->output_configured < OC_LOCKED) {
+ avccontext->sample_rate = ac->m4ac.sample_rate << multiplier;
+ avccontext->frame_size = samples;
+ }
+
data_size_tmp = 1024 * avccontext->channels * sizeof(int16_t);
if (*data_size < data_size_tmp) {
av_log(avccontext, AV_LOG_ERROR,