Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Unified Diff: webrtc/media/engine/webrtcvoiceengine_unittest.cc

Issue 2151453002: Revert of WebRtcVoiceEngine: Use AudioDecoderFactory to generate recv codecs. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/media/engine/webrtcvoiceengine.cc ('k') | webrtc/media/media.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/engine/webrtcvoiceengine_unittest.cc
diff --git a/webrtc/media/engine/webrtcvoiceengine_unittest.cc b/webrtc/media/engine/webrtcvoiceengine_unittest.cc
index ec7a168f65ad4c94c4c43c63c1304458a5503e3f..2db70d1521758ecb27c56aec3add98ca058740f0 100644
--- a/webrtc/media/engine/webrtcvoiceengine_unittest.cc
+++ b/webrtc/media/engine/webrtcvoiceengine_unittest.cc
@@ -75,9 +75,7 @@
cricket::FakeWebRtcVoiceEngine voe;
EXPECT_FALSE(voe.IsInited());
{
- cricket::WebRtcVoiceEngine engine(
- &adm, webrtc::MockAudioDecoderFactory::CreateUnusedFactory(),
- new FakeVoEWrapper(&voe));
+ cricket::WebRtcVoiceEngine engine(&adm, nullptr, new FakeVoEWrapper(&voe));
EXPECT_TRUE(voe.IsInited());
}
EXPECT_FALSE(voe.IsInited());
@@ -98,13 +96,12 @@
explicit WebRtcVoiceEngineTestFake(const char* field_trials)
: call_(webrtc::Call::Config()), override_field_trials_(field_trials) {
- auto factory = webrtc::MockAudioDecoderFactory::CreateUnusedFactory();
EXPECT_CALL(adm_, AddRef()).WillOnce(Return(0));
EXPECT_CALL(adm_, Release()).WillOnce(Return(0));
EXPECT_CALL(adm_, BuiltInAECIsAvailable()).WillOnce(Return(false));
EXPECT_CALL(adm_, BuiltInAGCIsAvailable()).WillOnce(Return(false));
EXPECT_CALL(adm_, BuiltInNSIsAvailable()).WillOnce(Return(false));
- engine_.reset(new cricket::WebRtcVoiceEngine(&adm_, factory,
+ engine_.reset(new cricket::WebRtcVoiceEngine(&adm_, nullptr,
new FakeVoEWrapper(&voe_)));
send_parameters_.codecs.push_back(kPcmuCodec);
recv_parameters_.codecs.push_back(kPcmuCodec);
@@ -3364,10 +3361,20 @@
// Tests that the library initializes and shuts down properly.
TEST(WebRtcVoiceEngineTest, StartupShutdown) {
+ using testing::_;
+ using testing::AnyNumber;
+
// If the VoiceEngine wants to gather available codecs early, that's fine but
// we never want it to create a decoder at this stage.
- cricket::WebRtcVoiceEngine engine(
- nullptr, webrtc::MockAudioDecoderFactory::CreateUnusedFactory());
+ rtc::scoped_refptr<webrtc::MockAudioDecoderFactory> factory =
+ new rtc::RefCountedObject<webrtc::MockAudioDecoderFactory>;
+ ON_CALL(*factory.get(), GetSupportedFormats())
+ .WillByDefault(Return(std::vector<webrtc::SdpAudioFormat>()));
+ EXPECT_CALL(*factory.get(), GetSupportedFormats())
+ .Times(AnyNumber());
+ EXPECT_CALL(*factory.get(), MakeAudioDecoderMock(_, _)).Times(0);
+
+ cricket::WebRtcVoiceEngine engine(nullptr, factory);
std::unique_ptr<webrtc::Call> call(
webrtc::Call::Create(webrtc::Call::Config()));
cricket::VoiceMediaChannel* channel = engine.CreateChannel(
@@ -3382,8 +3389,7 @@
EXPECT_CALL(adm, AddRef()).Times(3).WillRepeatedly(Return(0));
EXPECT_CALL(adm, Release()).Times(3).WillRepeatedly(Return(0));
{
- cricket::WebRtcVoiceEngine engine(
- &adm, webrtc::MockAudioDecoderFactory::CreateUnusedFactory());
+ cricket::WebRtcVoiceEngine engine(&adm, nullptr);
std::unique_ptr<webrtc::Call> call(
webrtc::Call::Create(webrtc::Call::Config()));
cricket::VoiceMediaChannel* channel = engine.CreateChannel(
@@ -3394,6 +3400,8 @@
}
// Tests that the library is configured with the codecs we want.
+// TODO(ossu): This test should move into the builtin audio codecs module
+// eventually.
TEST(WebRtcVoiceEngineTest, HasCorrectCodecs) {
// TODO(ossu): These tests should move into a future "builtin audio codecs"
// module.
@@ -3449,13 +3457,10 @@
cricket::AudioCodec(0, "", 0, 5000, 1), nullptr));
// Verify the payload id of common audio codecs, including CN, ISAC, and G722.
- // TODO(ossu): Why are the payload types of codecs with non-static payload
- // type assignments checked here? It shouldn't really matter.
- cricket::WebRtcVoiceEngine engine(
- nullptr, webrtc::MockAudioDecoderFactory::CreateUnusedFactory());
+ cricket::WebRtcVoiceEngine engine(nullptr,
+ webrtc::CreateBuiltinAudioDecoderFactory());
for (std::vector<cricket::AudioCodec>::const_iterator it =
- engine.send_codecs().begin();
- it != engine.send_codecs().end(); ++it) {
+ engine.send_codecs().begin(); it != engine.send_codecs().end(); ++it) {
if (it->name == "CN" && it->clockrate == 16000) {
EXPECT_EQ(105, it->id);
} else if (it->name == "CN" && it->clockrate == 32000) {
@@ -3480,8 +3485,7 @@
// Tests that VoE supports at least 32 channels
TEST(WebRtcVoiceEngineTest, Has32Channels) {
- cricket::WebRtcVoiceEngine engine(
- nullptr, webrtc::MockAudioDecoderFactory::CreateUnusedFactory());
+ cricket::WebRtcVoiceEngine engine(nullptr, nullptr);
std::unique_ptr<webrtc::Call> call(
webrtc::Call::Create(webrtc::Call::Config()));
« no previous file with comments | « webrtc/media/engine/webrtcvoiceengine.cc ('k') | webrtc/media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698