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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 148 |
149 class PeerConnectionTestClient : public webrtc::PeerConnectionObserver, | 149 class PeerConnectionTestClient : public webrtc::PeerConnectionObserver, |
150 public SignalingMessageReceiver, | 150 public SignalingMessageReceiver, |
151 public ObserverInterface { | 151 public ObserverInterface { |
152 public: | 152 public: |
153 static PeerConnectionTestClient* CreateClientWithDtlsIdentityStore( | 153 static PeerConnectionTestClient* CreateClientWithDtlsIdentityStore( |
154 const std::string& id, | 154 const std::string& id, |
155 const MediaConstraintsInterface* constraints, | 155 const MediaConstraintsInterface* constraints, |
156 const PeerConnectionFactory::Options* options, | 156 const PeerConnectionFactory::Options* options, |
157 rtc::scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store, | 157 rtc::scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store, |
158 bool prefer_constraint_apis) { | 158 bool prefer_constraint_apis, |
| 159 rtc::Thread* worker_thread) { |
159 PeerConnectionTestClient* client(new PeerConnectionTestClient(id)); | 160 PeerConnectionTestClient* client(new PeerConnectionTestClient(id)); |
160 if (!client->Init(constraints, options, std::move(dtls_identity_store), | 161 if (!client->Init(constraints, options, std::move(dtls_identity_store), |
161 prefer_constraint_apis)) { | 162 prefer_constraint_apis, worker_thread)) { |
162 delete client; | 163 delete client; |
163 return nullptr; | 164 return nullptr; |
164 } | 165 } |
165 return client; | 166 return client; |
166 } | 167 } |
167 | 168 |
168 static PeerConnectionTestClient* CreateClient( | 169 static PeerConnectionTestClient* CreateClient( |
169 const std::string& id, | 170 const std::string& id, |
170 const MediaConstraintsInterface* constraints, | 171 const MediaConstraintsInterface* constraints, |
171 const PeerConnectionFactory::Options* options) { | 172 const PeerConnectionFactory::Options* options, |
| 173 rtc::Thread* worker_thread) { |
172 rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store( | 174 rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store( |
173 rtc::SSLStreamAdapter::HaveDtlsSrtp() ? new FakeDtlsIdentityStore() | 175 rtc::SSLStreamAdapter::HaveDtlsSrtp() ? new FakeDtlsIdentityStore() |
174 : nullptr); | 176 : nullptr); |
175 | 177 |
176 return CreateClientWithDtlsIdentityStore( | 178 return CreateClientWithDtlsIdentityStore(id, constraints, options, |
177 id, constraints, options, std::move(dtls_identity_store), true); | 179 std::move(dtls_identity_store), |
| 180 true, worker_thread); |
178 } | 181 } |
179 | 182 |
180 static PeerConnectionTestClient* CreateClientPreferNoConstraints( | 183 static PeerConnectionTestClient* CreateClientPreferNoConstraints( |
181 const std::string& id, | 184 const std::string& id, |
182 const PeerConnectionFactory::Options* options) { | 185 const PeerConnectionFactory::Options* options, |
| 186 rtc::Thread* worker_thread) { |
183 rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store( | 187 rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store( |
184 rtc::SSLStreamAdapter::HaveDtlsSrtp() ? new FakeDtlsIdentityStore() | 188 rtc::SSLStreamAdapter::HaveDtlsSrtp() ? new FakeDtlsIdentityStore() |
185 : nullptr); | 189 : nullptr); |
186 | 190 |
187 return CreateClientWithDtlsIdentityStore( | 191 return CreateClientWithDtlsIdentityStore(id, nullptr, options, |
188 id, nullptr, options, std::move(dtls_identity_store), false); | 192 std::move(dtls_identity_store), |
| 193 false, worker_thread); |
189 } | 194 } |
190 | 195 |
191 ~PeerConnectionTestClient() { | 196 ~PeerConnectionTestClient() { |
192 } | 197 } |
193 | 198 |
194 void Negotiate() { Negotiate(true, true); } | 199 void Negotiate() { Negotiate(true, true); } |
195 | 200 |
196 void Negotiate(bool audio, bool video) { | 201 void Negotiate(bool audio, bool video) { |
197 rtc::scoped_ptr<SessionDescriptionInterface> offer; | 202 rtc::scoped_ptr<SessionDescriptionInterface> offer; |
198 ASSERT_TRUE(DoCreateOffer(&offer)); | 203 ASSERT_TRUE(DoCreateOffer(&offer)); |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 bool completed_; | 798 bool completed_; |
794 std::vector<std::string> tones_; | 799 std::vector<std::string> tones_; |
795 }; | 800 }; |
796 | 801 |
797 explicit PeerConnectionTestClient(const std::string& id) : id_(id) {} | 802 explicit PeerConnectionTestClient(const std::string& id) : id_(id) {} |
798 | 803 |
799 bool Init( | 804 bool Init( |
800 const MediaConstraintsInterface* constraints, | 805 const MediaConstraintsInterface* constraints, |
801 const PeerConnectionFactory::Options* options, | 806 const PeerConnectionFactory::Options* options, |
802 rtc::scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store, | 807 rtc::scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store, |
803 bool prefer_constraint_apis) { | 808 bool prefer_constraint_apis, |
| 809 rtc::Thread* worker_thread) { |
804 EXPECT_TRUE(!peer_connection_); | 810 EXPECT_TRUE(!peer_connection_); |
805 EXPECT_TRUE(!peer_connection_factory_); | 811 EXPECT_TRUE(!peer_connection_factory_); |
806 if (!prefer_constraint_apis) { | 812 if (!prefer_constraint_apis) { |
807 EXPECT_TRUE(!constraints); | 813 EXPECT_TRUE(!constraints); |
808 } | 814 } |
809 prefer_constraint_apis_ = prefer_constraint_apis; | 815 prefer_constraint_apis_ = prefer_constraint_apis; |
810 | 816 |
811 rtc::scoped_ptr<cricket::PortAllocator> port_allocator( | 817 rtc::scoped_ptr<cricket::PortAllocator> port_allocator( |
812 new cricket::FakePortAllocator(rtc::Thread::Current(), nullptr)); | 818 new cricket::FakePortAllocator(worker_thread, nullptr)); |
813 fake_audio_capture_module_ = FakeAudioCaptureModule::Create(); | 819 fake_audio_capture_module_ = FakeAudioCaptureModule::Create(); |
814 | 820 |
815 if (fake_audio_capture_module_ == nullptr) { | 821 if (fake_audio_capture_module_ == nullptr) { |
816 return false; | 822 return false; |
817 } | 823 } |
818 fake_video_decoder_factory_ = new FakeWebRtcVideoDecoderFactory(); | 824 fake_video_decoder_factory_ = new FakeWebRtcVideoDecoderFactory(); |
819 fake_video_encoder_factory_ = new FakeWebRtcVideoEncoderFactory(); | 825 fake_video_encoder_factory_ = new FakeWebRtcVideoEncoderFactory(); |
820 peer_connection_factory_ = webrtc::CreatePeerConnectionFactory( | 826 peer_connection_factory_ = webrtc::CreatePeerConnectionFactory( |
821 rtc::Thread::Current(), rtc::Thread::Current(), | 827 worker_thread, rtc::Thread::Current(), fake_audio_capture_module_, |
822 fake_audio_capture_module_, fake_video_encoder_factory_, | 828 fake_video_encoder_factory_, fake_video_decoder_factory_); |
823 fake_video_decoder_factory_); | |
824 if (!peer_connection_factory_) { | 829 if (!peer_connection_factory_) { |
825 return false; | 830 return false; |
826 } | 831 } |
827 if (options) { | 832 if (options) { |
828 peer_connection_factory_->SetOptions(*options); | 833 peer_connection_factory_->SetOptions(*options); |
829 } | 834 } |
830 peer_connection_ = CreatePeerConnection( | 835 peer_connection_ = CreatePeerConnection( |
831 std::move(port_allocator), constraints, std::move(dtls_identity_store)); | 836 std::move(port_allocator), constraints, std::move(dtls_identity_store)); |
832 return peer_connection_.get() != nullptr; | 837 return peer_connection_.get() != nullptr; |
833 } | 838 } |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 | 1017 |
1013 rtc::scoped_refptr<DataChannelInterface> data_channel_; | 1018 rtc::scoped_refptr<DataChannelInterface> data_channel_; |
1014 rtc::scoped_ptr<MockDataChannelObserver> data_observer_; | 1019 rtc::scoped_ptr<MockDataChannelObserver> data_observer_; |
1015 }; | 1020 }; |
1016 | 1021 |
1017 class P2PTestConductor : public testing::Test { | 1022 class P2PTestConductor : public testing::Test { |
1018 public: | 1023 public: |
1019 P2PTestConductor() | 1024 P2PTestConductor() |
1020 : pss_(new rtc::PhysicalSocketServer), | 1025 : pss_(new rtc::PhysicalSocketServer), |
1021 ss_(new rtc::VirtualSocketServer(pss_.get())), | 1026 ss_(new rtc::VirtualSocketServer(pss_.get())), |
1022 ss_scope_(ss_.get()) {} | 1027 ss_scope_(ss_.get()) { |
| 1028 RTC_CHECK(worker_thread_.Start()); |
| 1029 } |
1023 | 1030 |
1024 bool SessionActive() { | 1031 bool SessionActive() { |
1025 return initiating_client_->SessionActive() && | 1032 return initiating_client_->SessionActive() && |
1026 receiving_client_->SessionActive(); | 1033 receiving_client_->SessionActive(); |
1027 } | 1034 } |
1028 | 1035 |
1029 // Return true if the number of frames provided have been received | 1036 // Return true if the number of frames provided have been received |
1030 // on the video and audio tracks provided. | 1037 // on the video and audio tracks provided. |
1031 bool FramesHaveArrived(int audio_frames_to_receive, | 1038 bool FramesHaveArrived(int audio_frames_to_receive, |
1032 int video_frames_to_receive) { | 1039 int video_frames_to_receive) { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 bool CreateTestClients() { return CreateTestClients(nullptr, nullptr); } | 1127 bool CreateTestClients() { return CreateTestClients(nullptr, nullptr); } |
1121 | 1128 |
1122 bool CreateTestClients(MediaConstraintsInterface* init_constraints, | 1129 bool CreateTestClients(MediaConstraintsInterface* init_constraints, |
1123 MediaConstraintsInterface* recv_constraints) { | 1130 MediaConstraintsInterface* recv_constraints) { |
1124 return CreateTestClients(init_constraints, nullptr, recv_constraints, | 1131 return CreateTestClients(init_constraints, nullptr, recv_constraints, |
1125 nullptr); | 1132 nullptr); |
1126 } | 1133 } |
1127 | 1134 |
1128 bool CreateTestClientsThatPreferNoConstraints() { | 1135 bool CreateTestClientsThatPreferNoConstraints() { |
1129 initiating_client_.reset( | 1136 initiating_client_.reset( |
1130 PeerConnectionTestClient::CreateClientPreferNoConstraints("Caller: ", | 1137 PeerConnectionTestClient::CreateClientPreferNoConstraints( |
1131 nullptr)); | 1138 "Caller: ", nullptr, &worker_thread_)); |
1132 receiving_client_.reset( | 1139 receiving_client_.reset( |
1133 PeerConnectionTestClient::CreateClientPreferNoConstraints("Callee: ", | 1140 PeerConnectionTestClient::CreateClientPreferNoConstraints( |
1134 nullptr)); | 1141 "Callee: ", nullptr, &worker_thread_)); |
1135 if (!initiating_client_ || !receiving_client_) { | 1142 if (!initiating_client_ || !receiving_client_) { |
1136 return false; | 1143 return false; |
1137 } | 1144 } |
1138 // Remember the choice for possible later resets of the clients. | 1145 // Remember the choice for possible later resets of the clients. |
1139 prefer_constraint_apis_ = false; | 1146 prefer_constraint_apis_ = false; |
1140 SetSignalingReceivers(); | 1147 SetSignalingReceivers(); |
1141 return true; | 1148 return true; |
1142 } | 1149 } |
1143 | 1150 |
1144 void SetSignalingReceivers() { | 1151 void SetSignalingReceivers() { |
1145 initiating_client_->set_signaling_message_receiver(receiving_client_.get()); | 1152 initiating_client_->set_signaling_message_receiver(receiving_client_.get()); |
1146 receiving_client_->set_signaling_message_receiver(initiating_client_.get()); | 1153 receiving_client_->set_signaling_message_receiver(initiating_client_.get()); |
1147 } | 1154 } |
1148 | 1155 |
1149 bool CreateTestClients(MediaConstraintsInterface* init_constraints, | 1156 bool CreateTestClients(MediaConstraintsInterface* init_constraints, |
1150 PeerConnectionFactory::Options* init_options, | 1157 PeerConnectionFactory::Options* init_options, |
1151 MediaConstraintsInterface* recv_constraints, | 1158 MediaConstraintsInterface* recv_constraints, |
1152 PeerConnectionFactory::Options* recv_options) { | 1159 PeerConnectionFactory::Options* recv_options) { |
1153 initiating_client_.reset(PeerConnectionTestClient::CreateClient( | 1160 initiating_client_.reset(PeerConnectionTestClient::CreateClient( |
1154 "Caller: ", init_constraints, init_options)); | 1161 "Caller: ", init_constraints, init_options, &worker_thread_)); |
1155 receiving_client_.reset(PeerConnectionTestClient::CreateClient( | 1162 receiving_client_.reset(PeerConnectionTestClient::CreateClient( |
1156 "Callee: ", recv_constraints, recv_options)); | 1163 "Callee: ", recv_constraints, recv_options, &worker_thread_)); |
1157 if (!initiating_client_ || !receiving_client_) { | 1164 if (!initiating_client_ || !receiving_client_) { |
1158 return false; | 1165 return false; |
1159 } | 1166 } |
1160 SetSignalingReceivers(); | 1167 SetSignalingReceivers(); |
1161 return true; | 1168 return true; |
1162 } | 1169 } |
1163 | 1170 |
1164 void SetVideoConstraints(const webrtc::FakeConstraints& init_constraints, | 1171 void SetVideoConstraints(const webrtc::FakeConstraints& init_constraints, |
1165 const webrtc::FakeConstraints& recv_constraints) { | 1172 const webrtc::FakeConstraints& recv_constraints) { |
1166 initiating_client_->SetVideoConstraints(init_constraints); | 1173 initiating_client_->SetVideoConstraints(init_constraints); |
1167 receiving_client_->SetVideoConstraints(recv_constraints); | 1174 receiving_client_->SetVideoConstraints(recv_constraints); |
1168 } | 1175 } |
1169 | 1176 |
1170 void SetCaptureRotation(webrtc::VideoRotation rotation) { | 1177 void SetCaptureRotation(webrtc::VideoRotation rotation) { |
1171 initiating_client_->SetCaptureRotation(rotation); | 1178 initiating_client_->SetCaptureRotation(rotation); |
1172 receiving_client_->SetCaptureRotation(rotation); | 1179 receiving_client_->SetCaptureRotation(rotation); |
1173 } | 1180 } |
1174 | 1181 |
1175 void EnableVideoDecoderFactory() { | 1182 void EnableVideoDecoderFactory() { |
1176 initiating_client_->EnableVideoDecoderFactory(); | 1183 initiating_client_->EnableVideoDecoderFactory(); |
1177 receiving_client_->EnableVideoDecoderFactory(); | 1184 receiving_client_->EnableVideoDecoderFactory(); |
1178 } | 1185 } |
1179 | 1186 |
1180 // This test sets up a call between two parties. Both parties send static | 1187 // This test sets up a call between two parties. Both parties send static |
1181 // frames to each other. Once the test is finished the number of sent frames | 1188 // frames to each other. Once the test is finished the number of sent frames |
1182 // is compared to the number of received frames. | 1189 // is compared to the number of received frames. |
1183 void LocalP2PTest() { | 1190 void LocalP2PTest() { LocalP2PTest(false); } |
| 1191 // TODO(perkj); Remove the flag bug5752 when |
| 1192 // https://bugs.chromium.org/p/webrtc/issues/detail?id=5752 is fixed. |
| 1193 void LocalP2PTest(bool bug5752) { |
1184 if (initiating_client_->NumberOfLocalMediaStreams() == 0) { | 1194 if (initiating_client_->NumberOfLocalMediaStreams() == 0) { |
1185 initiating_client_->AddMediaStream(true, true); | 1195 initiating_client_->AddMediaStream(true, true); |
1186 } | 1196 } |
1187 initiating_client_->Negotiate(); | 1197 initiating_client_->Negotiate(); |
1188 // Assert true is used here since next tests are guaranteed to fail and | 1198 // Assert true is used here since next tests are guaranteed to fail and |
1189 // would eat up 5 seconds. | 1199 // would eat up 5 seconds. |
1190 ASSERT_TRUE_WAIT(SessionActive(), kMaxWaitForActivationMs); | 1200 ASSERT_TRUE_WAIT(SessionActive(), kMaxWaitForActivationMs); |
1191 VerifySessionDescriptions(); | 1201 VerifySessionDescriptions(); |
1192 | 1202 |
1193 int audio_frame_count = kEndAudioFrameCount; | 1203 int audio_frame_count = kEndAudioFrameCount; |
1194 int video_frame_count = kEndVideoFrameCount; | 1204 int video_frame_count = kEndVideoFrameCount; |
1195 // TODO(ronghuawu): Add test to cover the case of sendonly and recvonly. | 1205 // TODO(ronghuawu): Add test to cover the case of sendonly and recvonly. |
1196 | 1206 |
1197 if ((!initiating_client_->can_receive_audio() && | 1207 if ((!initiating_client_->can_receive_audio() && |
1198 !initiating_client_->can_receive_video()) || | 1208 !initiating_client_->can_receive_video()) || |
1199 (!receiving_client_->can_receive_audio() && | 1209 (!receiving_client_->can_receive_audio() && |
1200 !receiving_client_->can_receive_video())) { | 1210 !receiving_client_->can_receive_video())) { |
1201 // Neither audio nor video will flow, so connections won't be | 1211 // Neither audio nor video will flow, so connections won't be |
1202 // established. There's nothing more to check. | 1212 // established. There's nothing more to check. |
1203 // TODO(hta): Check connection if there's a data channel. | 1213 // TODO(hta): Check connection if there's a data channel. |
1204 return; | 1214 return; |
1205 } | 1215 } |
1206 | 1216 |
1207 // Audio or video is expected to flow, so both clients should reach the | 1217 // Audio or video is expected to flow, so both clients should reach the |
1208 // Connected state, and the offerer (ICE controller) should proceed to | 1218 // Connected state, and the offerer (ICE controller) should proceed to |
1209 // Completed. | 1219 // Completed. |
1210 // Note: These tests have been observed to fail under heavy load at | 1220 // Note: These tests have been observed to fail under heavy load at |
1211 // shorter timeouts, so they may be flaky. | 1221 // shorter timeouts, so they may be flaky. |
1212 EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionCompleted, | 1222 if (bug5752) { |
1213 initiating_client_->ice_connection_state(), | 1223 EXPECT_TRUE_WAIT( |
1214 kMaxWaitForFramesMs); | 1224 initiating_client_->ice_connection_state() == |
| 1225 webrtc::PeerConnectionInterface::kIceConnectionCompleted || |
| 1226 initiating_client_->ice_connection_state() == |
| 1227 webrtc::PeerConnectionInterface::kIceConnectionConnected, |
| 1228 kMaxWaitForFramesMs); |
| 1229 } else { |
| 1230 EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionCompleted, |
| 1231 initiating_client_->ice_connection_state(), |
| 1232 kMaxWaitForFramesMs); |
| 1233 } |
1215 EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionConnected, | 1234 EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionConnected, |
1216 receiving_client_->ice_connection_state(), | 1235 receiving_client_->ice_connection_state(), |
1217 kMaxWaitForFramesMs); | 1236 kMaxWaitForFramesMs); |
1218 | 1237 |
1219 // The ICE gathering state should end up in kIceGatheringComplete, | 1238 // The ICE gathering state should end up in kIceGatheringComplete, |
1220 // but there's a bug that prevents this at the moment, and the state | 1239 // but there's a bug that prevents this at the moment, and the state |
1221 // machine is being updated by the WEBRTC WG. | 1240 // machine is being updated by the WEBRTC WG. |
1222 // TODO(hta): Update this check when spec revisions finish. | 1241 // TODO(hta): Update this check when spec revisions finish. |
1223 EXPECT_NE(webrtc::PeerConnectionInterface::kIceGatheringNew, | 1242 EXPECT_NE(webrtc::PeerConnectionInterface::kIceGatheringNew, |
1224 initiating_client_->ice_gathering_state()); | 1243 initiating_client_->ice_gathering_state()); |
(...skipping 22 matching lines...) Expand all Loading... |
1247 true); | 1266 true); |
1248 | 1267 |
1249 rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store( | 1268 rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store( |
1250 rtc::SSLStreamAdapter::HaveDtlsSrtp() ? new FakeDtlsIdentityStore() | 1269 rtc::SSLStreamAdapter::HaveDtlsSrtp() ? new FakeDtlsIdentityStore() |
1251 : nullptr); | 1270 : nullptr); |
1252 dtls_identity_store->use_alternate_key(); | 1271 dtls_identity_store->use_alternate_key(); |
1253 | 1272 |
1254 // Make sure the new client is using a different certificate. | 1273 // Make sure the new client is using a different certificate. |
1255 return PeerConnectionTestClient::CreateClientWithDtlsIdentityStore( | 1274 return PeerConnectionTestClient::CreateClientWithDtlsIdentityStore( |
1256 "New Peer: ", &setup_constraints, nullptr, | 1275 "New Peer: ", &setup_constraints, nullptr, |
1257 std::move(dtls_identity_store), prefer_constraint_apis_); | 1276 std::move(dtls_identity_store), prefer_constraint_apis_, |
| 1277 &worker_thread_); |
1258 } | 1278 } |
1259 | 1279 |
1260 void SendRtpData(webrtc::DataChannelInterface* dc, const std::string& data) { | 1280 void SendRtpData(webrtc::DataChannelInterface* dc, const std::string& data) { |
1261 // Messages may get lost on the unreliable DataChannel, so we send multiple | 1281 // Messages may get lost on the unreliable DataChannel, so we send multiple |
1262 // times to avoid test flakiness. | 1282 // times to avoid test flakiness. |
1263 static const size_t kSendAttempts = 5; | 1283 static const size_t kSendAttempts = 5; |
1264 | 1284 |
1265 for (size_t i = 0; i < kSendAttempts; ++i) { | 1285 for (size_t i = 0; i < kSendAttempts; ++i) { |
1266 dc->Send(DataBuffer(data)); | 1286 dc->Send(DataBuffer(data)); |
1267 } | 1287 } |
(...skipping 19 matching lines...) Expand all Loading... |
1287 // Set the |receiving_client_| to the |client| passed in and return the | 1307 // Set the |receiving_client_| to the |client| passed in and return the |
1288 // original |receiving_client_|. | 1308 // original |receiving_client_|. |
1289 PeerConnectionTestClient* set_receiving_client( | 1309 PeerConnectionTestClient* set_receiving_client( |
1290 PeerConnectionTestClient* client) { | 1310 PeerConnectionTestClient* client) { |
1291 PeerConnectionTestClient* old = receiving_client_.release(); | 1311 PeerConnectionTestClient* old = receiving_client_.release(); |
1292 receiving_client_.reset(client); | 1312 receiving_client_.reset(client); |
1293 return old; | 1313 return old; |
1294 } | 1314 } |
1295 | 1315 |
1296 private: | 1316 private: |
| 1317 // |worker_thread_| is used by both |initiating_client_| and |
| 1318 // |receiving_client_|. Must be destroyed last. |
| 1319 rtc::Thread worker_thread_; |
1297 rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_; | 1320 rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_; |
1298 rtc::scoped_ptr<rtc::VirtualSocketServer> ss_; | 1321 rtc::scoped_ptr<rtc::VirtualSocketServer> ss_; |
1299 rtc::SocketServerScope ss_scope_; | 1322 rtc::SocketServerScope ss_scope_; |
1300 rtc::scoped_ptr<PeerConnectionTestClient> initiating_client_; | 1323 rtc::scoped_ptr<PeerConnectionTestClient> initiating_client_; |
1301 rtc::scoped_ptr<PeerConnectionTestClient> receiving_client_; | 1324 rtc::scoped_ptr<PeerConnectionTestClient> receiving_client_; |
1302 bool prefer_constraint_apis_ = true; | 1325 bool prefer_constraint_apis_ = true; |
1303 }; | 1326 }; |
1304 | 1327 |
1305 // Disable for TSan v2, see | 1328 // Disable for TSan v2, see |
1306 // https://code.google.com/p/webrtc/issues/detail?id=1205 for details. | 1329 // https://code.google.com/p/webrtc/issues/detail?id=1205 for details. |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1431 SetupAndVerifyDtlsCall(); | 1454 SetupAndVerifyDtlsCall(); |
1432 | 1455 |
1433 // Keeping the original peer around which will still send packets to the | 1456 // Keeping the original peer around which will still send packets to the |
1434 // receiving client. These SRTP packets will be dropped. | 1457 // receiving client. These SRTP packets will be dropped. |
1435 rtc::scoped_ptr<PeerConnectionTestClient> original_peer( | 1458 rtc::scoped_ptr<PeerConnectionTestClient> original_peer( |
1436 set_receiving_client(CreateDtlsClientWithAlternateKey())); | 1459 set_receiving_client(CreateDtlsClientWithAlternateKey())); |
1437 original_peer->pc()->Close(); | 1460 original_peer->pc()->Close(); |
1438 | 1461 |
1439 SetSignalingReceivers(); | 1462 SetSignalingReceivers(); |
1440 initializing_client()->IceRestart(); | 1463 initializing_client()->IceRestart(); |
1441 LocalP2PTest(); | 1464 // TODO(perkj): Remove the flag bug5752 when |
| 1465 // https://bugs.chromium.org/p/webrtc/issues/detail?id=5752 is fixed. |
| 1466 LocalP2PTest(true /* bug5752 */); |
1442 VerifyRenderedSize(640, 480); | 1467 VerifyRenderedSize(640, 480); |
1443 } | 1468 } |
1444 | 1469 |
1445 TEST_F(P2PTestConductor, LocalP2PTestCVO) { | 1470 TEST_F(P2PTestConductor, LocalP2PTestCVO) { |
1446 ASSERT_TRUE(CreateTestClients()); | 1471 ASSERT_TRUE(CreateTestClients()); |
1447 SetCaptureRotation(webrtc::kVideoRotation_90); | 1472 SetCaptureRotation(webrtc::kVideoRotation_90); |
1448 LocalP2PTest(); | 1473 LocalP2PTest(); |
1449 VerifyRenderedSize(640, 480, webrtc::kVideoRotation_90); | 1474 VerifyRenderedSize(640, 480, webrtc::kVideoRotation_90); |
1450 } | 1475 } |
1451 | 1476 |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2155 server.urls.push_back("turn:hostname2"); | 2180 server.urls.push_back("turn:hostname2"); |
2156 servers.push_back(server); | 2181 servers.push_back(server); |
2157 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_)); | 2182 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_)); |
2158 EXPECT_EQ(2U, turn_servers_.size()); | 2183 EXPECT_EQ(2U, turn_servers_.size()); |
2159 EXPECT_NE(turn_servers_[0].priority, turn_servers_[1].priority); | 2184 EXPECT_NE(turn_servers_[0].priority, turn_servers_[1].priority); |
2160 } | 2185 } |
2161 | 2186 |
2162 #endif // if !defined(THREAD_SANITIZER) | 2187 #endif // if !defined(THREAD_SANITIZER) |
2163 | 2188 |
2164 } // namespace | 2189 } // namespace |
OLD | NEW |