Setting Opus target application.
This CL is to allow to set Opus target application at the creation of an encoder. According to Opus spec, there are three applications: OPUS_APPLICATION_VOIP OPUS_APPLICATION_AUDIO OPUS_APPLICATION_RESTRICTED_LOWDELAY BUG= R=henrik.lundin@webrtc.org, tina.legrand@webrtc.org Review URL: https://webrtc-codereview.appspot.com/37479004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@8103 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -31,17 +31,31 @@ enum {
|
||||
kWebRtcOpusDefaultFrameSize = 960,
|
||||
};
|
||||
|
||||
int16_t WebRtcOpus_EncoderCreate(OpusEncInst** inst, int32_t channels) {
|
||||
int16_t WebRtcOpus_EncoderCreate(OpusEncInst** inst,
|
||||
int32_t channels,
|
||||
int32_t application) {
|
||||
OpusEncInst* state;
|
||||
if (inst != NULL) {
|
||||
state = (OpusEncInst*) calloc(1, sizeof(OpusEncInst));
|
||||
if (state) {
|
||||
int error;
|
||||
/* Default to VoIP application for mono, and AUDIO for stereo. */
|
||||
int application = (channels == 1) ? OPUS_APPLICATION_VOIP :
|
||||
OPUS_APPLICATION_AUDIO;
|
||||
int opus_app;
|
||||
switch (application) {
|
||||
case 0: {
|
||||
opus_app = OPUS_APPLICATION_VOIP;
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
opus_app = OPUS_APPLICATION_AUDIO;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
free(state);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
state->encoder = opus_encoder_create(48000, channels, application,
|
||||
int error;
|
||||
state->encoder = opus_encoder_create(48000, channels, opus_app,
|
||||
&error);
|
||||
state->in_dtx_mode = 0;
|
||||
if (error == OPUS_OK && state->encoder != NULL) {
|
||||
|
||||
Reference in New Issue
Block a user