Moving/renaming webrtc/common.h.
This file defines webrtc::Config which was mostly used by modules/audio_processing. The files webrtc/common.h, webrtc/common.cc and webrtc/test/common_unittests.cc are moved to modules/audio_processing and the few remaining uses of webrtc::Config are replaced with simpler code.
- For NetEq and pacing configuration, a VoEBase::ChannelConfig is passed to VoEBase::CreateChannel().
- Removes the need for VoiceEngine::Create(const Config& config). No need to store the webrtc::Config in VoE shared state.
BUG=webrtc:5879
Review-Url: https://codereview.webrtc.org/2307533004
Cr-Original-Commit-Position: refs/heads/master@{#14109}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 88499ecaca050be2dd21fff17140d6681c3bac95
diff --git a/test/BUILD.gn b/test/BUILD.gn
index 6b6a2bb..6991449 100644
--- a/test/BUILD.gn
+++ b/test/BUILD.gn
@@ -282,7 +282,6 @@
"channel_transport/udp_socket_manager_unittest.cc",
"channel_transport/udp_socket_wrapper_unittest.cc",
"channel_transport/udp_transport_unittest.cc",
- "common_unittest.cc",
"fake_network_pipe_unittest.cc",
"frame_generator_unittest.cc",
"rtp_file_reader_unittest.cc",
diff --git a/test/call_test.cc b/test/call_test.cc
index a766f79..e81d947 100644
--- a/test/call_test.cc
+++ b/test/call_test.cc
@@ -8,7 +8,6 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/base/checks.h"
-#include "webrtc/common.h"
#include "webrtc/config.h"
#include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h"
#include "webrtc/test/call_test.h"
@@ -312,9 +311,9 @@
voe_send_.codec = VoECodec::GetInterface(voe_send_.voice_engine);
EXPECT_EQ(0, voe_send_.base->Init(fake_send_audio_device_.get(), nullptr,
decoder_factory_));
- Config voe_config;
- voe_config.Set<VoicePacing>(new VoicePacing(true));
- voe_send_.channel_id = voe_send_.base->CreateChannel(voe_config);
+ VoEBase::ChannelConfig config;
+ config.enable_voice_pacing = true;
+ voe_send_.channel_id = voe_send_.base->CreateChannel(config);
EXPECT_GE(voe_send_.channel_id, 0);
voe_recv_.voice_engine = VoiceEngine::Create();
diff --git a/test/common_unittest.cc b/test/common_unittest.cc
deleted file mode 100644
index a239dad..0000000
--- a/test/common_unittest.cc
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2013 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 "webrtc/common.h"
-
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace webrtc {
-namespace {
-
-struct MyExperiment {
- static const ConfigOptionID identifier = ConfigOptionID::kMyExperimentForTest;
- static const int kDefaultFactor;
- static const int kDefaultOffset;
-
- MyExperiment()
- : factor(kDefaultFactor), offset(kDefaultOffset) {}
-
- MyExperiment(int factor, int offset)
- : factor(factor), offset(offset) {}
-
- int factor;
- int offset;
-};
-
-const int MyExperiment::kDefaultFactor = 1;
-const int MyExperiment::kDefaultOffset = 2;
-
-TEST(Config, ReturnsDefaultInstanceIfNotConfigured) {
- Config config;
- const MyExperiment& my_exp = config.Get<MyExperiment>();
- EXPECT_EQ(MyExperiment::kDefaultFactor, my_exp.factor);
- EXPECT_EQ(MyExperiment::kDefaultOffset, my_exp.offset);
-}
-
-TEST(Config, ReturnOptionWhenSet) {
- Config config;
- config.Set<MyExperiment>(new MyExperiment(5, 1));
- const MyExperiment& my_exp = config.Get<MyExperiment>();
- EXPECT_EQ(5, my_exp.factor);
- EXPECT_EQ(1, my_exp.offset);
-}
-
-TEST(Config, SetNullSetsTheOptionBackToDefault) {
- Config config;
- config.Set<MyExperiment>(new MyExperiment(5, 1));
- config.Set<MyExperiment>(NULL);
- const MyExperiment& my_exp = config.Get<MyExperiment>();
- EXPECT_EQ(MyExperiment::kDefaultFactor, my_exp.factor);
- EXPECT_EQ(MyExperiment::kDefaultOffset, my_exp.offset);
-}
-
-struct Algo1_CostFunction {
- static const ConfigOptionID identifier =
- ConfigOptionID::kAlgo1CostFunctionForTest;
- Algo1_CostFunction() {}
-
- virtual int cost(int x) const {
- return x;
- }
-
- virtual ~Algo1_CostFunction() {}
-};
-
-struct SqrCost : Algo1_CostFunction {
- virtual int cost(int x) const {
- return x*x;
- }
-};
-
-TEST(Config, SupportsPolymorphism) {
- Config config;
- config.Set<Algo1_CostFunction>(new SqrCost());
- EXPECT_EQ(25, config.Get<Algo1_CostFunction>().cost(5));
-}
-} // namespace
-} // namespace webrtc
diff --git a/test/mock_voice_engine.h b/test/mock_voice_engine.h
index 469028d..abd493b 100644
--- a/test/mock_voice_engine.h
+++ b/test/mock_voice_engine.h
@@ -30,8 +30,7 @@
// http://crbug.com/428099.
MockVoiceEngine(
rtc::scoped_refptr<AudioDecoderFactory> decoder_factory = nullptr)
- : VoiceEngineImpl(new Config(), true),
- decoder_factory_(decoder_factory) {
+ : decoder_factory_(decoder_factory) {
// Increase ref count so this object isn't automatically deleted whenever
// interfaces are Release():d.
++_ref_count;
@@ -123,7 +122,7 @@
MOCK_METHOD0(audio_processing, AudioProcessing*());
MOCK_METHOD0(Terminate, int());
MOCK_METHOD0(CreateChannel, int());
- MOCK_METHOD1(CreateChannel, int(const Config& config));
+ MOCK_METHOD1(CreateChannel, int(const ChannelConfig& config));
MOCK_METHOD1(DeleteChannel, int(int channel));
MOCK_METHOD1(StartReceive, int(int channel));
MOCK_METHOD1(StopReceive, int(int channel));
diff --git a/test/test.gyp b/test/test.gyp
index fc9a2ad..7f64b77 100644
--- a/test/test.gyp
+++ b/test/test.gyp
@@ -210,7 +210,6 @@
'<(DEPTH)/testing/gtest.gyp:gtest',
],
'sources': [
- 'common_unittest.cc',
'fake_network_pipe_unittest.cc',
'frame_generator_unittest.cc',
'rtp_file_reader_unittest.cc',