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

Side by Side Diff: webrtc/media/engine/webrtcvoiceengine_unittest.cc

Issue 1670153003: Introduce struct MediaConfig, with construction-time settings. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed test nit; use reference. Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « webrtc/media/engine/webrtcvoiceengine.cc ('k') | webrtc/pc/channelmanager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2008 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2008 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 engine_(new FakeVoEWrapper(&voe_)), 70 engine_(new FakeVoEWrapper(&voe_)),
71 channel_(nullptr), 71 channel_(nullptr),
72 override_field_trials_(field_trials) { 72 override_field_trials_(field_trials) {
73 send_parameters_.codecs.push_back(kPcmuCodec); 73 send_parameters_.codecs.push_back(kPcmuCodec);
74 recv_parameters_.codecs.push_back(kPcmuCodec); 74 recv_parameters_.codecs.push_back(kPcmuCodec);
75 } 75 }
76 bool SetupEngine() { 76 bool SetupEngine() {
77 if (!engine_.Init(rtc::Thread::Current())) { 77 if (!engine_.Init(rtc::Thread::Current())) {
78 return false; 78 return false;
79 } 79 }
80 channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions()); 80 channel_ = engine_.CreateChannel(&call_, cricket::MediaConfig(),
81 cricket::AudioOptions());
81 return (channel_ != nullptr); 82 return (channel_ != nullptr);
82 } 83 }
83 bool SetupEngineWithRecvStream() { 84 bool SetupEngineWithRecvStream() {
84 if (!SetupEngine()) { 85 if (!SetupEngine()) {
85 return false; 86 return false;
86 } 87 }
87 return channel_->AddRecvStream( 88 return channel_->AddRecvStream(
88 cricket::StreamParams::CreateLegacy(kSsrc1)); 89 cricket::StreamParams::CreateLegacy(kSsrc1));
89 } 90 }
90 bool SetupEngineWithSendStream() { 91 bool SetupEngineWithSendStream() {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 131 }
131 132
132 const webrtc::AudioReceiveStream::Config& GetRecvStreamConfig(uint32_t ssrc) { 133 const webrtc::AudioReceiveStream::Config& GetRecvStreamConfig(uint32_t ssrc) {
133 const auto* recv_stream = call_.GetAudioReceiveStream(ssrc); 134 const auto* recv_stream = call_.GetAudioReceiveStream(ssrc);
134 EXPECT_TRUE(recv_stream); 135 EXPECT_TRUE(recv_stream);
135 return recv_stream->GetConfig(); 136 return recv_stream->GetConfig();
136 } 137 }
137 138
138 void TestInsertDtmf(uint32_t ssrc, bool caller) { 139 void TestInsertDtmf(uint32_t ssrc, bool caller) {
139 EXPECT_TRUE(engine_.Init(rtc::Thread::Current())); 140 EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
140 channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions()); 141 channel_ = engine_.CreateChannel(&call_, cricket::MediaConfig(),
142 cricket::AudioOptions());
141 EXPECT_TRUE(channel_ != nullptr); 143 EXPECT_TRUE(channel_ != nullptr);
142 if (caller) { 144 if (caller) {
143 // If this is a caller, local description will be applied and add the 145 // If this is a caller, local description will be applied and add the
144 // send stream. 146 // send stream.
145 EXPECT_TRUE(channel_->AddSendStream( 147 EXPECT_TRUE(channel_->AddSendStream(
146 cricket::StreamParams::CreateLegacy(kSsrc1))); 148 cricket::StreamParams::CreateLegacy(kSsrc1)));
147 } 149 }
148 150
149 // Test we can only InsertDtmf when the other side supports telephone-event. 151 // Test we can only InsertDtmf when the other side supports telephone-event.
150 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); 152 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 EXPECT_FALSE(voe_.IsInited()); 409 EXPECT_FALSE(voe_.IsInited());
408 EXPECT_TRUE(engine_.Init(rtc::Thread::Current())); 410 EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
409 EXPECT_TRUE(voe_.IsInited()); 411 EXPECT_TRUE(voe_.IsInited());
410 engine_.Terminate(); 412 engine_.Terminate();
411 EXPECT_FALSE(voe_.IsInited()); 413 EXPECT_FALSE(voe_.IsInited());
412 } 414 }
413 415
414 // Tests that we can create and destroy a channel. 416 // Tests that we can create and destroy a channel.
415 TEST_F(WebRtcVoiceEngineTestFake, CreateChannel) { 417 TEST_F(WebRtcVoiceEngineTestFake, CreateChannel) {
416 EXPECT_TRUE(engine_.Init(rtc::Thread::Current())); 418 EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
417 channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions()); 419 channel_ = engine_.CreateChannel(&call_, cricket::MediaConfig(),
420 cricket::AudioOptions());
418 EXPECT_TRUE(channel_ != nullptr); 421 EXPECT_TRUE(channel_ != nullptr);
419 } 422 }
420 423
421 // Tests that the list of supported codecs is created properly and ordered 424 // Tests that the list of supported codecs is created properly and ordered
422 // correctly 425 // correctly
423 TEST_F(WebRtcVoiceEngineTestFake, CodecPreference) { 426 TEST_F(WebRtcVoiceEngineTestFake, CodecPreference) {
424 const std::vector<cricket::AudioCodec>& codecs = engine_.codecs(); 427 const std::vector<cricket::AudioCodec>& codecs = engine_.codecs();
425 ASSERT_FALSE(codecs.empty()); 428 ASSERT_FALSE(codecs.empty());
426 EXPECT_STRCASEEQ("opus", codecs[0].name.c_str()); 429 EXPECT_STRCASEEQ("opus", codecs[0].name.c_str());
427 EXPECT_EQ(48000, codecs[0].clockrate); 430 EXPECT_EQ(48000, codecs[0].clockrate);
(...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1694 EXPECT_TRUE(voe_.GetVAD(channel_num)); 1697 EXPECT_TRUE(voe_.GetVAD(channel_num));
1695 EXPECT_FALSE(voe_.GetRED(channel_num)); 1698 EXPECT_FALSE(voe_.GetRED(channel_num));
1696 EXPECT_EQ(13, voe_.GetSendCNPayloadType(channel_num, false)); 1699 EXPECT_EQ(13, voe_.GetSendCNPayloadType(channel_num, false));
1697 EXPECT_EQ(97, voe_.GetSendCNPayloadType(channel_num, true)); 1700 EXPECT_EQ(97, voe_.GetSendCNPayloadType(channel_num, true));
1698 EXPECT_TRUE(channel_->CanInsertDtmf()); 1701 EXPECT_TRUE(channel_->CanInsertDtmf());
1699 } 1702 }
1700 1703
1701 // Test that we set VAD and DTMF types correctly as callee. 1704 // Test that we set VAD and DTMF types correctly as callee.
1702 TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsCNandDTMFAsCallee) { 1705 TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsCNandDTMFAsCallee) {
1703 EXPECT_TRUE(engine_.Init(rtc::Thread::Current())); 1706 EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
1704 channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions()); 1707 channel_ = engine_.CreateChannel(&call_, cricket::MediaConfig(),
1708 cricket::AudioOptions());
1705 EXPECT_TRUE(channel_ != nullptr); 1709 EXPECT_TRUE(channel_ != nullptr);
1706 1710
1707 cricket::AudioSendParameters parameters; 1711 cricket::AudioSendParameters parameters;
1708 parameters.codecs.push_back(kIsacCodec); 1712 parameters.codecs.push_back(kIsacCodec);
1709 parameters.codecs.push_back(kPcmuCodec); 1713 parameters.codecs.push_back(kPcmuCodec);
1710 // TODO(juberti): cn 32000 1714 // TODO(juberti): cn 32000
1711 parameters.codecs.push_back(kCn16000Codec); 1715 parameters.codecs.push_back(kCn16000Codec);
1712 parameters.codecs.push_back(kCn8000Codec); 1716 parameters.codecs.push_back(kCn8000Codec);
1713 parameters.codecs.push_back(kTelephoneEventCodec); 1717 parameters.codecs.push_back(kTelephoneEventCodec);
1714 parameters.codecs.push_back(kRedCodec); 1718 parameters.codecs.push_back(kRedCodec);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1811 EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec)); 1815 EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec));
1812 EXPECT_EQ(96, gcodec.pltype); 1816 EXPECT_EQ(96, gcodec.pltype);
1813 EXPECT_STREQ("ISAC", gcodec.plname); 1817 EXPECT_STREQ("ISAC", gcodec.plname);
1814 EXPECT_TRUE(voe_.GetRED(channel_num)); 1818 EXPECT_TRUE(voe_.GetRED(channel_num));
1815 EXPECT_EQ(127, voe_.GetSendREDPayloadType(channel_num)); 1819 EXPECT_EQ(127, voe_.GetSendREDPayloadType(channel_num));
1816 } 1820 }
1817 1821
1818 // Test that we set up RED correctly as callee. 1822 // Test that we set up RED correctly as callee.
1819 TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsREDAsCallee) { 1823 TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsREDAsCallee) {
1820 EXPECT_TRUE(engine_.Init(rtc::Thread::Current())); 1824 EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
1821 channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions()); 1825 channel_ = engine_.CreateChannel(&call_, cricket::MediaConfig(),
1826 cricket::AudioOptions());
1822 EXPECT_TRUE(channel_ != nullptr); 1827 EXPECT_TRUE(channel_ != nullptr);
1823 1828
1824 cricket::AudioSendParameters parameters; 1829 cricket::AudioSendParameters parameters;
1825 parameters.codecs.push_back(kRedCodec); 1830 parameters.codecs.push_back(kRedCodec);
1826 parameters.codecs.push_back(kIsacCodec); 1831 parameters.codecs.push_back(kIsacCodec);
1827 parameters.codecs.push_back(kPcmuCodec); 1832 parameters.codecs.push_back(kPcmuCodec);
1828 parameters.codecs[0].id = 127; 1833 parameters.codecs[0].id = 127;
1829 parameters.codecs[0].params[""] = "96/96"; 1834 parameters.codecs[0].params[""] = "96/96";
1830 parameters.codecs[1].id = 96; 1835 parameters.codecs[1].id = 96;
1831 EXPECT_TRUE(channel_->SetSendParameters(parameters)); 1836 EXPECT_TRUE(channel_->SetSendParameters(parameters));
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
2342 EXPECT_TRUE(call_.GetAudioSendStream(kSsrc1)); 2347 EXPECT_TRUE(call_.GetAudioSendStream(kSsrc1));
2343 EXPECT_TRUE(channel_->AddRecvStream( 2348 EXPECT_TRUE(channel_->AddRecvStream(
2344 cricket::StreamParams::CreateLegacy(kSsrc2))); 2349 cricket::StreamParams::CreateLegacy(kSsrc2)));
2345 EXPECT_EQ(kSsrc1, GetRecvStreamConfig(kSsrc2).rtp.local_ssrc); 2350 EXPECT_EQ(kSsrc1, GetRecvStreamConfig(kSsrc2).rtp.local_ssrc);
2346 } 2351 }
2347 2352
2348 // Test that the local SSRC is the same on sending and receiving channels if the 2353 // Test that the local SSRC is the same on sending and receiving channels if the
2349 // receive channel is created before the send channel. 2354 // receive channel is created before the send channel.
2350 TEST_F(WebRtcVoiceEngineTestFake, SetSendSsrcAfterCreatingReceiveChannel) { 2355 TEST_F(WebRtcVoiceEngineTestFake, SetSendSsrcAfterCreatingReceiveChannel) {
2351 EXPECT_TRUE(engine_.Init(rtc::Thread::Current())); 2356 EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
2352 channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions()); 2357 channel_ = engine_.CreateChannel(&call_, cricket::MediaConfig(),
2358 cricket::AudioOptions());
2353 2359
2354 EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(1))); 2360 EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(1)));
2355 int receive_channel_num = voe_.GetLastChannel(); 2361 int receive_channel_num = voe_.GetLastChannel();
2356 EXPECT_TRUE(channel_->AddSendStream( 2362 EXPECT_TRUE(channel_->AddSendStream(
2357 cricket::StreamParams::CreateLegacy(1234))); 2363 cricket::StreamParams::CreateLegacy(1234)));
2358 2364
2359 EXPECT_TRUE(call_.GetAudioSendStream(1234)); 2365 EXPECT_TRUE(call_.GetAudioSendStream(1234));
2360 EXPECT_EQ(1234U, voe_.GetLocalSSRC(receive_channel_num)); 2366 EXPECT_EQ(1234U, voe_.GetLocalSSRC(receive_channel_num));
2361 } 2367 }
2362 2368
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
2770 EXPECT_EQ(0, voe_.GetAgcConfig(config)); 2776 EXPECT_EQ(0, voe_.GetAgcConfig(config));
2771 EXPECT_EQ(set_config.targetLeveldBOv, config.targetLeveldBOv); 2777 EXPECT_EQ(set_config.targetLeveldBOv, config.targetLeveldBOv);
2772 EXPECT_EQ(set_config.digitalCompressionGaindB, 2778 EXPECT_EQ(set_config.digitalCompressionGaindB,
2773 config.digitalCompressionGaindB); 2779 config.digitalCompressionGaindB);
2774 EXPECT_EQ(set_config.limiterEnable, config.limiterEnable); 2780 EXPECT_EQ(set_config.limiterEnable, config.limiterEnable);
2775 } 2781 }
2776 2782
2777 TEST_F(WebRtcVoiceEngineTestFake, SetOptionOverridesViaChannels) { 2783 TEST_F(WebRtcVoiceEngineTestFake, SetOptionOverridesViaChannels) {
2778 EXPECT_TRUE(SetupEngineWithSendStream()); 2784 EXPECT_TRUE(SetupEngineWithSendStream());
2779 rtc::scoped_ptr<cricket::WebRtcVoiceMediaChannel> channel1( 2785 rtc::scoped_ptr<cricket::WebRtcVoiceMediaChannel> channel1(
2780 static_cast<cricket::WebRtcVoiceMediaChannel*>( 2786 static_cast<cricket::WebRtcVoiceMediaChannel*>(engine_.CreateChannel(
2781 engine_.CreateChannel(&call_, cricket::AudioOptions()))); 2787 &call_, cricket::MediaConfig(), cricket::AudioOptions())));
2782 rtc::scoped_ptr<cricket::WebRtcVoiceMediaChannel> channel2( 2788 rtc::scoped_ptr<cricket::WebRtcVoiceMediaChannel> channel2(
2783 static_cast<cricket::WebRtcVoiceMediaChannel*>( 2789 static_cast<cricket::WebRtcVoiceMediaChannel*>(engine_.CreateChannel(
2784 engine_.CreateChannel(&call_, cricket::AudioOptions()))); 2790 &call_, cricket::MediaConfig(), cricket::AudioOptions())));
2785 2791
2786 // Have to add a stream to make SetSend work. 2792 // Have to add a stream to make SetSend work.
2787 cricket::StreamParams stream1; 2793 cricket::StreamParams stream1;
2788 stream1.ssrcs.push_back(1); 2794 stream1.ssrcs.push_back(1);
2789 channel1->AddSendStream(stream1); 2795 channel1->AddSendStream(stream1);
2790 cricket::StreamParams stream2; 2796 cricket::StreamParams stream2;
2791 stream2.ssrcs.push_back(2); 2797 stream2.ssrcs.push_back(2);
2792 channel2->AddSendStream(stream2); 2798 channel2->AddSendStream(stream2);
2793 2799
2794 // AEC and AGC and NS 2800 // AEC and AGC and NS
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
2870 voe_.GetAgcStatus(agc_enabled, agc_mode); 2876 voe_.GetAgcStatus(agc_enabled, agc_mode);
2871 voe_.GetNsStatus(ns_enabled, ns_mode); 2877 voe_.GetNsStatus(ns_enabled, ns_mode);
2872 EXPECT_TRUE(ec_enabled); 2878 EXPECT_TRUE(ec_enabled);
2873 EXPECT_FALSE(agc_enabled); 2879 EXPECT_FALSE(agc_enabled);
2874 EXPECT_FALSE(ns_enabled); 2880 EXPECT_FALSE(ns_enabled);
2875 } 2881 }
2876 2882
2877 // This test verifies DSCP settings are properly applied on voice media channel. 2883 // This test verifies DSCP settings are properly applied on voice media channel.
2878 TEST_F(WebRtcVoiceEngineTestFake, TestSetDscpOptions) { 2884 TEST_F(WebRtcVoiceEngineTestFake, TestSetDscpOptions) {
2879 EXPECT_TRUE(SetupEngineWithSendStream()); 2885 EXPECT_TRUE(SetupEngineWithSendStream());
2880 rtc::scoped_ptr<cricket::VoiceMediaChannel> channel( 2886 cricket::FakeNetworkInterface network_interface;
2881 engine_.CreateChannel(&call_, cricket::AudioOptions())); 2887 cricket::MediaConfig config;
2882 rtc::scoped_ptr<cricket::FakeNetworkInterface> network_interface( 2888 rtc::scoped_ptr<cricket::VoiceMediaChannel> channel;
2883 new cricket::FakeNetworkInterface); 2889
2884 channel->SetInterface(network_interface.get()); 2890 channel.reset(engine_.CreateChannel(&call_, config, cricket::AudioOptions()));
2885 cricket::AudioSendParameters parameters = send_parameters_; 2891 channel->SetInterface(&network_interface);
2886 parameters.options.dscp = rtc::Optional<bool>(true); 2892 // Default value when DSCP is disabled should be DSCP_DEFAULT.
2887 EXPECT_TRUE(channel->SetSendParameters(parameters)); 2893 EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface.dscp());
2888 EXPECT_EQ(rtc::DSCP_EF, network_interface->dscp()); 2894
2889 // Verify previous value is not modified if dscp option is not set. 2895 config.enable_dscp = true;
2890 EXPECT_TRUE(channel->SetSendParameters(send_parameters_)); 2896 channel.reset(engine_.CreateChannel(&call_, config, cricket::AudioOptions()));
2891 EXPECT_EQ(rtc::DSCP_EF, network_interface->dscp()); 2897 channel->SetInterface(&network_interface);
2892 parameters.options.dscp = rtc::Optional<bool>(false); 2898 EXPECT_EQ(rtc::DSCP_EF, network_interface.dscp());
2893 EXPECT_TRUE(channel->SetSendParameters(parameters)); 2899
2894 EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface->dscp()); 2900 // Verify that setting the option to false resets the
2901 // DiffServCodePoint.
2902 config.enable_dscp = false;
2903 channel.reset(engine_.CreateChannel(&call_, config, cricket::AudioOptions()));
2904 channel->SetInterface(&network_interface);
2905 // Default value when DSCP is disabled should be DSCP_DEFAULT.
2906 EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface.dscp());
2907
2908 channel->SetInterface(nullptr);
2895 } 2909 }
2896 2910
2897 TEST_F(WebRtcVoiceEngineTestFake, TestGetReceiveChannelId) { 2911 TEST_F(WebRtcVoiceEngineTestFake, TestGetReceiveChannelId) {
2898 EXPECT_TRUE(SetupEngine()); 2912 EXPECT_TRUE(SetupEngine());
2899 cricket::WebRtcVoiceMediaChannel* media_channel = 2913 cricket::WebRtcVoiceMediaChannel* media_channel =
2900 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_); 2914 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_);
2901 EXPECT_EQ(-1, media_channel->GetReceiveChannelId(0)); 2915 EXPECT_EQ(-1, media_channel->GetReceiveChannelId(0));
2902 EXPECT_TRUE(channel_->AddRecvStream( 2916 EXPECT_TRUE(channel_->AddRecvStream(
2903 cricket::StreamParams::CreateLegacy(kSsrc1))); 2917 cricket::StreamParams::CreateLegacy(kSsrc1)));
2904 int channel_id = voe_.GetLastChannel(); 2918 int channel_id = voe_.GetLastChannel();
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
3142 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame)); 3156 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame));
3143 EXPECT_NE(nullptr, GetRecvStream(0x01).sink()); 3157 EXPECT_NE(nullptr, GetRecvStream(0x01).sink());
3144 } 3158 }
3145 3159
3146 // Tests that the library initializes and shuts down properly. 3160 // Tests that the library initializes and shuts down properly.
3147 TEST(WebRtcVoiceEngineTest, StartupShutdown) { 3161 TEST(WebRtcVoiceEngineTest, StartupShutdown) {
3148 cricket::WebRtcVoiceEngine engine; 3162 cricket::WebRtcVoiceEngine engine;
3149 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); 3163 EXPECT_TRUE(engine.Init(rtc::Thread::Current()));
3150 rtc::scoped_ptr<webrtc::Call> call( 3164 rtc::scoped_ptr<webrtc::Call> call(
3151 webrtc::Call::Create(webrtc::Call::Config())); 3165 webrtc::Call::Create(webrtc::Call::Config()));
3152 cricket::VoiceMediaChannel* channel = 3166 cricket::VoiceMediaChannel* channel = engine.CreateChannel(
3153 engine.CreateChannel(call.get(), cricket::AudioOptions()); 3167 call.get(), cricket::MediaConfig(), cricket::AudioOptions());
3154 EXPECT_TRUE(channel != nullptr); 3168 EXPECT_TRUE(channel != nullptr);
3155 delete channel; 3169 delete channel;
3156 engine.Terminate(); 3170 engine.Terminate();
3157 3171
3158 // Reinit to catch regression where VoiceEngineObserver reference is lost 3172 // Reinit to catch regression where VoiceEngineObserver reference is lost
3159 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); 3173 EXPECT_TRUE(engine.Init(rtc::Thread::Current()));
3160 engine.Terminate(); 3174 engine.Terminate();
3161 } 3175 }
3162 3176
3163 // Tests that the library is configured with the codecs we want. 3177 // Tests that the library is configured with the codecs we want.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
3248 // Tests that VoE supports at least 32 channels 3262 // Tests that VoE supports at least 32 channels
3249 TEST(WebRtcVoiceEngineTest, Has32Channels) { 3263 TEST(WebRtcVoiceEngineTest, Has32Channels) {
3250 cricket::WebRtcVoiceEngine engine; 3264 cricket::WebRtcVoiceEngine engine;
3251 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); 3265 EXPECT_TRUE(engine.Init(rtc::Thread::Current()));
3252 rtc::scoped_ptr<webrtc::Call> call( 3266 rtc::scoped_ptr<webrtc::Call> call(
3253 webrtc::Call::Create(webrtc::Call::Config())); 3267 webrtc::Call::Create(webrtc::Call::Config()));
3254 3268
3255 cricket::VoiceMediaChannel* channels[32]; 3269 cricket::VoiceMediaChannel* channels[32];
3256 int num_channels = 0; 3270 int num_channels = 0;
3257 while (num_channels < arraysize(channels)) { 3271 while (num_channels < arraysize(channels)) {
3258 cricket::VoiceMediaChannel* channel = 3272 cricket::VoiceMediaChannel* channel = engine.CreateChannel(
3259 engine.CreateChannel(call.get(), cricket::AudioOptions()); 3273 call.get(), cricket::MediaConfig(), cricket::AudioOptions());
3260 if (!channel) 3274 if (!channel)
3261 break; 3275 break;
3262 channels[num_channels++] = channel; 3276 channels[num_channels++] = channel;
3263 } 3277 }
3264 3278
3265 int expected = arraysize(channels); 3279 int expected = arraysize(channels);
3266 EXPECT_EQ(expected, num_channels); 3280 EXPECT_EQ(expected, num_channels);
3267 3281
3268 while (num_channels > 0) { 3282 while (num_channels > 0) {
3269 delete channels[--num_channels]; 3283 delete channels[--num_channels];
3270 } 3284 }
3271 engine.Terminate(); 3285 engine.Terminate();
3272 } 3286 }
3273 3287
3274 // Test that we set our preferred codecs properly. 3288 // Test that we set our preferred codecs properly.
3275 TEST(WebRtcVoiceEngineTest, SetRecvCodecs) { 3289 TEST(WebRtcVoiceEngineTest, SetRecvCodecs) {
3276 cricket::WebRtcVoiceEngine engine; 3290 cricket::WebRtcVoiceEngine engine;
3277 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); 3291 EXPECT_TRUE(engine.Init(rtc::Thread::Current()));
3278 rtc::scoped_ptr<webrtc::Call> call( 3292 rtc::scoped_ptr<webrtc::Call> call(
3279 webrtc::Call::Create(webrtc::Call::Config())); 3293 webrtc::Call::Create(webrtc::Call::Config()));
3280 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::AudioOptions(), 3294 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(),
3281 call.get()); 3295 cricket::AudioOptions(), call.get());
3282 cricket::AudioRecvParameters parameters; 3296 cricket::AudioRecvParameters parameters;
3283 parameters.codecs = engine.codecs(); 3297 parameters.codecs = engine.codecs();
3284 EXPECT_TRUE(channel.SetRecvParameters(parameters)); 3298 EXPECT_TRUE(channel.SetRecvParameters(parameters));
3285 } 3299 }
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvoiceengine.cc ('k') | webrtc/pc/channelmanager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698