| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 using webrtc::MockCreateSessionDescriptionObserver; | 67 using webrtc::MockCreateSessionDescriptionObserver; |
| 68 using webrtc::MockDataChannelObserver; | 68 using webrtc::MockDataChannelObserver; |
| 69 using webrtc::MockSetSessionDescriptionObserver; | 69 using webrtc::MockSetSessionDescriptionObserver; |
| 70 using webrtc::MockStatsObserver; | 70 using webrtc::MockStatsObserver; |
| 71 using webrtc::ObserverInterface; | 71 using webrtc::ObserverInterface; |
| 72 using webrtc::PeerConnectionInterface; | 72 using webrtc::PeerConnectionInterface; |
| 73 using webrtc::PeerConnectionFactory; | 73 using webrtc::PeerConnectionFactory; |
| 74 using webrtc::SessionDescriptionInterface; | 74 using webrtc::SessionDescriptionInterface; |
| 75 using webrtc::StreamCollectionInterface; | 75 using webrtc::StreamCollectionInterface; |
| 76 | 76 |
| 77 namespace { |
| 78 |
| 77 static const int kMaxWaitMs = 10000; | 79 static const int kMaxWaitMs = 10000; |
| 78 // Disable for TSan v2, see | 80 // Disable for TSan v2, see |
| 79 // https://code.google.com/p/webrtc/issues/detail?id=1205 for details. | 81 // https://code.google.com/p/webrtc/issues/detail?id=1205 for details. |
| 80 // This declaration is also #ifdef'd as it causes uninitialized-variable | 82 // This declaration is also #ifdef'd as it causes uninitialized-variable |
| 81 // warnings. | 83 // warnings. |
| 82 #if !defined(THREAD_SANITIZER) | 84 #if !defined(THREAD_SANITIZER) |
| 83 static const int kMaxWaitForStatsMs = 3000; | 85 static const int kMaxWaitForStatsMs = 3000; |
| 84 #endif | 86 #endif |
| 85 static const int kMaxWaitForActivationMs = 5000; | 87 static const int kMaxWaitForActivationMs = 5000; |
| 86 static const int kMaxWaitForFramesMs = 10000; | 88 static const int kMaxWaitForFramesMs = 10000; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 105 std::string* sdp) { | 107 std::string* sdp) { |
| 106 const char kSdpLineEnd[] = "\r\n"; | 108 const char kSdpLineEnd[] = "\r\n"; |
| 107 size_t ssrc_pos = 0; | 109 size_t ssrc_pos = 0; |
| 108 while ((ssrc_pos = sdp->find(line_start, ssrc_pos)) != | 110 while ((ssrc_pos = sdp->find(line_start, ssrc_pos)) != |
| 109 std::string::npos) { | 111 std::string::npos) { |
| 110 size_t end_ssrc = sdp->find(kSdpLineEnd, ssrc_pos); | 112 size_t end_ssrc = sdp->find(kSdpLineEnd, ssrc_pos); |
| 111 sdp->erase(ssrc_pos, end_ssrc - ssrc_pos + strlen(kSdpLineEnd)); | 113 sdp->erase(ssrc_pos, end_ssrc - ssrc_pos + strlen(kSdpLineEnd)); |
| 112 } | 114 } |
| 113 } | 115 } |
| 114 | 116 |
| 117 bool StreamsHaveAudioTrack(StreamCollectionInterface* streams) { |
| 118 for (size_t idx = 0; idx < streams->count(); idx++) { |
| 119 auto stream = streams->at(idx); |
| 120 if (stream->GetAudioTracks().size() > 0) { |
| 121 return true; |
| 122 } |
| 123 } |
| 124 return false; |
| 125 } |
| 126 |
| 127 bool StreamsHaveVideoTrack(StreamCollectionInterface* streams) { |
| 128 for (size_t idx = 0; idx < streams->count(); idx++) { |
| 129 auto stream = streams->at(idx); |
| 130 if (stream->GetVideoTracks().size() > 0) { |
| 131 return true; |
| 132 } |
| 133 } |
| 134 return false; |
| 135 } |
| 136 |
| 115 class SignalingMessageReceiver { | 137 class SignalingMessageReceiver { |
| 116 public: | 138 public: |
| 117 virtual void ReceiveSdpMessage(const std::string& type, | 139 virtual void ReceiveSdpMessage(const std::string& type, |
| 118 std::string& msg) = 0; | 140 std::string& msg) = 0; |
| 119 virtual void ReceiveIceMessage(const std::string& sdp_mid, | 141 virtual void ReceiveIceMessage(const std::string& sdp_mid, |
| 120 int sdp_mline_index, | 142 int sdp_mline_index, |
| 121 const std::string& msg) = 0; | 143 const std::string& msg) = 0; |
| 122 | 144 |
| 123 protected: | 145 protected: |
| 124 SignalingMessageReceiver() {} | 146 SignalingMessageReceiver() {} |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 &source_constraints); | 430 &source_constraints); |
| 409 std::string label = stream_label + kVideoTrackLabelBase; | 431 std::string label = stream_label + kVideoTrackLabelBase; |
| 410 return peer_connection_factory_->CreateVideoTrack(label, source); | 432 return peer_connection_factory_->CreateVideoTrack(label, source); |
| 411 } | 433 } |
| 412 | 434 |
| 413 DataChannelInterface* data_channel() { return data_channel_; } | 435 DataChannelInterface* data_channel() { return data_channel_; } |
| 414 const MockDataChannelObserver* data_observer() const { | 436 const MockDataChannelObserver* data_observer() const { |
| 415 return data_observer_.get(); | 437 return data_observer_.get(); |
| 416 } | 438 } |
| 417 | 439 |
| 418 webrtc::PeerConnectionInterface* pc() { return peer_connection_.get(); } | 440 webrtc::PeerConnectionInterface* pc() const { return peer_connection_.get(); } |
| 419 | 441 |
| 420 void StopVideoCapturers() { | 442 void StopVideoCapturers() { |
| 421 for (std::vector<cricket::VideoCapturer*>::iterator it = | 443 for (std::vector<cricket::VideoCapturer*>::iterator it = |
| 422 video_capturers_.begin(); | 444 video_capturers_.begin(); |
| 423 it != video_capturers_.end(); ++it) { | 445 it != video_capturers_.end(); ++it) { |
| 424 (*it)->Stop(); | 446 (*it)->Stop(); |
| 425 } | 447 } |
| 426 } | 448 } |
| 427 | 449 |
| 428 bool AudioFramesReceivedCheck(int number_of_frames) const { | 450 bool AudioFramesReceivedCheck(int number_of_frames) const { |
| 429 return number_of_frames <= fake_audio_capture_module_->frames_received(); | 451 return number_of_frames <= fake_audio_capture_module_->frames_received(); |
| 430 } | 452 } |
| 431 | 453 |
| 432 int audio_frames_received() const { | 454 int audio_frames_received() const { |
| 433 return fake_audio_capture_module_->frames_received(); | 455 return fake_audio_capture_module_->frames_received(); |
| 434 } | 456 } |
| 435 | 457 |
| 436 bool VideoFramesReceivedCheck(int number_of_frames) { | 458 bool VideoFramesReceivedCheck(int number_of_frames) { |
| 437 if (video_decoder_factory_enabled_) { | 459 if (video_decoder_factory_enabled_) { |
| 438 const std::vector<FakeWebRtcVideoDecoder*>& decoders | 460 const std::vector<FakeWebRtcVideoDecoder*>& decoders |
| 439 = fake_video_decoder_factory_->decoders(); | 461 = fake_video_decoder_factory_->decoders(); |
| 440 if (decoders.empty()) { | 462 if (decoders.empty()) { |
| 441 return number_of_frames <= 0; | 463 return number_of_frames <= 0; |
| 442 } | 464 } |
| 443 | 465 // Note - this checks that EACH decoder has the requisite number |
| 466 // of frames. The video_frames_received() function sums them. |
| 444 for (FakeWebRtcVideoDecoder* decoder : decoders) { | 467 for (FakeWebRtcVideoDecoder* decoder : decoders) { |
| 445 if (number_of_frames > decoder->GetNumFramesReceived()) { | 468 if (number_of_frames > decoder->GetNumFramesReceived()) { |
| 446 return false; | 469 return false; |
| 447 } | 470 } |
| 448 } | 471 } |
| 449 return true; | 472 return true; |
| 450 } else { | 473 } else { |
| 451 if (fake_video_renderers_.empty()) { | 474 if (fake_video_renderers_.empty()) { |
| 452 return number_of_frames <= 0; | 475 return number_of_frames <= 0; |
| 453 } | 476 } |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 return fake_video_renderers_.empty() ? 1 : | 676 return fake_video_renderers_.empty() ? 1 : |
| 654 fake_video_renderers_.begin()->second->height(); | 677 fake_video_renderers_.begin()->second->height(); |
| 655 } | 678 } |
| 656 | 679 |
| 657 size_t number_of_remote_streams() { | 680 size_t number_of_remote_streams() { |
| 658 if (!pc()) | 681 if (!pc()) |
| 659 return 0; | 682 return 0; |
| 660 return pc()->remote_streams()->count(); | 683 return pc()->remote_streams()->count(); |
| 661 } | 684 } |
| 662 | 685 |
| 663 StreamCollectionInterface* remote_streams() { | 686 StreamCollectionInterface* remote_streams() const { |
| 664 if (!pc()) { | 687 if (!pc()) { |
| 665 ADD_FAILURE(); | 688 ADD_FAILURE(); |
| 666 return nullptr; | 689 return nullptr; |
| 667 } | 690 } |
| 668 return pc()->remote_streams(); | 691 return pc()->remote_streams(); |
| 669 } | 692 } |
| 670 | 693 |
| 671 StreamCollectionInterface* local_streams() { | 694 StreamCollectionInterface* local_streams() { |
| 672 if (!pc()) { | 695 if (!pc()) { |
| 673 ADD_FAILURE(); | 696 ADD_FAILURE(); |
| 674 return nullptr; | 697 return nullptr; |
| 675 } | 698 } |
| 676 return pc()->local_streams(); | 699 return pc()->local_streams(); |
| 677 } | 700 } |
| 678 | 701 |
| 702 bool HasLocalAudioTrack() { return StreamsHaveAudioTrack(local_streams()); } |
| 703 |
| 704 bool HasLocalVideoTrack() { return StreamsHaveVideoTrack(local_streams()); } |
| 705 |
| 679 webrtc::PeerConnectionInterface::SignalingState signaling_state() { | 706 webrtc::PeerConnectionInterface::SignalingState signaling_state() { |
| 680 return pc()->signaling_state(); | 707 return pc()->signaling_state(); |
| 681 } | 708 } |
| 682 | 709 |
| 683 webrtc::PeerConnectionInterface::IceConnectionState ice_connection_state() { | 710 webrtc::PeerConnectionInterface::IceConnectionState ice_connection_state() { |
| 684 return pc()->ice_connection_state(); | 711 return pc()->ice_connection_state(); |
| 685 } | 712 } |
| 686 | 713 |
| 687 webrtc::PeerConnectionInterface::IceGatheringState ice_gathering_state() { | 714 webrtc::PeerConnectionInterface::IceGatheringState ice_gathering_state() { |
| 688 return pc()->ice_gathering_state(); | 715 return pc()->ice_gathering_state(); |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 P2PTestConductor() | 939 P2PTestConductor() |
| 913 : pss_(new rtc::PhysicalSocketServer), | 940 : pss_(new rtc::PhysicalSocketServer), |
| 914 ss_(new rtc::VirtualSocketServer(pss_.get())), | 941 ss_(new rtc::VirtualSocketServer(pss_.get())), |
| 915 ss_scope_(ss_.get()) {} | 942 ss_scope_(ss_.get()) {} |
| 916 | 943 |
| 917 bool SessionActive() { | 944 bool SessionActive() { |
| 918 return initiating_client_->SessionActive() && | 945 return initiating_client_->SessionActive() && |
| 919 receiving_client_->SessionActive(); | 946 receiving_client_->SessionActive(); |
| 920 } | 947 } |
| 921 | 948 |
| 922 // Return true if the number of frames provided have been received or it is | 949 // Return true if the number of frames provided have been received |
| 923 // known that that will never occur (e.g. no frames will be sent or | 950 // on the video and audio tracks provided. |
| 924 // captured). | 951 bool FramesHaveArrived(int audio_frames_to_receive, |
| 925 bool FramesNotPending(int audio_frames_to_receive, | 952 int video_frames_to_receive) { |
| 926 int video_frames_to_receive) { | 953 bool all_good = true; |
| 927 return VideoFramesReceivedCheck(video_frames_to_receive) && | 954 if (initiating_client_->HasLocalAudioTrack() && |
| 928 AudioFramesReceivedCheck(audio_frames_to_receive); | 955 receiving_client_->can_receive_audio()) { |
| 956 all_good &= |
| 957 receiving_client_->AudioFramesReceivedCheck(audio_frames_to_receive); |
| 958 } |
| 959 if (initiating_client_->HasLocalVideoTrack() && |
| 960 receiving_client_->can_receive_video()) { |
| 961 all_good &= |
| 962 receiving_client_->VideoFramesReceivedCheck(video_frames_to_receive); |
| 963 } |
| 964 if (receiving_client_->HasLocalAudioTrack() && |
| 965 initiating_client_->can_receive_audio()) { |
| 966 all_good &= |
| 967 initiating_client_->AudioFramesReceivedCheck(audio_frames_to_receive); |
| 968 } |
| 969 if (receiving_client_->HasLocalVideoTrack() && |
| 970 initiating_client_->can_receive_video()) { |
| 971 all_good &= |
| 972 initiating_client_->VideoFramesReceivedCheck(video_frames_to_receive); |
| 973 } |
| 974 return all_good; |
| 929 } | 975 } |
| 930 bool AudioFramesReceivedCheck(int frames_received) { | 976 |
| 931 return initiating_client_->AudioFramesReceivedCheck(frames_received) && | |
| 932 receiving_client_->AudioFramesReceivedCheck(frames_received); | |
| 933 } | |
| 934 bool VideoFramesReceivedCheck(int frames_received) { | |
| 935 return initiating_client_->VideoFramesReceivedCheck(frames_received) && | |
| 936 receiving_client_->VideoFramesReceivedCheck(frames_received); | |
| 937 } | |
| 938 void VerifyDtmf() { | 977 void VerifyDtmf() { |
| 939 initiating_client_->VerifyDtmf(); | 978 initiating_client_->VerifyDtmf(); |
| 940 receiving_client_->VerifyDtmf(); | 979 receiving_client_->VerifyDtmf(); |
| 941 } | 980 } |
| 942 | 981 |
| 943 void TestUpdateOfferWithRejectedContent() { | 982 void TestUpdateOfferWithRejectedContent() { |
| 944 // Renegotiate, rejecting the video m-line. | 983 // Renegotiate, rejecting the video m-line. |
| 945 initiating_client_->Negotiate(true, false); | 984 initiating_client_->Negotiate(true, false); |
| 946 ASSERT_TRUE_WAIT(SessionActive(), kMaxWaitForActivationMs); | 985 ASSERT_TRUE_WAIT(SessionActive(), kMaxWaitForActivationMs); |
| 947 | 986 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 if (initiating_client_->NumberOfLocalMediaStreams() == 0) { | 1071 if (initiating_client_->NumberOfLocalMediaStreams() == 0) { |
| 1033 initiating_client_->AddMediaStream(true, true); | 1072 initiating_client_->AddMediaStream(true, true); |
| 1034 } | 1073 } |
| 1035 initiating_client_->Negotiate(); | 1074 initiating_client_->Negotiate(); |
| 1036 // Assert true is used here since next tests are guaranteed to fail and | 1075 // Assert true is used here since next tests are guaranteed to fail and |
| 1037 // would eat up 5 seconds. | 1076 // would eat up 5 seconds. |
| 1038 ASSERT_TRUE_WAIT(SessionActive(), kMaxWaitForActivationMs); | 1077 ASSERT_TRUE_WAIT(SessionActive(), kMaxWaitForActivationMs); |
| 1039 VerifySessionDescriptions(); | 1078 VerifySessionDescriptions(); |
| 1040 | 1079 |
| 1041 int audio_frame_count = kEndAudioFrameCount; | 1080 int audio_frame_count = kEndAudioFrameCount; |
| 1081 int video_frame_count = kEndVideoFrameCount; |
| 1042 // TODO(ronghuawu): Add test to cover the case of sendonly and recvonly. | 1082 // TODO(ronghuawu): Add test to cover the case of sendonly and recvonly. |
| 1043 if (!initiating_client_->can_receive_audio() || | 1083 |
| 1044 !receiving_client_->can_receive_audio()) { | 1084 if ((!initiating_client_->can_receive_audio() && |
| 1045 audio_frame_count = -1; | 1085 !initiating_client_->can_receive_video()) || |
| 1046 } | 1086 (!receiving_client_->can_receive_audio() && |
| 1047 int video_frame_count = kEndVideoFrameCount; | 1087 !receiving_client_->can_receive_video())) { |
| 1048 if (!initiating_client_->can_receive_video() || | 1088 // Neither audio nor video will flow, so connections won't be |
| 1049 !receiving_client_->can_receive_video()) { | 1089 // established. There's nothing more to check. |
| 1050 video_frame_count = -1; | 1090 // TODO(hta): Check connection if there's a data channel. |
| 1091 return; |
| 1051 } | 1092 } |
| 1052 | 1093 |
| 1053 if (audio_frame_count != -1 || video_frame_count != -1) { | 1094 // Audio or video is expected to flow, so both clients should reach the |
| 1054 // Audio or video is expected to flow, so both clients should reach the | 1095 // Connected state, and the offerer (ICE controller) should proceed to |
| 1055 // Connected state, and the offerer (ICE controller) should proceed to | 1096 // Completed. |
| 1056 // Completed. | 1097 // Note: These tests have been observed to fail under heavy load at |
| 1057 // Note: These tests have been observed to fail under heavy load at | 1098 // shorter timeouts, so they may be flaky. |
| 1058 // shorter timeouts, so they may be flaky. | 1099 EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionCompleted, |
| 1059 EXPECT_EQ_WAIT( | 1100 initiating_client_->ice_connection_state(), |
| 1060 webrtc::PeerConnectionInterface::kIceConnectionCompleted, | 1101 kMaxWaitForFramesMs); |
| 1061 initiating_client_->ice_connection_state(), | 1102 EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionConnected, |
| 1062 kMaxWaitForFramesMs); | 1103 receiving_client_->ice_connection_state(), |
| 1063 EXPECT_EQ_WAIT( | 1104 kMaxWaitForFramesMs); |
| 1064 webrtc::PeerConnectionInterface::kIceConnectionConnected, | |
| 1065 receiving_client_->ice_connection_state(), | |
| 1066 kMaxWaitForFramesMs); | |
| 1067 } | |
| 1068 | 1105 |
| 1069 if (initiating_client_->can_receive_audio() || | 1106 // The ICE gathering state should end up in kIceGatheringComplete, |
| 1070 initiating_client_->can_receive_video()) { | 1107 // but there's a bug that prevents this at the moment, and the state |
| 1071 // The initiating client can receive media, so it must produce candidates | 1108 // machine is being updated by the WEBRTC WG. |
| 1072 // that will serve as destinations for that media. | 1109 // TODO(hta): Update this check when spec revisions finish. |
| 1073 // TODO(bemasc): Understand why the state is not already Complete here, as | 1110 EXPECT_NE(webrtc::PeerConnectionInterface::kIceGatheringNew, |
| 1074 // seems to be the case for the receiving client. This may indicate a bug | 1111 initiating_client_->ice_gathering_state()); |
| 1075 // in the ICE gathering system. | 1112 EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceGatheringComplete, |
| 1076 EXPECT_NE(webrtc::PeerConnectionInterface::kIceGatheringNew, | 1113 receiving_client_->ice_gathering_state(), |
| 1077 initiating_client_->ice_gathering_state()); | 1114 kMaxWaitForFramesMs); |
| 1078 } | |
| 1079 if (receiving_client_->can_receive_audio() || | |
| 1080 receiving_client_->can_receive_video()) { | |
| 1081 EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceGatheringComplete, | |
| 1082 receiving_client_->ice_gathering_state(), | |
| 1083 kMaxWaitForFramesMs); | |
| 1084 } | |
| 1085 | 1115 |
| 1086 EXPECT_TRUE_WAIT(FramesNotPending(audio_frame_count, video_frame_count), | 1116 // Check that the expected number of frames have arrived. |
| 1117 EXPECT_TRUE_WAIT(FramesHaveArrived(audio_frame_count, video_frame_count), |
| 1087 kMaxWaitForFramesMs); | 1118 kMaxWaitForFramesMs); |
| 1088 } | 1119 } |
| 1089 | 1120 |
| 1090 void SetupAndVerifyDtlsCall() { | 1121 void SetupAndVerifyDtlsCall() { |
| 1091 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1122 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 1092 FakeConstraints setup_constraints; | 1123 FakeConstraints setup_constraints; |
| 1093 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, | 1124 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, |
| 1094 true); | 1125 true); |
| 1095 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); | 1126 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); |
| 1096 LocalP2PTest(); | 1127 LocalP2PTest(); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1206 LocalP2PTest(); | 1237 LocalP2PTest(); |
| 1207 VerifyRenderedSize(1280, 720); | 1238 VerifyRenderedSize(1280, 720); |
| 1208 } | 1239 } |
| 1209 | 1240 |
| 1210 // This test sets up a call between two endpoints that are configured to use | 1241 // 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. | 1242 // DTLS key agreement. As a result, DTLS is negotiated and used for transport. |
| 1212 TEST_F(P2PTestConductor, LocalP2PTestDtls) { | 1243 TEST_F(P2PTestConductor, LocalP2PTestDtls) { |
| 1213 SetupAndVerifyDtlsCall(); | 1244 SetupAndVerifyDtlsCall(); |
| 1214 } | 1245 } |
| 1215 | 1246 |
| 1247 // This test sets up an one-way call, with media only from initiator to |
| 1248 // responder. |
| 1249 TEST_F(P2PTestConductor, OneWayMediaCall) { |
| 1250 ASSERT_TRUE(CreateTestClients()); |
| 1251 receiving_client()->set_auto_add_stream(false); |
| 1252 LocalP2PTest(); |
| 1253 } |
| 1254 |
| 1216 // This test sets up a audio call initially and then upgrades to audio/video, | 1255 // This test sets up a audio call initially and then upgrades to audio/video, |
| 1217 // using DTLS. | 1256 // using DTLS. |
| 1218 TEST_F(P2PTestConductor, LocalP2PTestDtlsRenegotiate) { | 1257 TEST_F(P2PTestConductor, LocalP2PTestDtlsRenegotiate) { |
| 1219 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1258 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 1220 FakeConstraints setup_constraints; | 1259 FakeConstraints setup_constraints; |
| 1221 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, | 1260 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, |
| 1222 true); | 1261 true); |
| 1223 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); | 1262 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); |
| 1224 receiving_client()->SetReceiveAudioVideo(true, false); | 1263 receiving_client()->SetReceiveAudioVideo(true, false); |
| 1225 LocalP2PTest(); | 1264 LocalP2PTest(); |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1812 initializing_client()->ice_connection_state(), | 1851 initializing_client()->ice_connection_state(), |
| 1813 kMaxWaitForFramesMs); | 1852 kMaxWaitForFramesMs); |
| 1814 EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionConnected, | 1853 EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionConnected, |
| 1815 receiving_client()->ice_connection_state(), | 1854 receiving_client()->ice_connection_state(), |
| 1816 kMaxWaitForFramesMs); | 1855 kMaxWaitForFramesMs); |
| 1817 // Now set the tracks, and expect frames to immediately start flowing. | 1856 // Now set the tracks, and expect frames to immediately start flowing. |
| 1818 EXPECT_TRUE( | 1857 EXPECT_TRUE( |
| 1819 audio_sender->SetTrack(initializing_client()->CreateLocalAudioTrack(""))); | 1858 audio_sender->SetTrack(initializing_client()->CreateLocalAudioTrack(""))); |
| 1820 EXPECT_TRUE( | 1859 EXPECT_TRUE( |
| 1821 video_sender->SetTrack(initializing_client()->CreateLocalVideoTrack(""))); | 1860 video_sender->SetTrack(initializing_client()->CreateLocalVideoTrack(""))); |
| 1822 EXPECT_TRUE_WAIT(FramesNotPending(kEndAudioFrameCount, kEndVideoFrameCount), | 1861 EXPECT_TRUE_WAIT(FramesHaveArrived(kEndAudioFrameCount, kEndVideoFrameCount), |
| 1823 kMaxWaitForFramesMs); | 1862 kMaxWaitForFramesMs); |
| 1824 } | 1863 } |
| 1825 | 1864 |
| 1826 class IceServerParsingTest : public testing::Test { | 1865 class IceServerParsingTest : public testing::Test { |
| 1827 public: | 1866 public: |
| 1828 // Convenience for parsing a single URL. | 1867 // Convenience for parsing a single URL. |
| 1829 bool ParseUrl(const std::string& url) { | 1868 bool ParseUrl(const std::string& url) { |
| 1830 return ParseUrl(url, std::string(), std::string()); | 1869 return ParseUrl(url, std::string(), std::string()); |
| 1831 } | 1870 } |
| 1832 | 1871 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2006 PeerConnectionInterface::IceServer server; | 2045 PeerConnectionInterface::IceServer server; |
| 2007 server.urls.push_back("turn:hostname"); | 2046 server.urls.push_back("turn:hostname"); |
| 2008 server.urls.push_back("turn:hostname2"); | 2047 server.urls.push_back("turn:hostname2"); |
| 2009 servers.push_back(server); | 2048 servers.push_back(server); |
| 2010 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_)); | 2049 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_)); |
| 2011 EXPECT_EQ(2U, turn_servers_.size()); | 2050 EXPECT_EQ(2U, turn_servers_.size()); |
| 2012 EXPECT_NE(turn_servers_[0].priority, turn_servers_[1].priority); | 2051 EXPECT_NE(turn_servers_[0].priority, turn_servers_[1].priority); |
| 2013 } | 2052 } |
| 2014 | 2053 |
| 2015 #endif // if !defined(THREAD_SANITIZER) | 2054 #endif // if !defined(THREAD_SANITIZER) |
| 2055 |
| 2056 } // namespace |
| OLD | NEW |