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}
diff --git a/modules/audio_coding/codecs/opus/opus_interface.c b/modules/audio_coding/codecs/opus/opus_interface.c
index 5166f4c..d219098 100644
--- a/modules/audio_coding/codecs/opus/opus_interface.c
+++ b/modules/audio_coding/codecs/opus/opus_interface.c
@@ -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 @@
}
}
+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;