Implement Opus bandwidth adjustment behind a FieldTrial

Bug: webrtc:8522
Change-Id: I3a32ebfecd27ff74b507c2cee9e16aab17153442
Reviewed-on: https://webrtc-review.googlesource.com/22210
Commit-Queue: Alejandro Luebs <aluebs@webrtc.org>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20799}
This commit is contained in:
Alex Luebs
2017-11-20 11:13:56 -08:00
committed by Commit Bot
parent 64eaa99cfc
commit eeb2765f6c
9 changed files with 368 additions and 3 deletions

View File

@ -11,7 +11,6 @@
#include "modules/audio_coding/codecs/opus/opus_interface.h"
#include "rtc_base/checks.h"
#include "modules/audio_coding/codecs/opus/opus_inst.h"
#include <stdlib.h>
#include <string.h>
@ -229,6 +228,27 @@ int16_t WebRtcOpus_SetComplexity(OpusEncInst* inst, int32_t complexity) {
}
}
int32_t WebRtcOpus_GetBandwidth(OpusEncInst* inst) {
if (!inst) {
return -1;
}
int32_t bandwidth;
if (opus_encoder_ctl(inst->encoder, OPUS_GET_BANDWIDTH(&bandwidth)) == 0) {
return bandwidth;
} else {
return -1;
}
}
int16_t WebRtcOpus_SetBandwidth(OpusEncInst* inst, int32_t bandwidth) {
if (inst) {
return opus_encoder_ctl(inst->encoder, OPUS_SET_BANDWIDTH(bandwidth));
} else {
return -1;
}
}
int16_t WebRtcOpus_SetForceChannels(OpusEncInst* inst, size_t num_channels) {
if (!inst)
return -1;