Files
platform-external-webrtc/media/engine/apm_helpers_unittest.cc
saza 0bad15f2ed Remove the noise_suppression() pointer to submodule interface
Bug: webrtc:9878
Change-Id: I356afddb56cc1957e9d0415e2723f66e0e4ac522
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/137517
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29499}
2019-10-16 11:55:15 +00:00

74 lines
2.3 KiB
C++

/*
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "media/engine/apm_helpers.h"
#include "api/scoped_refptr.h"
#include "modules/audio_processing/include/audio_processing.h"
#include "test/gmock.h"
#include "test/gtest.h"
namespace webrtc {
namespace {
struct TestHelper {
TestHelper() {
// This replicates the conditions from voe_auto_test.
Config config;
config.Set<ExperimentalAgc>(new ExperimentalAgc(false));
apm_ = rtc::scoped_refptr<AudioProcessing>(
AudioProcessingBuilder().Create(config));
apm_helpers::Init(apm());
}
AudioProcessing* apm() { return apm_.get(); }
const AudioProcessing* apm() const { return apm_.get(); }
private:
rtc::scoped_refptr<AudioProcessing> apm_;
};
} // namespace
TEST(ApmHelpersTest, EcStatus_DefaultMode) {
TestHelper helper;
webrtc::AudioProcessing::Config config = helper.apm()->GetConfig();
EXPECT_FALSE(config.echo_canceller.enabled);
}
TEST(ApmHelpersTest, EcStatus_EnableDisable) {
TestHelper helper;
webrtc::AudioProcessing::Config config;
apm_helpers::SetEcStatus(helper.apm(), true, kEcAecm);
config = helper.apm()->GetConfig();
EXPECT_TRUE(config.echo_canceller.enabled);
EXPECT_TRUE(config.echo_canceller.mobile_mode);
apm_helpers::SetEcStatus(helper.apm(), false, kEcAecm);
config = helper.apm()->GetConfig();
EXPECT_FALSE(config.echo_canceller.enabled);
apm_helpers::SetEcStatus(helper.apm(), true, kEcConference);
config = helper.apm()->GetConfig();
EXPECT_TRUE(config.echo_canceller.enabled);
EXPECT_FALSE(config.echo_canceller.mobile_mode);
apm_helpers::SetEcStatus(helper.apm(), false, kEcConference);
config = helper.apm()->GetConfig();
EXPECT_FALSE(config.echo_canceller.enabled);
apm_helpers::SetEcStatus(helper.apm(), true, kEcAecm);
config = helper.apm()->GetConfig();
EXPECT_TRUE(config.echo_canceller.enabled);
EXPECT_TRUE(config.echo_canceller.mobile_mode);
}
} // namespace webrtc