Adding CustomAudioAnalyzer interface in APM.

CustomAudioAnalyzer is an interface of a component into APM that
reads AudioBuffer without changing it.
The APM sub-module is optional. It operates in full band.
As described in the comments, it is an experimental interface which
may be changed in the nearest future.

Change-Id: I21edf729d97947529256407b10fa4b5219bb2bf5
Bug: webrtc:9678
Reviewed-on: https://webrtc-review.googlesource.com/96560
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Valeriia Nemychnikova <valeriian@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24481}
This commit is contained in:
Valeriia Nemychnikova
2018-08-29 10:37:09 +02:00
committed by Commit Bot
parent 7015bb410d
commit f06eb57a2f
5 changed files with 97 additions and 12 deletions

View File

@ -2802,6 +2802,25 @@ TEST(ApmConfiguration, EnablePreProcessing) {
apm->ProcessReverseStream(&audio);
}
TEST(ApmConfiguration, EnableCaptureAnalyzer) {
// Verify that apm uses a capture analyzer if one is provided.
auto mock_capture_analyzer_ptr =
new testing::NiceMock<test::MockCustomAudioAnalyzer>();
auto mock_capture_analyzer =
std::unique_ptr<CustomAudioAnalyzer>(mock_capture_analyzer_ptr);
rtc::scoped_refptr<AudioProcessing> apm =
AudioProcessingBuilder()
.SetCaptureAnalyzer(std::move(mock_capture_analyzer))
.Create();
AudioFrame audio;
audio.num_channels_ = 1;
SetFrameSampleRate(&audio, AudioProcessing::NativeRate::kSampleRate16kHz);
EXPECT_CALL(*mock_capture_analyzer_ptr, Analyze(testing::_)).Times(1);
apm->ProcessStream(&audio);
}
TEST(ApmConfiguration, PreProcessingReceivesRuntimeSettings) {
auto mock_pre_processor_ptr =
new testing::NiceMock<test::MockCustomProcessing>();