Commit a93f501c authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

Fix PLC-based mode transition code.

parent e2a09db9
...@@ -84,7 +84,7 @@ int opus_decode(OpusDecoder *st, const unsigned char *data, ...@@ -84,7 +84,7 @@ int opus_decode(OpusDecoder *st, const unsigned char *data,
int mode; int mode;
int transition=0; int transition=0;
int start_band; int start_band;
int redundancy; int redundancy=0;
/* Payloads of 1 (2 including ToC) or 0 trigger the PLC/DTX */ /* Payloads of 1 (2 including ToC) or 0 trigger the PLC/DTX */
if (len<=2) if (len<=2)
...@@ -189,21 +189,23 @@ int opus_decode(OpusDecoder *st, const unsigned char *data, ...@@ -189,21 +189,23 @@ int opus_decode(OpusDecoder *st, const unsigned char *data,
} }
start_band = 0; start_band = 0;
if (mode == MODE_HYBRID) if (mode == MODE_HYBRID && data != NULL)
{ {
/* Check if we have a redundant 0-8 kHz band */ /* Check if we have a redundant 0-8 kHz band */
redundancy = ec_dec_bit_logp(&dec, 12); redundancy = ec_dec_bit_logp(&dec, 12);
if (!redundancy) if (!redundancy)
start_band = 17; start_band = 17;
} }
celt_decoder_ctl(st->celt_dec, CELT_SET_START_BAND(start_band));
if (redundancy) if (redundancy)
transition = 0; transition = 0;
if (transition && mode != MODE_CELT_ONLY) if (transition && mode != MODE_CELT_ONLY)
opus_decode(st, NULL, 0, pcm_transition, IMAX(480, audiosize), 0); opus_decode(st, NULL, 0, pcm_transition, IMAX(480, audiosize), 0);
/* MUST be after PLC */
celt_decoder_ctl(st->celt_dec, CELT_SET_START_BAND(start_band));
if (mode != MODE_SILK_ONLY) if (mode != MODE_SILK_ONLY)
{ {
int endband; int endband;
......
...@@ -157,7 +157,10 @@ int opus_encode(OpusEncoder *st, const short *pcm, int frame_size, ...@@ -157,7 +157,10 @@ int opus_encode(OpusEncoder *st, const short *pcm, int frame_size,
/* Call SILK encoder for the low band */ /* Call SILK encoder for the low band */
nBytes = max_data_bytes-1; nBytes = max_data_bytes-1;
if (prefill) if (prefill)
SKP_Silk_SDK_Encode( st->silk_enc, &st->silk_mode, st->delay_buffer, ENCODER_BUFFER, NULL, 0, 1 ); {
int zero=0;
SKP_Silk_SDK_Encode( st->silk_enc, &st->silk_mode, st->delay_buffer, ENCODER_BUFFER, NULL, &zero, 1 );
}
ret = SKP_Silk_SDK_Encode( st->silk_enc, &st->silk_mode, pcm, frame_size, &enc, &nBytes, 0 ); ret = SKP_Silk_SDK_Encode( st->silk_enc, &st->silk_mode, pcm, frame_size, &enc, &nBytes, 0 );
if( ret ) { if( ret ) {
......
Supports Markdown
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