summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Raghavan <git@arunraghavan.net>2016-02-17 19:47:07 +0530
committerArun Raghavan <git@arunraghavan.net>2016-02-25 09:09:13 +0530
commit08afc36ae4cd678de842648874c6d7e4f5fa0a36 (patch)
tree8bbe18817ae2b5e9ae10c089ef8e0e91888baca5
parent8de7dfec142554e24506471118fe6a3eb2793fa5 (diff)
downloadpulseaudio-08afc36ae4cd678de842648874c6d7e4f5fa0a36.tar.gz
echo-cancel: Make webrtc AGC start volume a modarg
Allows for tuning based on the target hardware.
-rw-r--r--src/modules/echo-cancel/webrtc.cc19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/modules/echo-cancel/webrtc.cc b/src/modules/echo-cancel/webrtc.cc
index b96449577..54b355862 100644
--- a/src/modules/echo-cancel/webrtc.cc
+++ b/src/modules/echo-cancel/webrtc.cc
@@ -51,10 +51,10 @@ PA_C_DECL_END
#define DEFAULT_EXTENDED_FILTER false
#define DEFAULT_INTELLIGIBILITY_ENHANCER false
#define DEFAULT_EXPERIMENTAL_AGC false
+#define DEFAULT_AGC_START_VOLUME 85
#define DEFAULT_TRACE false
#define WEBRTC_AGC_MAX_VOLUME 255
-#define WEBRTC_AGC_START_VOLUME 85
static const char* const valid_modargs[] = {
"high_pass_filter",
@@ -69,6 +69,7 @@ static const char* const valid_modargs[] = {
"extended_filter",
"intelligibility_enhancer",
"experimental_agc",
+ "agc_start_volume",
"trace",
NULL
};
@@ -147,6 +148,7 @@ bool pa_webrtc_ec_init(pa_core *c, pa_echo_canceller *ec,
webrtc::Config config;
bool hpf, ns, agc, dgc, mobile, cn, vad, ext_filter, intelligibility, experimental_agc;
int rm = -1;
+ uint32_t agc_start_volume;
pa_modargs *ma;
bool trace = false;
@@ -243,12 +245,23 @@ bool pa_webrtc_ec_init(pa_core *c, pa_echo_canceller *ec,
goto fail;
}
+ agc_start_volume = DEFAULT_AGC_START_VOLUME;
+ if (pa_modargs_get_value_u32(ma, "agc_start_volume", &agc_start_volume) < 0) {
+ pa_log("Failed to parse agc_start_volume value");
+ goto fail;
+ }
+ if (agc_start_volume > WEBRTC_AGC_MAX_VOLUME) {
+ pa_log("AGC start volume must not exceed %u", WEBRTC_AGC_MAX_VOLUME);
+ goto fail;
+ }
+ ec->params.webrtc.agc_start_volume = agc_start_volume;
+
if (ext_filter)
config.Set<webrtc::ExtendedFilter>(new webrtc::ExtendedFilter(true));
if (intelligibility)
pa_log_warn("The intelligibility enhancer is not currently supported");
if (experimental_agc)
- config.Set<webrtc::ExperimentalAgc>(new webrtc::ExperimentalAgc(true, WEBRTC_AGC_START_VOLUME));
+ config.Set<webrtc::ExperimentalAgc>(new webrtc::ExperimentalAgc(true, ec->params.webrtc.agc_start_volume));
trace = DEFAULT_TRACE;
if (pa_modargs_get_value_boolean(ma, "trace", &trace) < 0) {
@@ -390,7 +403,7 @@ void pa_webrtc_ec_record(pa_echo_canceller *ec, const uint8_t *rec, uint8_t *out
* needed to make sure that there's enough energy in the capture
* signal for the AGC to work */
ec->params.webrtc.first = false;
- new_volume = WEBRTC_AGC_START_VOLUME;
+ new_volume = ec->params.webrtc.agc_start_volume;
} else {
new_volume = apm->gain_control()->stream_analog_level();
}