[opus] Trying to use Opus in an STM32F429IIT6 embedded project

Jean-Marc Valin jmvalin at jmvalin.ca
Mon Jun 5 16:05:42 UTC 2017


On 05/06/17 08:28 AM, Ulisses Piassa wrote:
> I ported all the files from OpusLib 1.1.4 needed to compile the project,
> but when I try to create and OpusDecode state, it returns the error -7
> (OPUS_ALLOC_FAIL).

Are you getting OPUS_ALLOC_FAIL on the opus_decoder_init() too or just
on opus_decoder_create()?

> I'm compiling it with the USE_ALLOCA flag. I also tried to compile it
> with the flags OVERRIDE_OPUS_ALLOC OVERRIDE_OPUS_FREE
> 'opus_alloc(x)=NULL' and 'opus_free(x)=NULL', but still having no success.

when you use OVERRIDE_OPUS_ALLOC and opus_alloc(x)=NULL you're
essentially saying "I don't have a working malloc()", so none of the
calls to the *_create() functions can work, it's normal that you're
seeing those fail with OPUS_ALLOC_FAIL because there's no way the
library is able to allocate memory.

> The code I wrote is:
> 
>     int size;
>     int error;
>     OpusDecoder* dec;
>     
>     size = opus_decoder_get_size(1);
>     dec = (OpusDecoder *) malloc(size);
>     error = opus_decoder_init(dec, 8000, 1);

This version should actually work and I don't see how
opus_decoder_init() could return OPUS_ALLOC_FAIL since it's not
allocating anything. Are you sure that's what it returns?

	Jean-Marc


More information about the opus mailing list