summaryrefslogtreecommitdiff
path: root/libavcodec/aacsbr.c
diff options
context:
space:
mode:
authorAlex Converse <alex.converse@gmail.com>2012-04-10 16:27:28 -0700
committerAlex Converse <alex.converse@gmail.com>2012-04-16 14:09:52 -0700
commit9fb7e14635026989d9f3e157be9ff6019139b654 (patch)
treedc65e435f9af40c0e849b3830b9c93742daf6490 /libavcodec/aacsbr.c
parentaf2f655c02c69aa615eb2a06000a1aa35916967a (diff)
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.
Diffstat (limited to 'libavcodec/aacsbr.c')
-rw-r--r--libavcodec/aacsbr.c12
1 files changed, 6 insertions, 6 deletions
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 {