Allow extracting the linear AEC output
This CL enables extracting the linear AEC output,
allowing for more straightforward
testing/development.
Bug: b/140823178
Change-Id: I14f7934008d87066b35500466cb6e6d96f811688
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153672
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29789}
diff --git a/modules/audio_processing/include/audio_processing.h b/modules/audio_processing/include/audio_processing.h
index f1242a7..113bd2a 100644
--- a/modules/audio_processing/include/audio_processing.h
+++ b/modules/audio_processing/include/audio_processing.h
@@ -280,6 +280,7 @@
bool legacy_moderate_suppression_level = false;
// Recommended not to use. Will be removed in the future.
bool use_legacy_aec = false;
+ bool export_linear_aec_output = false;
} echo_canceller;
// Enables background noise suppression.
@@ -611,6 +612,13 @@
virtual int AnalyzeReverseStream(const float* const* data,
const StreamConfig& reverse_config) = 0;
+ // Returns the most recently produced 10 ms of the linear AEC output at a rate
+ // of 16 kHz. If there is more than one capture channel, a mono representation
+ // of the input is returned. Returns true/false to indicate whether an output
+ // returned.
+ virtual bool GetLinearAecOutput(
+ rtc::ArrayView<std::array<float, 160>> linear_output) const = 0;
+
// This must be called prior to ProcessStream() if and only if adaptive analog
// gain control is enabled, to pass the current analog level from the audio
// HAL. Must be within the range provided in Config::GainController1.
diff --git a/modules/audio_processing/include/mock_audio_processing.h b/modules/audio_processing/include/mock_audio_processing.h
index 6b12392..0932696 100644
--- a/modules/audio_processing/include/mock_audio_processing.h
+++ b/modules/audio_processing/include/mock_audio_processing.h
@@ -47,6 +47,10 @@
MOCK_METHOD1(AnalyzeCapture, void(AudioBuffer* capture));
MOCK_METHOD2(ProcessCapture,
void(AudioBuffer* capture, bool echo_path_change));
+ MOCK_METHOD3(ProcessCapture,
+ void(AudioBuffer* capture,
+ AudioBuffer* linear_output,
+ bool echo_path_change));
MOCK_CONST_METHOD0(GetMetrics, Metrics());
MOCK_METHOD1(SetAudioBufferDelay, void(int delay_ms));
MOCK_CONST_METHOD0(ActiveProcessing, bool());
@@ -105,6 +109,9 @@
const StreamConfig& input_config,
const StreamConfig& output_config,
float* const* dest));
+ MOCK_CONST_METHOD1(
+ GetLinearAecOutput,
+ bool(rtc::ArrayView<std::array<float, 160>> linear_output));
MOCK_METHOD1(set_stream_delay_ms, int(int delay));
MOCK_CONST_METHOD0(stream_delay_ms, int());
MOCK_CONST_METHOD0(was_stream_delay_set, bool());