2

Im having some trouble with opus-codec.

opus_encoder_create() return a null pointer and throw an OPUS_BAD_ARG error

OpusEncoder * m_enc;
m_enc = opus_encoder_create(44100, 2, OPUS_APPLICATION_VOIP, &this->m_error);

this is what I get with gdb:

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000001fa4
opus_encode_float (st=0x0, pcm=0x100717e20, frame_size=8, data=0x100840c00 "", out_data_bytes=4000) at opus_encoder.c:581
581     st->rangeFinal = 0;
(gdb) bt
#0  opus_encode_float (st=0x0, pcm=0x100717e20, frame_size=8, data=0x100840c00 "", out_data_bytes=4000) at opus_encoder.c:581
#1  0x0000000100002b1d in Encoder::Encode (this=0x7fff5fbffa70, audioFrame=0x100717e20, frameSize=8) at Encoder.cpp:39
#2  0x000000010000192c in main () at main.cpp:101

Any ideas why? Thanks.

1 Answer 1

6

The documentation lists the supported sampling frequencies:

This must be one of 8000, 12000, 16000, 24000, or 48000.

Notice that 44100 is not in the list; that would seem excellent cause for a "bad argument" error.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.