| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1165 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); | 1165 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); |
| 1166 receiving_client()->SetReceiveAudioVideo(true, false); | 1166 receiving_client()->SetReceiveAudioVideo(true, false); |
| 1167 LocalP2PTest(); | 1167 LocalP2PTest(); |
| 1168 receiving_client()->SetReceiveAudioVideo(true, true); | 1168 receiving_client()->SetReceiveAudioVideo(true, true); |
| 1169 receiving_client()->Negotiate(); | 1169 receiving_client()->Negotiate(); |
| 1170 } | 1170 } |
| 1171 | 1171 |
| 1172 // This test sets up a call between two endpoints that are configured to use | 1172 // This test sets up a call between two endpoints that are configured to use |
| 1173 // DTLS key agreement. The offerer don't support SDES. As a result, DTLS is | 1173 // DTLS key agreement. The offerer don't support SDES. As a result, DTLS is |
| 1174 // negotiated and used for transport. | 1174 // negotiated and used for transport. |
| 1175 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, | 1175 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, LocalP2PTestOfferDtlsButNotSdes) { |
| 1176 MAYBE_LocalP2PTestOfferDtlsButNotSdes) { | |
| 1177 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1176 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 1178 FakeConstraints setup_constraints; | 1177 FakeConstraints setup_constraints; |
| 1179 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, | 1178 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, |
| 1180 true); | 1179 true); |
| 1181 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); | 1180 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); |
| 1182 receiving_client()->RemoveSdesCryptoFromReceivedSdp(true); | 1181 receiving_client()->RemoveSdesCryptoFromReceivedSdp(true); |
| 1183 LocalP2PTest(); | 1182 LocalP2PTest(); |
| 1184 VerifyRenderedSize(640, 480); | 1183 VerifyRenderedSize(640, 480); |
| 1185 } | 1184 } |
| 1186 | 1185 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1246 constraint.SetOptionalMaxWidth(320); | 1245 constraint.SetOptionalMaxWidth(320); |
| 1247 SetVideoConstraints(constraint, constraint); | 1246 SetVideoConstraints(constraint, constraint); |
| 1248 initializing_client()->AddMediaStream(true, true); | 1247 initializing_client()->AddMediaStream(true, true); |
| 1249 initializing_client()->AddMediaStream(false, true); | 1248 initializing_client()->AddMediaStream(false, true); |
| 1250 ASSERT_EQ(2u, initializing_client()->NumberOfLocalMediaStreams()); | 1249 ASSERT_EQ(2u, initializing_client()->NumberOfLocalMediaStreams()); |
| 1251 LocalP2PTest(); | 1250 LocalP2PTest(); |
| 1252 EXPECT_EQ(2u, receiving_client()->number_of_remote_streams()); | 1251 EXPECT_EQ(2u, receiving_client()->number_of_remote_streams()); |
| 1253 } | 1252 } |
| 1254 | 1253 |
| 1255 // Test that we can receive the audio output level from a remote audio track. | 1254 // Test that we can receive the audio output level from a remote audio track. |
| 1256 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, MAYBE_GetAudioOutputLevelStats) { | 1255 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, GetAudioOutputLevelStats) { |
| 1257 ASSERT_TRUE(CreateTestClients()); | 1256 ASSERT_TRUE(CreateTestClients()); |
| 1258 LocalP2PTest(); | 1257 LocalP2PTest(); |
| 1259 | 1258 |
| 1260 StreamCollectionInterface* remote_streams = | 1259 StreamCollectionInterface* remote_streams = |
| 1261 initializing_client()->remote_streams(); | 1260 initializing_client()->remote_streams(); |
| 1262 ASSERT_GT(remote_streams->count(), 0u); | 1261 ASSERT_GT(remote_streams->count(), 0u); |
| 1263 ASSERT_GT(remote_streams->at(0)->GetAudioTracks().size(), 0u); | 1262 ASSERT_GT(remote_streams->at(0)->GetAudioTracks().size(), 0u); |
| 1264 MediaStreamTrackInterface* remote_audio_track = | 1263 MediaStreamTrackInterface* remote_audio_track = |
| 1265 remote_streams->at(0)->GetAudioTracks()[0]; | 1264 remote_streams->at(0)->GetAudioTracks()[0]; |
| 1266 | 1265 |
| 1267 // Get the audio output level stats. Note that the level is not available | 1266 // Get the audio output level stats. Note that the level is not available |
| 1268 // until a RTCP packet has been received. | 1267 // until a RTCP packet has been received. |
| 1269 EXPECT_TRUE_WAIT( | 1268 EXPECT_TRUE_WAIT( |
| 1270 initializing_client()->GetAudioOutputLevelStats(remote_audio_track) > 0, | 1269 initializing_client()->GetAudioOutputLevelStats(remote_audio_track) > 0, |
| 1271 kMaxWaitForStatsMs); | 1270 kMaxWaitForStatsMs); |
| 1272 } | 1271 } |
| 1273 | 1272 |
| 1274 // Test that an audio input level is reported. | 1273 // Test that an audio input level is reported. |
| 1275 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, MAYBE_GetAudioInputLevelStats) { | 1274 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, GetAudioInputLevelStats) { |
| 1276 ASSERT_TRUE(CreateTestClients()); | 1275 ASSERT_TRUE(CreateTestClients()); |
| 1277 LocalP2PTest(); | 1276 LocalP2PTest(); |
| 1278 | 1277 |
| 1279 // Get the audio input level stats. The level should be available very | 1278 // Get the audio input level stats. The level should be available very |
| 1280 // soon after the test starts. | 1279 // soon after the test starts. |
| 1281 EXPECT_TRUE_WAIT(initializing_client()->GetAudioInputLevelStats() > 0, | 1280 EXPECT_TRUE_WAIT(initializing_client()->GetAudioInputLevelStats() > 0, |
| 1282 kMaxWaitForStatsMs); | 1281 kMaxWaitForStatsMs); |
| 1283 } | 1282 } |
| 1284 | 1283 |
| 1285 // Test that we can get incoming byte counts from both audio and video tracks. | 1284 // Test that we can get incoming byte counts from both audio and video tracks. |
| 1286 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, MAYBE_GetBytesReceivedStats) { | 1285 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, GetBytesReceivedStats) { |
| 1287 ASSERT_TRUE(CreateTestClients()); | 1286 ASSERT_TRUE(CreateTestClients()); |
| 1288 LocalP2PTest(); | 1287 LocalP2PTest(); |
| 1289 | 1288 |
| 1290 StreamCollectionInterface* remote_streams = | 1289 StreamCollectionInterface* remote_streams = |
| 1291 initializing_client()->remote_streams(); | 1290 initializing_client()->remote_streams(); |
| 1292 ASSERT_GT(remote_streams->count(), 0u); | 1291 ASSERT_GT(remote_streams->count(), 0u); |
| 1293 ASSERT_GT(remote_streams->at(0)->GetAudioTracks().size(), 0u); | 1292 ASSERT_GT(remote_streams->at(0)->GetAudioTracks().size(), 0u); |
| 1294 MediaStreamTrackInterface* remote_audio_track = | 1293 MediaStreamTrackInterface* remote_audio_track = |
| 1295 remote_streams->at(0)->GetAudioTracks()[0]; | 1294 remote_streams->at(0)->GetAudioTracks()[0]; |
| 1296 EXPECT_TRUE_WAIT( | 1295 EXPECT_TRUE_WAIT( |
| 1297 initializing_client()->GetBytesReceivedStats(remote_audio_track) > 0, | 1296 initializing_client()->GetBytesReceivedStats(remote_audio_track) > 0, |
| 1298 kMaxWaitForStatsMs); | 1297 kMaxWaitForStatsMs); |
| 1299 | 1298 |
| 1300 MediaStreamTrackInterface* remote_video_track = | 1299 MediaStreamTrackInterface* remote_video_track = |
| 1301 remote_streams->at(0)->GetVideoTracks()[0]; | 1300 remote_streams->at(0)->GetVideoTracks()[0]; |
| 1302 EXPECT_TRUE_WAIT( | 1301 EXPECT_TRUE_WAIT( |
| 1303 initializing_client()->GetBytesReceivedStats(remote_video_track) > 0, | 1302 initializing_client()->GetBytesReceivedStats(remote_video_track) > 0, |
| 1304 kMaxWaitForStatsMs); | 1303 kMaxWaitForStatsMs); |
| 1305 } | 1304 } |
| 1306 | 1305 |
| 1307 // Test that we can get outgoing byte counts from both audio and video tracks. | 1306 // Test that we can get outgoing byte counts from both audio and video tracks. |
| 1308 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, MAYBE_GetBytesSentStats) { | 1307 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, GetBytesSentStats) { |
| 1309 ASSERT_TRUE(CreateTestClients()); | 1308 ASSERT_TRUE(CreateTestClients()); |
| 1310 LocalP2PTest(); | 1309 LocalP2PTest(); |
| 1311 | 1310 |
| 1312 StreamCollectionInterface* local_streams = | 1311 StreamCollectionInterface* local_streams = |
| 1313 initializing_client()->local_streams(); | 1312 initializing_client()->local_streams(); |
| 1314 ASSERT_GT(local_streams->count(), 0u); | 1313 ASSERT_GT(local_streams->count(), 0u); |
| 1315 ASSERT_GT(local_streams->at(0)->GetAudioTracks().size(), 0u); | 1314 ASSERT_GT(local_streams->at(0)->GetAudioTracks().size(), 0u); |
| 1316 MediaStreamTrackInterface* local_audio_track = | 1315 MediaStreamTrackInterface* local_audio_track = |
| 1317 local_streams->at(0)->GetAudioTracks()[0]; | 1316 local_streams->at(0)->GetAudioTracks()[0]; |
| 1318 EXPECT_TRUE_WAIT( | 1317 EXPECT_TRUE_WAIT( |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1351 | 1350 |
| 1352 EXPECT_EQ_WAIT(rtc::SrtpCryptoSuiteToName(kDefaultSrtpCryptoSuite), | 1351 EXPECT_EQ_WAIT(rtc::SrtpCryptoSuiteToName(kDefaultSrtpCryptoSuite), |
| 1353 initializing_client()->GetSrtpCipherStats(), | 1352 initializing_client()->GetSrtpCipherStats(), |
| 1354 kMaxWaitForStatsMs); | 1353 kMaxWaitForStatsMs); |
| 1355 EXPECT_EQ(1, | 1354 EXPECT_EQ(1, |
| 1356 init_observer->GetEnumCounter(webrtc::kEnumCounterAudioSrtpCipher, | 1355 init_observer->GetEnumCounter(webrtc::kEnumCounterAudioSrtpCipher, |
| 1357 kDefaultSrtpCryptoSuite)); | 1356 kDefaultSrtpCryptoSuite)); |
| 1358 } | 1357 } |
| 1359 | 1358 |
| 1360 // Test that DTLS 1.2 is used if both ends support it. | 1359 // Test that DTLS 1.2 is used if both ends support it. |
| 1361 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, MAYBE_GetDtls12Both) { | 1360 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, GetDtls12Both) { |
| 1362 PeerConnectionFactory::Options init_options; | 1361 PeerConnectionFactory::Options init_options; |
| 1363 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; | 1362 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; |
| 1364 PeerConnectionFactory::Options recv_options; | 1363 PeerConnectionFactory::Options recv_options; |
| 1365 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; | 1364 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; |
| 1366 ASSERT_TRUE( | 1365 ASSERT_TRUE( |
| 1367 CreateTestClients(nullptr, &init_options, nullptr, &recv_options)); | 1366 CreateTestClients(nullptr, &init_options, nullptr, &recv_options)); |
| 1368 rtc::scoped_refptr<webrtc::FakeMetricsObserver> | 1367 rtc::scoped_refptr<webrtc::FakeMetricsObserver> |
| 1369 init_observer = new rtc::RefCountedObject<webrtc::FakeMetricsObserver>(); | 1368 init_observer = new rtc::RefCountedObject<webrtc::FakeMetricsObserver>(); |
| 1370 initializing_client()->pc()->RegisterUMAObserver(init_observer); | 1369 initializing_client()->pc()->RegisterUMAObserver(init_observer); |
| 1371 LocalP2PTest(); | 1370 LocalP2PTest(); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1597 MediaConstraintsInterface::kEnableDtlsSrtp, true); | 1596 MediaConstraintsInterface::kEnableDtlsSrtp, true); |
| 1598 ASSERT_TRUE(CreateTestClients(&constraints, &constraints)); | 1597 ASSERT_TRUE(CreateTestClients(&constraints, &constraints)); |
| 1599 initializing_client()->CreateDataChannel(); | 1598 initializing_client()->CreateDataChannel(); |
| 1600 initializing_client()->Negotiate(false, false); | 1599 initializing_client()->Negotiate(false, false); |
| 1601 } | 1600 } |
| 1602 #endif | 1601 #endif |
| 1603 | 1602 |
| 1604 // This test sets up a call between two parties with audio, and video. | 1603 // This test sets up a call between two parties with audio, and video. |
| 1605 // During the call, the initializing side restart ice and the test verifies that | 1604 // During the call, the initializing side restart ice and the test verifies that |
| 1606 // new ice candidates are generated and audio and video still can flow. | 1605 // new ice candidates are generated and audio and video still can flow. |
| 1607 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, MAYBE_IceRestart) { | 1606 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, IceRestart) { |
| 1608 ASSERT_TRUE(CreateTestClients()); | 1607 ASSERT_TRUE(CreateTestClients()); |
| 1609 | 1608 |
| 1610 // Negotiate and wait for ice completion and make sure audio and video plays. | 1609 // Negotiate and wait for ice completion and make sure audio and video plays. |
| 1611 LocalP2PTest(); | 1610 LocalP2PTest(); |
| 1612 | 1611 |
| 1613 // Create a SDP string of the first audio candidate for both clients. | 1612 // Create a SDP string of the first audio candidate for both clients. |
| 1614 const webrtc::IceCandidateCollection* audio_candidates_initiator = | 1613 const webrtc::IceCandidateCollection* audio_candidates_initiator = |
| 1615 initializing_client()->pc()->local_description()->candidates(0); | 1614 initializing_client()->pc()->local_description()->candidates(0); |
| 1616 const webrtc::IceCandidateCollection* audio_candidates_receiver = | 1615 const webrtc::IceCandidateCollection* audio_candidates_receiver = |
| 1617 receiving_client()->pc()->local_description()->candidates(0); | 1616 receiving_client()->pc()->local_description()->candidates(0); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1883 server.urls.push_back("stun:hostname"); | 1882 server.urls.push_back("stun:hostname"); |
| 1884 server.urls.push_back("turn:hostname"); | 1883 server.urls.push_back("turn:hostname"); |
| 1885 servers.push_back(server); | 1884 servers.push_back(server); |
| 1886 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_configurations_, | 1885 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_configurations_, |
| 1887 &turn_configurations_)); | 1886 &turn_configurations_)); |
| 1888 EXPECT_EQ(1U, stun_configurations_.size()); | 1887 EXPECT_EQ(1U, stun_configurations_.size()); |
| 1889 EXPECT_EQ(1U, turn_configurations_.size()); | 1888 EXPECT_EQ(1U, turn_configurations_.size()); |
| 1890 } | 1889 } |
| 1891 | 1890 |
| 1892 #endif // if !defined(THREAD_SANITIZER) | 1891 #endif // if !defined(THREAD_SANITIZER) |
| OLD | NEW |