Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.
My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
diff --git a/lib/rbcodec/codecs/libopus/opus_decoder.c b/lib/rbcodec/codecs/libopus/opus_decoder.c index 7103b18..f8f10e9 100644 --- a/lib/rbcodec/codecs/libopus/opus_decoder.c +++ b/lib/rbcodec/codecs/libopus/opus_decoder.c @@ -131,10 +131,15 @@ int opus_decoder_init(OpusDecoder *st, opus_int32 Fs, int channels) return OPUS_OK; } +#ifndef CUSTOM_MODES +#define STATIC_DECODER_SIZE 26532 /* 26486 for 32bit, 26532 for 64bit environment */ +static char s_dec[STATIC_DECODER_SIZE] IBSS_ATTR; +#endif + OpusDecoder *opus_decoder_create(opus_int32 Fs, int channels, int *error) { int ret; - OpusDecoder *st; + OpusDecoder *st = NULL; if ((Fs!=48000&&Fs!=24000&&Fs!=16000&&Fs!=12000&&Fs!=8000) || (channels!=1&&channels!=2)) { @@ -142,7 +147,13 @@ OpusDecoder *opus_decoder_create(opus_int32 Fs, int channels, int *error) *error = OPUS_BAD_ARG; return NULL; } - st = (OpusDecoder *)opus_alloc(opus_decoder_get_size(channels)); +#ifndef CUSTOM_MODES + if (STATIC_DECODER_SIZE >= opus_decoder_get_size(channels)) + st = (OpusDecoder *)s_dec; + else +#else + st = (OpusDecoder *)opus_alloc(opus_decoder_get_size(channels)); +#endif if (st == NULL) { if (error) |