我正在尝试使用opus编码和解码音频,但是当我运行代码时,函数opus_encode_float返回-1。
int opuscode(float *sound)
{
unsigned char data[1000000];
int *error;
int ini;
opus_int32 rate = SAMPLE_RATE;
int size = opus_encoder_get_size(CHANNELS);
OpusEncoder *op = opus_encoder_create(rate, 2, OPUS_APPLICATION_VOIP, error);
opus_encoder_ctl(op, OPUS_GET_BANDWIDTH(&rate));
int len = opus_encode_float(op, sound, rate, data, rate);
printf("%i ici ", len);
int decodesize = opus_decoder_get_size(CHANNELS);
OpusDecoder *dop = opus_decoder_create(rate, 2, error);
}