summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanu Kaskinen <tanuk@iki.fi>2016-02-20 14:32:59 +0200
committerTanu Kaskinen <tanuk@iki.fi>2016-02-24 18:43:58 +0200
commitfab8a16b0f1fe55c0ac209a486f7a7546768867d (patch)
treedca702c5d2c596ca614370a263e17dc54680157e
parenta14db55c2bc912ed68eeb5059d2abc75e9ad9a47 (diff)
downloadpulseaudio-fab8a16b0f1fe55c0ac209a486f7a7546768867d.tar.gz
echo-cancel: Add some bits for webrtc intelligibility enhancer
It's not possible to enable the intelligibility enhancer at the moment, because the feature would require modifying the audio that we play to speakers, which we don't do currently. All audio processing is done at the source side, and it's not easy to change that. This patch is based on Arun Raghavan's code, I just reordered things a bit and reworded the FIXME comment.
-rw-r--r--src/modules/echo-cancel/webrtc.cc20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/modules/echo-cancel/webrtc.cc b/src/modules/echo-cancel/webrtc.cc
index ee3075fe8..7e4e95239 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_COMFORT_NOISE true
#define DEFAULT_DRIFT_COMPENSATION false
#define DEFAULT_EXTENDED_FILTER false
+#define DEFAULT_INTELLIGIBILITY_ENHANCER false
static const char* const valid_modargs[] = {
"high_pass_filter",
@@ -58,6 +59,7 @@ static const char* const valid_modargs[] = {
"comfort_noise",
"drift_compensation",
"extended_filter",
+ "intelligibility_enhancer",
NULL
};
@@ -84,7 +86,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;
+ bool hpf, ns, agc, dgc, mobile, cn, ext_filter, intelligibility;
int rm = -1;
pa_modargs *ma;
@@ -163,8 +165,16 @@ bool pa_webrtc_ec_init(pa_core *c, pa_echo_canceller *ec,
goto fail;
}
+ intelligibility = DEFAULT_INTELLIGIBILITY_ENHANCER;
+ if (pa_modargs_get_value_boolean(ma, "intelligibility_enhancer", &intelligibility) < 0) {
+ pa_log("Failed to parse intelligibility_enhancer value");
+ goto fail;
+ }
+
if (ext_filter)
config.Set<webrtc::ExtendedFilter>(new webrtc::ExtendedFilter(true));
+ if (intelligibility)
+ pa_log_warn("The intelligibility enhancer is not currently supported");
apm = webrtc::AudioProcessing::Create(config);
@@ -253,7 +263,13 @@ void pa_webrtc_ec_play(pa_echo_canceller *ec, const uint8_t *play) {
pa_assert(play_frame.samples_per_channel_ <= webrtc::AudioFrame::kMaxDataSizeSamples);
memcpy(play_frame.data_, play, ec->params.priv.webrtc.blocksize);
- apm->AnalyzeReverseStream(&play_frame);
+ apm->ProcessReverseStream(&play_frame);
+
+ /* FIXME: If ProcessReverseStream() makes any changes to the audio, such as
+ * applying intelligibility enhancement, those changes don't have any
+ * effect. This function is called at the source side, but the processing
+ * would have to be done in the sink to be able to feed the processed audio
+ * to speakers. */
}
void pa_webrtc_ec_record(pa_echo_canceller *ec, const uint8_t *rec, uint8_t *out) {