ref: baed21dc9dd8a6548e00ca1ded6df0afa6838cce
parent: 103302b3752609e28cb6ba4f706a6f6e49ffef68
author: Jean-Marc Valin <[email protected]>
date: Thu May 19 13:25:48 EDT 2011
Fixes a bug in the init() functions where were weren't zeroing the entire state
--- a/src/opus_decoder.c
+++ b/src/opus_decoder.c
@@ -65,9 +65,9 @@
{
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 ) {
@@ -74,7 +74,6 @@
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;
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -80,15 +80,14 @@
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;