OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
408 &source_constraints); | 408 &source_constraints); |
409 std::string label = stream_label + kVideoTrackLabelBase; | 409 std::string label = stream_label + kVideoTrackLabelBase; |
410 return peer_connection_factory_->CreateVideoTrack(label, source); | 410 return peer_connection_factory_->CreateVideoTrack(label, source); |
411 } | 411 } |
412 | 412 |
413 DataChannelInterface* data_channel() { return data_channel_; } | 413 DataChannelInterface* data_channel() { return data_channel_; } |
414 const MockDataChannelObserver* data_observer() const { | 414 const MockDataChannelObserver* data_observer() const { |
415 return data_observer_.get(); | 415 return data_observer_.get(); |
416 } | 416 } |
417 | 417 |
418 webrtc::PeerConnectionInterface* pc() { return peer_connection_.get(); } | 418 webrtc::PeerConnectionInterface* pc() const { return peer_connection_.get(); } |
419 | 419 |
420 void StopVideoCapturers() { | 420 void StopVideoCapturers() { |
421 for (std::vector<cricket::VideoCapturer*>::iterator it = | 421 for (std::vector<cricket::VideoCapturer*>::iterator it = |
422 video_capturers_.begin(); | 422 video_capturers_.begin(); |
423 it != video_capturers_.end(); ++it) { | 423 it != video_capturers_.end(); ++it) { |
424 (*it)->Stop(); | 424 (*it)->Stop(); |
425 } | 425 } |
426 } | 426 } |
427 | 427 |
428 bool AudioFramesReceivedCheck(int number_of_frames) const { | 428 bool AudioFramesReceivedCheck(int number_of_frames) const { |
429 // Only check frames if the incoming stream exists. | |
430 if (remote_streams()->count() == 0) { | |
perkj_webrtc
2016/03/08 23:07:50
can you please refactor LocalP2PTest instead? Ther
hta-webrtc
2016/03/09 04:09:53
I'd like not to, because I've got another CL in fl
hta-webrtc
2016/03/09 09:40:17
Only took an hour to restructure the counting. Loo
| |
431 return true; | |
432 } | |
429 return number_of_frames <= fake_audio_capture_module_->frames_received(); | 433 return number_of_frames <= fake_audio_capture_module_->frames_received(); |
430 } | 434 } |
431 | 435 |
432 int audio_frames_received() const { | 436 int audio_frames_received() const { |
433 return fake_audio_capture_module_->frames_received(); | 437 return fake_audio_capture_module_->frames_received(); |
434 } | 438 } |
435 | 439 |
436 bool VideoFramesReceivedCheck(int number_of_frames) { | 440 bool VideoFramesReceivedCheck(int number_of_frames) { |
441 // Only check frames if the incoming stream exists. | |
442 if (remote_streams()->count() == 0) { | |
443 return true; | |
444 } | |
437 if (video_decoder_factory_enabled_) { | 445 if (video_decoder_factory_enabled_) { |
438 const std::vector<FakeWebRtcVideoDecoder*>& decoders | 446 const std::vector<FakeWebRtcVideoDecoder*>& decoders |
439 = fake_video_decoder_factory_->decoders(); | 447 = fake_video_decoder_factory_->decoders(); |
440 if (decoders.empty()) { | 448 if (decoders.empty()) { |
441 return number_of_frames <= 0; | 449 return number_of_frames <= 0; |
442 } | 450 } |
443 | 451 |
444 for (FakeWebRtcVideoDecoder* decoder : decoders) { | 452 for (FakeWebRtcVideoDecoder* decoder : decoders) { |
445 if (number_of_frames > decoder->GetNumFramesReceived()) { | 453 if (number_of_frames > decoder->GetNumFramesReceived()) { |
446 return false; | 454 return false; |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
653 return fake_video_renderers_.empty() ? 1 : | 661 return fake_video_renderers_.empty() ? 1 : |
654 fake_video_renderers_.begin()->second->height(); | 662 fake_video_renderers_.begin()->second->height(); |
655 } | 663 } |
656 | 664 |
657 size_t number_of_remote_streams() { | 665 size_t number_of_remote_streams() { |
658 if (!pc()) | 666 if (!pc()) |
659 return 0; | 667 return 0; |
660 return pc()->remote_streams()->count(); | 668 return pc()->remote_streams()->count(); |
661 } | 669 } |
662 | 670 |
663 StreamCollectionInterface* remote_streams() { | 671 StreamCollectionInterface* remote_streams() const { |
664 if (!pc()) { | 672 if (!pc()) { |
665 ADD_FAILURE(); | 673 ADD_FAILURE(); |
666 return nullptr; | 674 return nullptr; |
667 } | 675 } |
668 return pc()->remote_streams(); | 676 return pc()->remote_streams(); |
669 } | 677 } |
670 | 678 |
671 StreamCollectionInterface* local_streams() { | 679 StreamCollectionInterface* local_streams() { |
672 if (!pc()) { | 680 if (!pc()) { |
673 ADD_FAILURE(); | 681 ADD_FAILURE(); |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1206 LocalP2PTest(); | 1214 LocalP2PTest(); |
1207 VerifyRenderedSize(1280, 720); | 1215 VerifyRenderedSize(1280, 720); |
1208 } | 1216 } |
1209 | 1217 |
1210 // This test sets up a call between two endpoints that are configured to use | 1218 // This test sets up a call between two endpoints that are configured to use |
1211 // DTLS key agreement. As a result, DTLS is negotiated and used for transport. | 1219 // DTLS key agreement. As a result, DTLS is negotiated and used for transport. |
1212 TEST_F(P2PTestConductor, LocalP2PTestDtls) { | 1220 TEST_F(P2PTestConductor, LocalP2PTestDtls) { |
1213 SetupAndVerifyDtlsCall(); | 1221 SetupAndVerifyDtlsCall(); |
1214 } | 1222 } |
1215 | 1223 |
1224 // This test sets up an one-way call, with media only from initiator to | |
1225 // responder. | |
1226 TEST_F(P2PTestConductor, OneWayMediaCall) { | |
1227 ASSERT_TRUE(CreateTestClients()); | |
1228 receiving_client()->set_auto_add_stream(false); | |
1229 LocalP2PTest(); | |
1230 } | |
1231 | |
1216 // This test sets up a audio call initially and then upgrades to audio/video, | 1232 // This test sets up a audio call initially and then upgrades to audio/video, |
1217 // using DTLS. | 1233 // using DTLS. |
1218 TEST_F(P2PTestConductor, LocalP2PTestDtlsRenegotiate) { | 1234 TEST_F(P2PTestConductor, LocalP2PTestDtlsRenegotiate) { |
1219 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1235 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
1220 FakeConstraints setup_constraints; | 1236 FakeConstraints setup_constraints; |
1221 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, | 1237 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, |
1222 true); | 1238 true); |
1223 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); | 1239 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); |
1224 receiving_client()->SetReceiveAudioVideo(true, false); | 1240 receiving_client()->SetReceiveAudioVideo(true, false); |
1225 LocalP2PTest(); | 1241 LocalP2PTest(); |
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2003 PeerConnectionInterface::IceServer server; | 2019 PeerConnectionInterface::IceServer server; |
2004 server.urls.push_back("turn:hostname"); | 2020 server.urls.push_back("turn:hostname"); |
2005 server.urls.push_back("turn:hostname2"); | 2021 server.urls.push_back("turn:hostname2"); |
2006 servers.push_back(server); | 2022 servers.push_back(server); |
2007 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_)); | 2023 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_)); |
2008 EXPECT_EQ(2U, turn_servers_.size()); | 2024 EXPECT_EQ(2U, turn_servers_.size()); |
2009 EXPECT_NE(turn_servers_[0].priority, turn_servers_[1].priority); | 2025 EXPECT_NE(turn_servers_[0].priority, turn_servers_[1].priority); |
2010 } | 2026 } |
2011 | 2027 |
2012 #endif // if !defined(THREAD_SANITIZER) | 2028 #endif // if !defined(THREAD_SANITIZER) |
OLD | NEW |