Posting Opus's set-force-channels functionality to WebRTC.

BUG=webrtc:6303

Review-Url: https://codereview.webrtc.org/2352713005
Cr-Commit-Position: refs/heads/master@{#14394}
This commit is contained in:
minyue
2016-09-27 02:08:47 -07:00
committed by Commit bot
parent 20e77c7b8a
commit c8299f9f87
3 changed files with 57 additions and 0 deletions

View File

@ -208,6 +208,20 @@ int16_t WebRtcOpus_SetComplexity(OpusEncInst* inst, int32_t complexity) {
}
}
int16_t WebRtcOpus_SetForceChannels(OpusEncInst* inst, int32_t num_channels) {
if (!inst)
return -1;
if (num_channels == 0) {
return opus_encoder_ctl(inst->encoder,
OPUS_SET_FORCE_CHANNELS(OPUS_AUTO));
} else if (num_channels == 1 || num_channels == 2) {
return opus_encoder_ctl(inst->encoder,
OPUS_SET_FORCE_CHANNELS(num_channels));
} else {
return -1;
}
}
int16_t WebRtcOpus_DecoderCreate(OpusDecInst** inst, size_t channels) {
int error;
OpusDecInst* state;