2012-12-04 115 views
2

Im在opus-codec中遇到了一些麻煩。opus_encoder_create()返回空指針

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 

任何想法,爲什麼?謝謝。

回答

6

The documentation列出了支持的採樣頻率:

這必須是8000一個,12000,16000,24000,或48000

注意,44100是不是在列表中;這似乎是「錯誤論證」錯誤的極好原因。