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

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

Issue 1646253004: Split out dscp option from VideoOptions to new struct MediaChannelOptions. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rename DscpValue --> MediaTypeDscpValue. 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
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2008 Google Inc. 3 * Copyright 2008 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 : call_(webrtc::Call::Config()), 83 : call_(webrtc::Call::Config()),
84 engine_(new FakeVoEWrapper(&voe_)), 84 engine_(new FakeVoEWrapper(&voe_)),
85 channel_(nullptr) { 85 channel_(nullptr) {
86 send_parameters_.codecs.push_back(kPcmuCodec); 86 send_parameters_.codecs.push_back(kPcmuCodec);
87 recv_parameters_.codecs.push_back(kPcmuCodec); 87 recv_parameters_.codecs.push_back(kPcmuCodec);
88 } 88 }
89 bool SetupEngine() { 89 bool SetupEngine() {
90 if (!engine_.Init(rtc::Thread::Current())) { 90 if (!engine_.Init(rtc::Thread::Current())) {
91 return false; 91 return false;
92 } 92 }
93 channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions()); 93 channel_ = engine_.CreateChannel(&call_, cricket::MediaChannelOptions(),
94 cricket::AudioOptions());
94 return (channel_ != nullptr); 95 return (channel_ != nullptr);
95 } 96 }
96 bool SetupEngineWithRecvStream() { 97 bool SetupEngineWithRecvStream() {
97 if (!SetupEngine()) { 98 if (!SetupEngine()) {
98 return false; 99 return false;
99 } 100 }
100 return channel_->AddRecvStream( 101 return channel_->AddRecvStream(
101 cricket::StreamParams::CreateLegacy(kSsrc1)); 102 cricket::StreamParams::CreateLegacy(kSsrc1));
102 } 103 }
103 bool SetupEngineWithSendStream() { 104 bool SetupEngineWithSendStream() {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 144 }
144 145
145 const webrtc::AudioReceiveStream::Config& GetRecvStreamConfig(uint32_t ssrc) { 146 const webrtc::AudioReceiveStream::Config& GetRecvStreamConfig(uint32_t ssrc) {
146 const auto* recv_stream = call_.GetAudioReceiveStream(ssrc); 147 const auto* recv_stream = call_.GetAudioReceiveStream(ssrc);
147 EXPECT_TRUE(recv_stream); 148 EXPECT_TRUE(recv_stream);
148 return recv_stream->GetConfig(); 149 return recv_stream->GetConfig();
149 } 150 }
150 151
151 void TestInsertDtmf(uint32_t ssrc, bool caller) { 152 void TestInsertDtmf(uint32_t ssrc, bool caller) {
152 EXPECT_TRUE(engine_.Init(rtc::Thread::Current())); 153 EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
153 channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions()); 154 channel_ = engine_.CreateChannel(&call_, cricket::MediaChannelOptions(),
155 cricket::AudioOptions());
154 EXPECT_TRUE(channel_ != nullptr); 156 EXPECT_TRUE(channel_ != nullptr);
155 if (caller) { 157 if (caller) {
156 // If this is a caller, local description will be applied and add the 158 // If this is a caller, local description will be applied and add the
157 // send stream. 159 // send stream.
158 EXPECT_TRUE(channel_->AddSendStream( 160 EXPECT_TRUE(channel_->AddSendStream(
159 cricket::StreamParams::CreateLegacy(kSsrc1))); 161 cricket::StreamParams::CreateLegacy(kSsrc1)));
160 } 162 }
161 163
162 // Test we can only InsertDtmf when the other side supports telephone-event. 164 // Test we can only InsertDtmf when the other side supports telephone-event.
163 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); 165 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 EXPECT_FALSE(voe_.IsInited()); 419 EXPECT_FALSE(voe_.IsInited());
418 EXPECT_TRUE(engine_.Init(rtc::Thread::Current())); 420 EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
419 EXPECT_TRUE(voe_.IsInited()); 421 EXPECT_TRUE(voe_.IsInited());
420 engine_.Terminate(); 422 engine_.Terminate();
421 EXPECT_FALSE(voe_.IsInited()); 423 EXPECT_FALSE(voe_.IsInited());
422 } 424 }
423 425
424 // Tests that we can create and destroy a channel. 426 // Tests that we can create and destroy a channel.
425 TEST_F(WebRtcVoiceEngineTestFake, CreateChannel) { 427 TEST_F(WebRtcVoiceEngineTestFake, CreateChannel) {
426 EXPECT_TRUE(engine_.Init(rtc::Thread::Current())); 428 EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
427 channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions()); 429 channel_ = engine_.CreateChannel(&call_, cricket::MediaChannelOptions(),
430 cricket::AudioOptions());
428 EXPECT_TRUE(channel_ != nullptr); 431 EXPECT_TRUE(channel_ != nullptr);
429 } 432 }
430 433
431 // Tests that the list of supported codecs is created properly and ordered 434 // Tests that the list of supported codecs is created properly and ordered
432 // correctly 435 // correctly
433 TEST_F(WebRtcVoiceEngineTestFake, CodecPreference) { 436 TEST_F(WebRtcVoiceEngineTestFake, CodecPreference) {
434 const std::vector<cricket::AudioCodec>& codecs = engine_.codecs(); 437 const std::vector<cricket::AudioCodec>& codecs = engine_.codecs();
435 ASSERT_FALSE(codecs.empty()); 438 ASSERT_FALSE(codecs.empty());
436 EXPECT_STRCASEEQ("opus", codecs[0].name.c_str()); 439 EXPECT_STRCASEEQ("opus", codecs[0].name.c_str());
437 EXPECT_EQ(48000, codecs[0].clockrate); 440 EXPECT_EQ(48000, codecs[0].clockrate);
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1669 EXPECT_TRUE(voe_.GetVAD(channel_num)); 1672 EXPECT_TRUE(voe_.GetVAD(channel_num));
1670 EXPECT_FALSE(voe_.GetRED(channel_num)); 1673 EXPECT_FALSE(voe_.GetRED(channel_num));
1671 EXPECT_EQ(13, voe_.GetSendCNPayloadType(channel_num, false)); 1674 EXPECT_EQ(13, voe_.GetSendCNPayloadType(channel_num, false));
1672 EXPECT_EQ(97, voe_.GetSendCNPayloadType(channel_num, true)); 1675 EXPECT_EQ(97, voe_.GetSendCNPayloadType(channel_num, true));
1673 EXPECT_TRUE(channel_->CanInsertDtmf()); 1676 EXPECT_TRUE(channel_->CanInsertDtmf());
1674 } 1677 }
1675 1678
1676 // Test that we set VAD and DTMF types correctly as callee. 1679 // Test that we set VAD and DTMF types correctly as callee.
1677 TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsCNandDTMFAsCallee) { 1680 TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsCNandDTMFAsCallee) {
1678 EXPECT_TRUE(engine_.Init(rtc::Thread::Current())); 1681 EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
1679 channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions()); 1682 channel_ = engine_.CreateChannel(&call_, cricket::MediaChannelOptions(),
1683 cricket::AudioOptions());
1680 EXPECT_TRUE(channel_ != nullptr); 1684 EXPECT_TRUE(channel_ != nullptr);
1681 1685
1682 cricket::AudioSendParameters parameters; 1686 cricket::AudioSendParameters parameters;
1683 parameters.codecs.push_back(kIsacCodec); 1687 parameters.codecs.push_back(kIsacCodec);
1684 parameters.codecs.push_back(kPcmuCodec); 1688 parameters.codecs.push_back(kPcmuCodec);
1685 // TODO(juberti): cn 32000 1689 // TODO(juberti): cn 32000
1686 parameters.codecs.push_back(kCn16000Codec); 1690 parameters.codecs.push_back(kCn16000Codec);
1687 parameters.codecs.push_back(kCn8000Codec); 1691 parameters.codecs.push_back(kCn8000Codec);
1688 parameters.codecs.push_back(kTelephoneEventCodec); 1692 parameters.codecs.push_back(kTelephoneEventCodec);
1689 parameters.codecs.push_back(kRedCodec); 1693 parameters.codecs.push_back(kRedCodec);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1786 EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec)); 1790 EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec));
1787 EXPECT_EQ(96, gcodec.pltype); 1791 EXPECT_EQ(96, gcodec.pltype);
1788 EXPECT_STREQ("ISAC", gcodec.plname); 1792 EXPECT_STREQ("ISAC", gcodec.plname);
1789 EXPECT_TRUE(voe_.GetRED(channel_num)); 1793 EXPECT_TRUE(voe_.GetRED(channel_num));
1790 EXPECT_EQ(127, voe_.GetSendREDPayloadType(channel_num)); 1794 EXPECT_EQ(127, voe_.GetSendREDPayloadType(channel_num));
1791 } 1795 }
1792 1796
1793 // Test that we set up RED correctly as callee. 1797 // Test that we set up RED correctly as callee.
1794 TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsREDAsCallee) { 1798 TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsREDAsCallee) {
1795 EXPECT_TRUE(engine_.Init(rtc::Thread::Current())); 1799 EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
1796 channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions()); 1800 channel_ = engine_.CreateChannel(&call_, cricket::MediaChannelOptions(),
1801 cricket::AudioOptions());
1797 EXPECT_TRUE(channel_ != nullptr); 1802 EXPECT_TRUE(channel_ != nullptr);
1798 1803
1799 cricket::AudioSendParameters parameters; 1804 cricket::AudioSendParameters parameters;
1800 parameters.codecs.push_back(kRedCodec); 1805 parameters.codecs.push_back(kRedCodec);
1801 parameters.codecs.push_back(kIsacCodec); 1806 parameters.codecs.push_back(kIsacCodec);
1802 parameters.codecs.push_back(kPcmuCodec); 1807 parameters.codecs.push_back(kPcmuCodec);
1803 parameters.codecs[0].id = 127; 1808 parameters.codecs[0].id = 127;
1804 parameters.codecs[0].params[""] = "96/96"; 1809 parameters.codecs[0].params[""] = "96/96";
1805 parameters.codecs[1].id = 96; 1810 parameters.codecs[1].id = 96;
1806 EXPECT_TRUE(channel_->SetSendParameters(parameters)); 1811 EXPECT_TRUE(channel_->SetSendParameters(parameters));
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
2296 EXPECT_TRUE(call_.GetAudioSendStream(kSsrc1)); 2301 EXPECT_TRUE(call_.GetAudioSendStream(kSsrc1));
2297 EXPECT_TRUE(channel_->AddRecvStream( 2302 EXPECT_TRUE(channel_->AddRecvStream(
2298 cricket::StreamParams::CreateLegacy(kSsrc2))); 2303 cricket::StreamParams::CreateLegacy(kSsrc2)));
2299 EXPECT_EQ(kSsrc1, GetRecvStreamConfig(kSsrc2).rtp.local_ssrc); 2304 EXPECT_EQ(kSsrc1, GetRecvStreamConfig(kSsrc2).rtp.local_ssrc);
2300 } 2305 }
2301 2306
2302 // Test that the local SSRC is the same on sending and receiving channels if the 2307 // Test that the local SSRC is the same on sending and receiving channels if the
2303 // receive channel is created before the send channel. 2308 // receive channel is created before the send channel.
2304 TEST_F(WebRtcVoiceEngineTestFake, SetSendSsrcAfterCreatingReceiveChannel) { 2309 TEST_F(WebRtcVoiceEngineTestFake, SetSendSsrcAfterCreatingReceiveChannel) {
2305 EXPECT_TRUE(engine_.Init(rtc::Thread::Current())); 2310 EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
2306 channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions()); 2311 channel_ = engine_.CreateChannel(&call_, cricket::MediaChannelOptions(),
2312 cricket::AudioOptions());
2307 2313
2308 EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(1))); 2314 EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(1)));
2309 int receive_channel_num = voe_.GetLastChannel(); 2315 int receive_channel_num = voe_.GetLastChannel();
2310 EXPECT_TRUE(channel_->AddSendStream( 2316 EXPECT_TRUE(channel_->AddSendStream(
2311 cricket::StreamParams::CreateLegacy(1234))); 2317 cricket::StreamParams::CreateLegacy(1234)));
2312 2318
2313 EXPECT_TRUE(call_.GetAudioSendStream(1234)); 2319 EXPECT_TRUE(call_.GetAudioSendStream(1234));
2314 EXPECT_EQ(1234U, voe_.GetLocalSSRC(receive_channel_num)); 2320 EXPECT_EQ(1234U, voe_.GetLocalSSRC(receive_channel_num));
2315 } 2321 }
2316 2322
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
2724 EXPECT_EQ(0, voe_.GetAgcConfig(config)); 2730 EXPECT_EQ(0, voe_.GetAgcConfig(config));
2725 EXPECT_EQ(set_config.targetLeveldBOv, config.targetLeveldBOv); 2731 EXPECT_EQ(set_config.targetLeveldBOv, config.targetLeveldBOv);
2726 EXPECT_EQ(set_config.digitalCompressionGaindB, 2732 EXPECT_EQ(set_config.digitalCompressionGaindB,
2727 config.digitalCompressionGaindB); 2733 config.digitalCompressionGaindB);
2728 EXPECT_EQ(set_config.limiterEnable, config.limiterEnable); 2734 EXPECT_EQ(set_config.limiterEnable, config.limiterEnable);
2729 } 2735 }
2730 2736
2731 TEST_F(WebRtcVoiceEngineTestFake, SetOptionOverridesViaChannels) { 2737 TEST_F(WebRtcVoiceEngineTestFake, SetOptionOverridesViaChannels) {
2732 EXPECT_TRUE(SetupEngineWithSendStream()); 2738 EXPECT_TRUE(SetupEngineWithSendStream());
2733 rtc::scoped_ptr<cricket::WebRtcVoiceMediaChannel> channel1( 2739 rtc::scoped_ptr<cricket::WebRtcVoiceMediaChannel> channel1(
2734 static_cast<cricket::WebRtcVoiceMediaChannel*>( 2740 static_cast<cricket::WebRtcVoiceMediaChannel*>(engine_.CreateChannel(
2735 engine_.CreateChannel(&call_, cricket::AudioOptions()))); 2741 &call_, cricket::MediaChannelOptions(), cricket::AudioOptions())));
2736 rtc::scoped_ptr<cricket::WebRtcVoiceMediaChannel> channel2( 2742 rtc::scoped_ptr<cricket::WebRtcVoiceMediaChannel> channel2(
2737 static_cast<cricket::WebRtcVoiceMediaChannel*>( 2743 static_cast<cricket::WebRtcVoiceMediaChannel*>(engine_.CreateChannel(
2738 engine_.CreateChannel(&call_, cricket::AudioOptions()))); 2744 &call_, cricket::MediaChannelOptions(), cricket::AudioOptions())));
2739 2745
2740 // Have to add a stream to make SetSend work. 2746 // Have to add a stream to make SetSend work.
2741 cricket::StreamParams stream1; 2747 cricket::StreamParams stream1;
2742 stream1.ssrcs.push_back(1); 2748 stream1.ssrcs.push_back(1);
2743 channel1->AddSendStream(stream1); 2749 channel1->AddSendStream(stream1);
2744 cricket::StreamParams stream2; 2750 cricket::StreamParams stream2;
2745 stream2.ssrcs.push_back(2); 2751 stream2.ssrcs.push_back(2);
2746 channel2->AddSendStream(stream2); 2752 channel2->AddSendStream(stream2);
2747 2753
2748 // AEC and AGC and NS 2754 // AEC and AGC and NS
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
2822 EXPECT_EQ(expected_options, channel2->options()); 2828 EXPECT_EQ(expected_options, channel2->options());
2823 voe_.GetEcStatus(ec_enabled, ec_mode); 2829 voe_.GetEcStatus(ec_enabled, ec_mode);
2824 voe_.GetAgcStatus(agc_enabled, agc_mode); 2830 voe_.GetAgcStatus(agc_enabled, agc_mode);
2825 voe_.GetNsStatus(ns_enabled, ns_mode); 2831 voe_.GetNsStatus(ns_enabled, ns_mode);
2826 EXPECT_TRUE(ec_enabled); 2832 EXPECT_TRUE(ec_enabled);
2827 EXPECT_FALSE(agc_enabled); 2833 EXPECT_FALSE(agc_enabled);
2828 EXPECT_FALSE(ns_enabled); 2834 EXPECT_FALSE(ns_enabled);
2829 } 2835 }
2830 2836
2831 // This test verifies DSCP settings are properly applied on voice media channel. 2837 // This test verifies DSCP settings are properly applied on voice media channel.
2832 TEST_F(WebRtcVoiceEngineTestFake, TestSetDscpOptions) { 2838 TEST_F(WebRtcVoiceEngineTestFake, TestSetDscpOptions) {
pbos-webrtc 2016/02/01 14:44:38 Pref ConfiguresDscpInNetworkInterface or something
nisse-webrtc 2016/02/02 11:32:50 Makes sense. But I'm not doing that right away.
2833 EXPECT_TRUE(SetupEngineWithSendStream()); 2839 EXPECT_TRUE(SetupEngineWithSendStream());
2840 cricket::MediaChannelOptions channel_options;
2841 channel_options.enable_dscp = true;
2834 rtc::scoped_ptr<cricket::VoiceMediaChannel> channel( 2842 rtc::scoped_ptr<cricket::VoiceMediaChannel> channel(
2835 engine_.CreateChannel(&call_, cricket::AudioOptions())); 2843 engine_.CreateChannel(&call_, channel_options, cricket::AudioOptions()));
2836 rtc::scoped_ptr<cricket::FakeNetworkInterface> network_interface( 2844 rtc::scoped_ptr<cricket::FakeNetworkInterface> network_interface(
2837 new cricket::FakeNetworkInterface); 2845 new cricket::FakeNetworkInterface);
2838 channel->SetInterface(network_interface.get()); 2846 channel->SetInterface(network_interface.get());
2839 cricket::AudioSendParameters parameters = send_parameters_;
2840 parameters.options.dscp = rtc::Optional<bool>(true);
2841 EXPECT_TRUE(channel->SetSendParameters(parameters));
2842 EXPECT_EQ(rtc::DSCP_EF, network_interface->dscp()); 2847 EXPECT_EQ(rtc::DSCP_EF, network_interface->dscp());
2843 // Verify previous value is not modified if dscp option is not set.
2844 EXPECT_TRUE(channel->SetSendParameters(send_parameters_));
2845 EXPECT_EQ(rtc::DSCP_EF, network_interface->dscp());
2846 parameters.options.dscp = rtc::Optional<bool>(false);
2847 EXPECT_TRUE(channel->SetSendParameters(parameters));
2848 EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface->dscp());
2849 } 2848 }
2850 2849
2851 TEST_F(WebRtcVoiceEngineTestFake, TestGetReceiveChannelId) { 2850 TEST_F(WebRtcVoiceEngineTestFake, TestGetReceiveChannelId) {
2852 EXPECT_TRUE(SetupEngine()); 2851 EXPECT_TRUE(SetupEngine());
2853 cricket::WebRtcVoiceMediaChannel* media_channel = 2852 cricket::WebRtcVoiceMediaChannel* media_channel =
2854 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_); 2853 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_);
2855 EXPECT_EQ(-1, media_channel->GetReceiveChannelId(0)); 2854 EXPECT_EQ(-1, media_channel->GetReceiveChannelId(0));
2856 EXPECT_TRUE(channel_->AddRecvStream( 2855 EXPECT_TRUE(channel_->AddRecvStream(
2857 cricket::StreamParams::CreateLegacy(kSsrc1))); 2856 cricket::StreamParams::CreateLegacy(kSsrc1)));
2858 int channel_id = voe_.GetLastChannel(); 2857 int channel_id = voe_.GetLastChannel();
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
3161 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame)); 3160 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame));
3162 EXPECT_NE(nullptr, GetRecvStream(0x01).sink()); 3161 EXPECT_NE(nullptr, GetRecvStream(0x01).sink());
3163 } 3162 }
3164 3163
3165 // Tests that the library initializes and shuts down properly. 3164 // Tests that the library initializes and shuts down properly.
3166 TEST(WebRtcVoiceEngineTest, StartupShutdown) { 3165 TEST(WebRtcVoiceEngineTest, StartupShutdown) {
3167 cricket::WebRtcVoiceEngine engine; 3166 cricket::WebRtcVoiceEngine engine;
3168 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); 3167 EXPECT_TRUE(engine.Init(rtc::Thread::Current()));
3169 rtc::scoped_ptr<webrtc::Call> call( 3168 rtc::scoped_ptr<webrtc::Call> call(
3170 webrtc::Call::Create(webrtc::Call::Config())); 3169 webrtc::Call::Create(webrtc::Call::Config()));
3171 cricket::VoiceMediaChannel* channel = 3170 cricket::VoiceMediaChannel* channel = engine.CreateChannel(
3172 engine.CreateChannel(call.get(), cricket::AudioOptions()); 3171 call.get(), cricket::MediaChannelOptions(), cricket::AudioOptions());
3173 EXPECT_TRUE(channel != nullptr); 3172 EXPECT_TRUE(channel != nullptr);
3174 delete channel; 3173 delete channel;
3175 engine.Terminate(); 3174 engine.Terminate();
3176 3175
3177 // Reinit to catch regression where VoiceEngineObserver reference is lost 3176 // Reinit to catch regression where VoiceEngineObserver reference is lost
3178 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); 3177 EXPECT_TRUE(engine.Init(rtc::Thread::Current()));
3179 engine.Terminate(); 3178 engine.Terminate();
3180 } 3179 }
3181 3180
3182 // Tests that the library is configured with the codecs we want. 3181 // Tests that the library is configured with the codecs we want.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
3267 // Tests that VoE supports at least 32 channels 3266 // Tests that VoE supports at least 32 channels
3268 TEST(WebRtcVoiceEngineTest, Has32Channels) { 3267 TEST(WebRtcVoiceEngineTest, Has32Channels) {
3269 cricket::WebRtcVoiceEngine engine; 3268 cricket::WebRtcVoiceEngine engine;
3270 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); 3269 EXPECT_TRUE(engine.Init(rtc::Thread::Current()));
3271 rtc::scoped_ptr<webrtc::Call> call( 3270 rtc::scoped_ptr<webrtc::Call> call(
3272 webrtc::Call::Create(webrtc::Call::Config())); 3271 webrtc::Call::Create(webrtc::Call::Config()));
3273 3272
3274 cricket::VoiceMediaChannel* channels[32]; 3273 cricket::VoiceMediaChannel* channels[32];
3275 int num_channels = 0; 3274 int num_channels = 0;
3276 while (num_channels < arraysize(channels)) { 3275 while (num_channels < arraysize(channels)) {
3277 cricket::VoiceMediaChannel* channel = 3276 cricket::VoiceMediaChannel* channel = engine.CreateChannel(
3278 engine.CreateChannel(call.get(), cricket::AudioOptions()); 3277 call.get(), cricket::MediaChannelOptions(), cricket::AudioOptions());
3279 if (!channel) 3278 if (!channel)
3280 break; 3279 break;
3281 channels[num_channels++] = channel; 3280 channels[num_channels++] = channel;
3282 } 3281 }
3283 3282
3284 int expected = arraysize(channels); 3283 int expected = arraysize(channels);
3285 EXPECT_EQ(expected, num_channels); 3284 EXPECT_EQ(expected, num_channels);
3286 3285
3287 while (num_channels > 0) { 3286 while (num_channels > 0) {
3288 delete channels[--num_channels]; 3287 delete channels[--num_channels];
3289 } 3288 }
3290 engine.Terminate(); 3289 engine.Terminate();
3291 } 3290 }
3292 3291
3293 // Test that we set our preferred codecs properly. 3292 // Test that we set our preferred codecs properly.
3294 TEST(WebRtcVoiceEngineTest, SetRecvCodecs) { 3293 TEST(WebRtcVoiceEngineTest, SetRecvCodecs) {
3295 cricket::WebRtcVoiceEngine engine; 3294 cricket::WebRtcVoiceEngine engine;
3296 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); 3295 EXPECT_TRUE(engine.Init(rtc::Thread::Current()));
3297 rtc::scoped_ptr<webrtc::Call> call( 3296 rtc::scoped_ptr<webrtc::Call> call(
3298 webrtc::Call::Create(webrtc::Call::Config())); 3297 webrtc::Call::Create(webrtc::Call::Config()));
3299 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::AudioOptions(), 3298 cricket::WebRtcVoiceMediaChannel channel(&engine,
3300 call.get()); 3299 cricket::MediaChannelOptions(),
3300 cricket::AudioOptions(), call.get());
3301 cricket::AudioRecvParameters parameters; 3301 cricket::AudioRecvParameters parameters;
3302 parameters.codecs = engine.codecs(); 3302 parameters.codecs = engine.codecs();
3303 EXPECT_TRUE(channel.SetRecvParameters(parameters)); 3303 EXPECT_TRUE(channel.SetRecvParameters(parameters));
3304 } 3304 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698