我在使用 opus-codec 时遇到了一些问题。
opus_encoder_create() 返回一个空指针并抛出一个 OPUS_BAD_ARG 错误
OpusEncoder * m_enc;
m_enc = opus_encoder_create(44100, 2, OPUS_APPLICATION_VOIP, &this->m_error);
这就是我用 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
任何想法为什么?谢谢。