Setting OPUS_SIGNAL_VOICE when enable DTX.

A better solution than forcing OPUS_APPLICATION_VOIP when enabling DTX has been found, which is to set OPUS_SIGNAL_VOICE.

This reduces the uncertainty of entering DTX over silence period of audio.

This CL contains the setup of OPUS_SIGNAL_VOICE and decoupling opus application mode with DTX.

BUG=4559
R=henrik.lundin@webrtc.org, henrika@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/46959004

Cr-Commit-Position: refs/heads/master@{#9168}
This commit is contained in:
Minyue Li
2015-05-11 12:19:35 +02:00
parent 9f7908e497
commit 092041c1cd
13 changed files with 97 additions and 133 deletions

View File

@ -168,15 +168,29 @@ int16_t WebRtcOpus_DisableFec(OpusEncInst* inst) {
}
int16_t WebRtcOpus_EnableDtx(OpusEncInst* inst) {
if (inst) {
return opus_encoder_ctl(inst->encoder, OPUS_SET_DTX(1));
} else {
if (!inst) {
return -1;
}
// To prevent Opus from entering CELT-only mode by forcing signal type to
// voice to make sure that DTX behaves correctly. Currently, DTX does not
// last long during a pure silence, if the signal type is not forced.
// TODO(minyue): Remove the signal type forcing when Opus DTX works properly
// without it.
int ret = opus_encoder_ctl(inst->encoder,
OPUS_SET_SIGNAL(OPUS_SIGNAL_VOICE));
if (ret != OPUS_OK)
return ret;
return opus_encoder_ctl(inst->encoder, OPUS_SET_DTX(1));
}
int16_t WebRtcOpus_DisableDtx(OpusEncInst* inst) {
if (inst) {
int ret = opus_encoder_ctl(inst->encoder,
OPUS_SET_SIGNAL(OPUS_AUTO));
if (ret != OPUS_OK)
return ret;
return opus_encoder_ctl(inst->encoder, OPUS_SET_DTX(0));
} else {
return -1;