[PATCH v4 12/23] echo-cancel: Add a modarg toggle for VAD in the webrtc canceller

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Arun Raghavan <git@xxxxxxxxxxxxxxxx>

---
 src/modules/echo-cancel/webrtc.cc | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/modules/echo-cancel/webrtc.cc b/src/modules/echo-cancel/webrtc.cc
index 158f7ed..768f631 100644
--- a/src/modules/echo-cancel/webrtc.cc
+++ b/src/modules/echo-cancel/webrtc.cc
@@ -47,6 +47,7 @@ PA_C_DECL_END
 #define DEFAULT_ROUTING_MODE "speakerphone"
 #define DEFAULT_COMFORT_NOISE true
 #define DEFAULT_DRIFT_COMPENSATION false
+#define DEFAULT_VAD true
 #define DEFAULT_EXTENDED_FILTER false
 #define DEFAULT_INTELLIGIBILITY_ENHANCER false
 #define DEFAULT_EXPERIMENTAL_AGC false
@@ -64,6 +65,7 @@ static const char* const valid_modargs[] = {
     "routing_mode",
     "comfort_noise",
     "drift_compensation",
+    "voice_detection",
     "extended_filter",
     "intelligibility_enhancer",
     "experimental_agc",
@@ -143,7 +145,7 @@ bool pa_webrtc_ec_init(pa_core *c, pa_echo_canceller *ec,
     webrtc::AudioProcessing *apm = NULL;
     webrtc::ProcessingConfig pconfig;
     webrtc::Config config;
-    bool hpf, ns, agc, dgc, mobile, cn, ext_filter, intelligibility, experimental_agc;
+    bool hpf, ns, agc, dgc, mobile, cn, vad, ext_filter, intelligibility, experimental_agc;
     int rm = -1;
     pa_modargs *ma;
     bool trace = false;
@@ -217,6 +219,12 @@ bool pa_webrtc_ec_init(pa_core *c, pa_echo_canceller *ec,
         }
     }
 
+    vad = DEFAULT_VAD;
+    if (pa_modargs_get_value_boolean(ma, "voice_detection", &vad) < 0) {
+        pa_log("Failed to parse voice_detection value");
+        goto fail;
+    }
+
     ext_filter = DEFAULT_EXTENDED_FILTER;
     if (pa_modargs_get_value_boolean(ma, "extended_filter", &ext_filter) < 0) {
         pa_log("Failed to parse extended_filter value");
@@ -304,7 +312,8 @@ bool pa_webrtc_ec_init(pa_core *c, pa_echo_canceller *ec,
         apm->gain_control()->Enable(true);
     }
 
-    apm->voice_detection()->Enable(true);
+    if (vad)
+        apm->voice_detection()->Enable(true);
 
     ec->params.priv.webrtc.apm = apm;
     ec->params.priv.webrtc.sample_spec = *out_ss;
-- 
2.5.0



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux