From 9fb7e14635026989d9f3e157be9ff6019139b654 Mon Sep 17 00:00:00 2001 From: Alex Converse Date: Tue, 10 Apr 2012 16:27:28 -0700 Subject: aacdec: More robust output configuration. Save the old output configuration (if it has been used successfully) when trying a new configuration. If the new configuration fails to decode, restore the last successful configuration. --- libavcodec/aacsbr.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'libavcodec/aacsbr.c') diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c index c71cfa00e1..5eca1151ff 100644 --- a/libavcodec/aacsbr.c +++ b/libavcodec/aacsbr.c @@ -914,7 +914,7 @@ static void read_sbr_extension(AACContext *ac, SpectralBandReplication *sbr, { switch (bs_extension_id) { case EXTENSION_ID_PS: - if (!ac->m4ac.ps) { + if (!ac->oc[1].m4ac.ps) { av_log(ac->avctx, AV_LOG_ERROR, "Parametric Stereo signaled to be not-present but was found in the bitstream.\n"); skip_bits_long(gb, *num_bits_left); // bs_fill_bits *num_bits_left = 0; @@ -1071,9 +1071,9 @@ int ff_decode_sbr_extension(AACContext *ac, SpectralBandReplication *sbr, sbr->reset = 0; if (!sbr->sample_rate) - sbr->sample_rate = 2 * ac->m4ac.sample_rate; //TODO use the nominal sample rate for arbitrary sample rate support - if (!ac->m4ac.ext_sample_rate) - ac->m4ac.ext_sample_rate = 2 * ac->m4ac.sample_rate; + sbr->sample_rate = 2 * ac->oc[1].m4ac.sample_rate; //TODO use the nominal sample rate for arbitrary sample rate support + if (!ac->oc[1].m4ac.ext_sample_rate) + ac->oc[1].m4ac.ext_sample_rate = 2 * ac->oc[1].m4ac.sample_rate; if (crc) { skip_bits(gb, 10); // bs_sbr_crc_bits; TODO - implement CRC check @@ -1648,7 +1648,7 @@ static void sbr_hf_assemble(float Y1[38][64][2], void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac, float* L, float* R) { - int downsampled = ac->m4ac.ext_sample_rate < sbr->sample_rate; + int downsampled = ac->oc[1].m4ac.ext_sample_rate < sbr->sample_rate; int ch; int nch = (id_aac == TYPE_CPE) ? 2 : 1; int err; @@ -1695,7 +1695,7 @@ void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac, sbr->X_low, ch); } - if (ac->m4ac.ps == 1) { + if (ac->oc[1].m4ac.ps == 1) { if (sbr->ps.start) { ff_ps_apply(ac->avctx, &sbr->ps, sbr->X[0], sbr->X[1], sbr->kx[1] + sbr->m[1]); } else { -- cgit v1.2.3