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

Fixes a bug in the init() functions where were weren't zeroing the entire state

parent 103302b3
......@@ -65,16 +65,15 @@ OpusDecoder *opus_decoder_init(OpusDecoder *st, int Fs, int channels)
{
void *silk_dec;
CELTDecoder *celt_dec;
int ret, silkDecSizeBytes, celtDecSizeBytes;
int ret, silkDecSizeBytes;
memset(st, 0, sizeof(OpusDecoder));
memset(st, 0, opus_decoder_get_size(channels));
/* Initialize SILK encoder */
ret = silk_Get_Decoder_Size( &silkDecSizeBytes );
if( ret ) {
return NULL;
}
silkDecSizeBytes = align(silkDecSizeBytes);
celtDecSizeBytes = celt_decoder_get_size(channels);
st->silk_dec_offset = align(sizeof(OpusDecoder));
st->celt_dec_offset = st->silk_dec_offset+silkDecSizeBytes;
silk_dec = (char*)st+st->silk_dec_offset;
......
......@@ -80,15 +80,14 @@ OpusEncoder *opus_encoder_init(OpusEncoder* st, int Fs, int channels)
void *silk_enc;
CELTEncoder *celt_enc;
int err;
int ret, silkEncSizeBytes, celtEncSizeBytes;
int ret, silkEncSizeBytes;
memset(st, 0, sizeof(OpusEncoder));
memset(st, 0, opus_encoder_get_size(channels));
/* Create SILK encoder */
ret = silk_Get_Encoder_Size( &silkEncSizeBytes );
if( ret )
return NULL;
silkEncSizeBytes = align(silkEncSizeBytes);
celtEncSizeBytes = celt_encoder_get_size(channels);
st->silk_enc_offset = align(sizeof(OpusEncoder));
st->celt_enc_offset = st->silk_enc_offset+silkEncSizeBytes;
silk_enc = (char*)st+st->silk_enc_offset;
......
Markdown is supported
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