| 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 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1287 receiving_client_->AudioFramesReceivedCheck( | 1287 receiving_client_->AudioFramesReceivedCheck( |
| 1288 pc2_audio_received + kEndAudioFrameCount), | 1288 pc2_audio_received + kEndAudioFrameCount), |
| 1289 kMaxWaitForFramesMs); | 1289 kMaxWaitForFramesMs); |
| 1290 | 1290 |
| 1291 // During this time, we shouldn't have received any additional video frames | 1291 // During this time, we shouldn't have received any additional video frames |
| 1292 // for the rejected video tracks. | 1292 // for the rejected video tracks. |
| 1293 EXPECT_EQ(pc1_video_received, initiating_client_->video_frames_received()); | 1293 EXPECT_EQ(pc1_video_received, initiating_client_->video_frames_received()); |
| 1294 EXPECT_EQ(pc2_video_received, receiving_client_->video_frames_received()); | 1294 EXPECT_EQ(pc2_video_received, receiving_client_->video_frames_received()); |
| 1295 } | 1295 } |
| 1296 | 1296 |
| 1297 void VerifyRenderedSize(int width, int height) { | 1297 void VerifyRenderedAspectRatio(int width, int height) { |
| 1298 VerifyRenderedSize(width, height, webrtc::kVideoRotation_0); | 1298 VerifyRenderedAspectRatio(width, height, webrtc::kVideoRotation_0); |
| 1299 } | 1299 } |
| 1300 | 1300 |
| 1301 void VerifyRenderedSize(int width, | 1301 void VerifyRenderedAspectRatio(int width, |
| 1302 int height, | 1302 int height, |
| 1303 webrtc::VideoRotation rotation) { | 1303 webrtc::VideoRotation rotation) { |
| 1304 double expected_aspect_ratio = static_cast<double>(width) / height; | 1304 double expected_aspect_ratio = static_cast<double>(width) / height; |
| 1305 double receiving_client_rendered_aspect_ratio = | 1305 double receiving_client_rendered_aspect_ratio = |
| 1306 static_cast<double>(receiving_client()->rendered_width()) / | 1306 static_cast<double>(receiving_client()->rendered_width()) / |
| 1307 receiving_client()->rendered_height(); | 1307 receiving_client()->rendered_height(); |
| 1308 double initializing_client_rendered_aspect_ratio = | 1308 double initializing_client_rendered_aspect_ratio = |
| 1309 static_cast<double>(initializing_client()->rendered_width()) / | 1309 static_cast<double>(initializing_client()->rendered_width()) / |
| 1310 initializing_client()->rendered_height(); | 1310 initializing_client()->rendered_height(); |
| 1311 double initializing_client_local_rendered_aspect_ratio = |
| 1312 static_cast<double>(initializing_client()->local_rendered_width()) / |
| 1313 initializing_client()->local_rendered_height(); |
| 1314 // Verify end-to-end rendered aspect ratio. |
| 1311 EXPECT_EQ(expected_aspect_ratio, receiving_client_rendered_aspect_ratio); | 1315 EXPECT_EQ(expected_aspect_ratio, receiving_client_rendered_aspect_ratio); |
| 1312 EXPECT_EQ(expected_aspect_ratio, initializing_client_rendered_aspect_ratio); | 1316 EXPECT_EQ(expected_aspect_ratio, initializing_client_rendered_aspect_ratio); |
| 1317 // Verify aspect ratio of the local preview. |
| 1318 EXPECT_EQ(expected_aspect_ratio, |
| 1319 initializing_client_local_rendered_aspect_ratio); |
| 1313 | 1320 |
| 1321 // Verify rotation. |
| 1314 EXPECT_EQ(rotation, receiving_client()->rendered_rotation()); | 1322 EXPECT_EQ(rotation, receiving_client()->rendered_rotation()); |
| 1315 EXPECT_EQ(rotation, initializing_client()->rendered_rotation()); | 1323 EXPECT_EQ(rotation, initializing_client()->rendered_rotation()); |
| 1316 | |
| 1317 // Verify size of the local preview. | |
| 1318 EXPECT_EQ(width, initializing_client()->local_rendered_width()); | |
| 1319 EXPECT_EQ(height, initializing_client()->local_rendered_height()); | |
| 1320 } | 1324 } |
| 1321 | 1325 |
| 1322 void VerifySessionDescriptions() { | 1326 void VerifySessionDescriptions() { |
| 1323 initiating_client_->VerifyRejectedMediaInSessionDescription(); | 1327 initiating_client_->VerifyRejectedMediaInSessionDescription(); |
| 1324 receiving_client_->VerifyRejectedMediaInSessionDescription(); | 1328 receiving_client_->VerifyRejectedMediaInSessionDescription(); |
| 1325 initiating_client_->VerifyLocalIceUfragAndPassword(); | 1329 initiating_client_->VerifyLocalIceUfragAndPassword(); |
| 1326 receiving_client_->VerifyLocalIceUfragAndPassword(); | 1330 receiving_client_->VerifyLocalIceUfragAndPassword(); |
| 1327 } | 1331 } |
| 1328 | 1332 |
| 1329 ~P2PTestConductor() { | 1333 ~P2PTestConductor() { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1472 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, | 1476 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, |
| 1473 true); | 1477 true); |
| 1474 // Disable resolution adaptation, we don't want it interfering with the | 1478 // Disable resolution adaptation, we don't want it interfering with the |
| 1475 // test results. | 1479 // test results. |
| 1476 webrtc::PeerConnectionInterface::RTCConfiguration rtc_config; | 1480 webrtc::PeerConnectionInterface::RTCConfiguration rtc_config; |
| 1477 rtc_config.set_cpu_adaptation(false); | 1481 rtc_config.set_cpu_adaptation(false); |
| 1478 | 1482 |
| 1479 ASSERT_TRUE(CreateTestClients(&setup_constraints, nullptr, &rtc_config, | 1483 ASSERT_TRUE(CreateTestClients(&setup_constraints, nullptr, &rtc_config, |
| 1480 &setup_constraints, nullptr, &rtc_config)); | 1484 &setup_constraints, nullptr, &rtc_config)); |
| 1481 LocalP2PTest(); | 1485 LocalP2PTest(); |
| 1482 VerifyRenderedSize(640, 480); | 1486 VerifyRenderedAspectRatio(640, 480); |
| 1483 } | 1487 } |
| 1484 | 1488 |
| 1485 PeerConnectionTestClient* CreateDtlsClientWithAlternateKey() { | 1489 PeerConnectionTestClient* CreateDtlsClientWithAlternateKey() { |
| 1486 FakeConstraints setup_constraints; | 1490 FakeConstraints setup_constraints; |
| 1487 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, | 1491 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, |
| 1488 true); | 1492 true); |
| 1489 // Disable resolution adaptation, we don't want it interfering with the | 1493 // Disable resolution adaptation, we don't want it interfering with the |
| 1490 // test results. | 1494 // test results. |
| 1491 webrtc::PeerConnectionInterface::RTCConfiguration rtc_config; | 1495 webrtc::PeerConnectionInterface::RTCConfiguration rtc_config; |
| 1492 rtc_config.set_cpu_adaptation(false); | 1496 rtc_config.set_cpu_adaptation(false); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1656 // received video has a resolution of 1280*720. | 1660 // received video has a resolution of 1280*720. |
| 1657 // TODO(mallinath): Enable when | 1661 // TODO(mallinath): Enable when |
| 1658 // http://code.google.com/p/webrtc/issues/detail?id=981 is fixed. | 1662 // http://code.google.com/p/webrtc/issues/detail?id=981 is fixed. |
| 1659 TEST_F(P2PTestConductor, DISABLED_LocalP2PTest1280By720) { | 1663 TEST_F(P2PTestConductor, DISABLED_LocalP2PTest1280By720) { |
| 1660 ASSERT_TRUE(CreateTestClients()); | 1664 ASSERT_TRUE(CreateTestClients()); |
| 1661 FakeConstraints constraint; | 1665 FakeConstraints constraint; |
| 1662 constraint.SetMandatoryMinWidth(1280); | 1666 constraint.SetMandatoryMinWidth(1280); |
| 1663 constraint.SetMandatoryMinHeight(720); | 1667 constraint.SetMandatoryMinHeight(720); |
| 1664 SetVideoConstraints(constraint, constraint); | 1668 SetVideoConstraints(constraint, constraint); |
| 1665 LocalP2PTest(); | 1669 LocalP2PTest(); |
| 1666 VerifyRenderedSize(1280, 720); | 1670 VerifyRenderedAspectRatio(1280, 720); |
| 1667 } | 1671 } |
| 1668 | 1672 |
| 1669 // This test sets up a call between two endpoints that are configured to use | 1673 // This test sets up a call between two endpoints that are configured to use |
| 1670 // DTLS key agreement. As a result, DTLS is negotiated and used for transport. | 1674 // DTLS key agreement. As a result, DTLS is negotiated and used for transport. |
| 1671 TEST_F(P2PTestConductor, LocalP2PTestDtls) { | 1675 TEST_F(P2PTestConductor, LocalP2PTestDtls) { |
| 1672 SetupAndVerifyDtlsCall(); | 1676 SetupAndVerifyDtlsCall(); |
| 1673 } | 1677 } |
| 1674 | 1678 |
| 1675 // This test sets up an one-way call, with media only from initiator to | 1679 // This test sets up an one-way call, with media only from initiator to |
| 1676 // responder. | 1680 // responder. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1708 | 1712 |
| 1709 // Keeping the original peer around which will still send packets to the | 1713 // Keeping the original peer around which will still send packets to the |
| 1710 // receiving client. These SRTP packets will be dropped. | 1714 // receiving client. These SRTP packets will be dropped. |
| 1711 std::unique_ptr<PeerConnectionTestClient> original_peer( | 1715 std::unique_ptr<PeerConnectionTestClient> original_peer( |
| 1712 set_initializing_client(CreateDtlsClientWithAlternateKey())); | 1716 set_initializing_client(CreateDtlsClientWithAlternateKey())); |
| 1713 original_peer->pc()->Close(); | 1717 original_peer->pc()->Close(); |
| 1714 | 1718 |
| 1715 SetSignalingReceivers(); | 1719 SetSignalingReceivers(); |
| 1716 receiving_client()->SetExpectIceRestart(true); | 1720 receiving_client()->SetExpectIceRestart(true); |
| 1717 LocalP2PTest(); | 1721 LocalP2PTest(); |
| 1718 VerifyRenderedSize(640, 480); | 1722 VerifyRenderedAspectRatio(640, 480); |
| 1719 } | 1723 } |
| 1720 | 1724 |
| 1721 // This test sets up a non-bundle call and apply bundle during ICE restart. When | 1725 // This test sets up a non-bundle call and apply bundle during ICE restart. When |
| 1722 // bundle is in effect in the restart, the channel can successfully reset its | 1726 // bundle is in effect in the restart, the channel can successfully reset its |
| 1723 // DTLS-SRTP context. | 1727 // DTLS-SRTP context. |
| 1724 #if defined(MEMORY_SANITIZER) | 1728 #if defined(MEMORY_SANITIZER) |
| 1725 // Fails under MemorySanitizer: | 1729 // Fails under MemorySanitizer: |
| 1726 // See https://bugs.chromium.org/p/webrtc/issues/detail?id=6811 | 1730 // See https://bugs.chromium.org/p/webrtc/issues/detail?id=6811 |
| 1727 #define MAYBE_LocalP2PTestDtlsBundleInIceRestart \ | 1731 #define MAYBE_LocalP2PTestDtlsBundleInIceRestart \ |
| 1728 DISABLED_LocalP2PTestDtlsBundleInIceRestart | 1732 DISABLED_LocalP2PTestDtlsBundleInIceRestart |
| 1729 #else | 1733 #else |
| 1730 #define MAYBE_LocalP2PTestDtlsBundleInIceRestart \ | 1734 #define MAYBE_LocalP2PTestDtlsBundleInIceRestart \ |
| 1731 LocalP2PTestDtlsBundleInIceRestart | 1735 LocalP2PTestDtlsBundleInIceRestart |
| 1732 #endif | 1736 #endif |
| 1733 TEST_F(P2PTestConductor, MAYBE_LocalP2PTestDtlsBundleInIceRestart) { | 1737 TEST_F(P2PTestConductor, MAYBE_LocalP2PTestDtlsBundleInIceRestart) { |
| 1734 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1738 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 1735 FakeConstraints setup_constraints; | 1739 FakeConstraints setup_constraints; |
| 1736 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, | 1740 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, |
| 1737 true); | 1741 true); |
| 1738 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); | 1742 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); |
| 1739 receiving_client()->RemoveBundleFromReceivedSdp(true); | 1743 receiving_client()->RemoveBundleFromReceivedSdp(true); |
| 1740 LocalP2PTest(); | 1744 LocalP2PTest(); |
| 1741 VerifyRenderedSize(640, 480); | 1745 VerifyRenderedAspectRatio(640, 480); |
| 1742 | 1746 |
| 1743 initializing_client()->IceRestart(); | 1747 initializing_client()->IceRestart(); |
| 1744 receiving_client()->SetExpectIceRestart(true); | 1748 receiving_client()->SetExpectIceRestart(true); |
| 1745 receiving_client()->RemoveBundleFromReceivedSdp(false); | 1749 receiving_client()->RemoveBundleFromReceivedSdp(false); |
| 1746 LocalP2PTest(); | 1750 LocalP2PTest(); |
| 1747 VerifyRenderedSize(640, 480); | 1751 VerifyRenderedAspectRatio(640, 480); |
| 1748 } | 1752 } |
| 1749 | 1753 |
| 1750 // This test sets up a call transfer to a new callee with a different DTLS | 1754 // This test sets up a call transfer to a new callee with a different DTLS |
| 1751 // fingerprint. | 1755 // fingerprint. |
| 1752 TEST_F(P2PTestConductor, LocalP2PTestDtlsTransferCaller) { | 1756 TEST_F(P2PTestConductor, LocalP2PTestDtlsTransferCaller) { |
| 1753 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1757 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 1754 SetupAndVerifyDtlsCall(); | 1758 SetupAndVerifyDtlsCall(); |
| 1755 | 1759 |
| 1756 // Keeping the original peer around which will still send packets to the | 1760 // Keeping the original peer around which will still send packets to the |
| 1757 // receiving client. These SRTP packets will be dropped. | 1761 // receiving client. These SRTP packets will be dropped. |
| 1758 std::unique_ptr<PeerConnectionTestClient> original_peer( | 1762 std::unique_ptr<PeerConnectionTestClient> original_peer( |
| 1759 set_receiving_client(CreateDtlsClientWithAlternateKey())); | 1763 set_receiving_client(CreateDtlsClientWithAlternateKey())); |
| 1760 original_peer->pc()->Close(); | 1764 original_peer->pc()->Close(); |
| 1761 | 1765 |
| 1762 SetSignalingReceivers(); | 1766 SetSignalingReceivers(); |
| 1763 initializing_client()->IceRestart(); | 1767 initializing_client()->IceRestart(); |
| 1764 LocalP2PTest(); | 1768 LocalP2PTest(); |
| 1765 VerifyRenderedSize(640, 480); | 1769 VerifyRenderedAspectRatio(640, 480); |
| 1766 } | 1770 } |
| 1767 | 1771 |
| 1768 TEST_F(P2PTestConductor, LocalP2PTestCVO) { | 1772 TEST_F(P2PTestConductor, LocalP2PTestCVO) { |
| 1769 ASSERT_TRUE(CreateTestClients()); | 1773 ASSERT_TRUE(CreateTestClients()); |
| 1770 SetCaptureRotation(webrtc::kVideoRotation_90); | 1774 SetCaptureRotation(webrtc::kVideoRotation_90); |
| 1771 LocalP2PTest(); | 1775 LocalP2PTest(); |
| 1772 VerifyRenderedSize(640, 480, webrtc::kVideoRotation_90); | 1776 VerifyRenderedAspectRatio(640, 480, webrtc::kVideoRotation_90); |
| 1773 } | 1777 } |
| 1774 | 1778 |
| 1775 TEST_F(P2PTestConductor, LocalP2PTestReceiverDoesntSupportCVO) { | 1779 TEST_F(P2PTestConductor, LocalP2PTestReceiverDoesntSupportCVO) { |
| 1776 ASSERT_TRUE(CreateTestClients()); | 1780 ASSERT_TRUE(CreateTestClients()); |
| 1777 SetCaptureRotation(webrtc::kVideoRotation_90); | 1781 SetCaptureRotation(webrtc::kVideoRotation_90); |
| 1778 receiving_client()->RemoveCvoFromReceivedSdp(true); | 1782 receiving_client()->RemoveCvoFromReceivedSdp(true); |
| 1779 LocalP2PTest(); | 1783 LocalP2PTest(); |
| 1780 VerifyRenderedSize(480, 640, webrtc::kVideoRotation_0); | 1784 VerifyRenderedAspectRatio(480, 640, webrtc::kVideoRotation_0); |
| 1781 } | 1785 } |
| 1782 | 1786 |
| 1783 // This test sets up a call between two endpoints that are configured to use | 1787 // This test sets up a call between two endpoints that are configured to use |
| 1784 // DTLS key agreement. The offerer don't support SDES. As a result, DTLS is | 1788 // DTLS key agreement. The offerer don't support SDES. As a result, DTLS is |
| 1785 // negotiated and used for transport. | 1789 // negotiated and used for transport. |
| 1786 TEST_F(P2PTestConductor, LocalP2PTestOfferDtlsButNotSdes) { | 1790 TEST_F(P2PTestConductor, LocalP2PTestOfferDtlsButNotSdes) { |
| 1787 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1791 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 1788 FakeConstraints setup_constraints; | 1792 FakeConstraints setup_constraints; |
| 1789 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, | 1793 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, |
| 1790 true); | 1794 true); |
| 1791 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); | 1795 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); |
| 1792 receiving_client()->RemoveSdesCryptoFromReceivedSdp(true); | 1796 receiving_client()->RemoveSdesCryptoFromReceivedSdp(true); |
| 1793 LocalP2PTest(); | 1797 LocalP2PTest(); |
| 1794 VerifyRenderedSize(640, 480); | 1798 VerifyRenderedAspectRatio(640, 480); |
| 1795 } | 1799 } |
| 1796 | 1800 |
| 1797 // This test verifies that the negotiation will succeed with data channel only | 1801 // This test verifies that the negotiation will succeed with data channel only |
| 1798 // in max-bundle mode. | 1802 // in max-bundle mode. |
| 1799 TEST_F(P2PTestConductor, LocalP2PTestOfferDataChannelOnly) { | 1803 TEST_F(P2PTestConductor, LocalP2PTestOfferDataChannelOnly) { |
| 1800 webrtc::PeerConnectionInterface::RTCConfiguration rtc_config; | 1804 webrtc::PeerConnectionInterface::RTCConfiguration rtc_config; |
| 1801 rtc_config.bundle_policy = | 1805 rtc_config.bundle_policy = |
| 1802 webrtc::PeerConnectionInterface::kBundlePolicyMaxBundle; | 1806 webrtc::PeerConnectionInterface::kBundlePolicyMaxBundle; |
| 1803 ASSERT_TRUE(CreateTestClients(rtc_config, rtc_config)); | 1807 ASSERT_TRUE(CreateTestClients(rtc_config, rtc_config)); |
| 1804 initializing_client()->CreateDataChannel(); | 1808 initializing_client()->CreateDataChannel(); |
| (...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2799 server.urls.push_back("turn:hostname2"); | 2803 server.urls.push_back("turn:hostname2"); |
| 2800 servers.push_back(server); | 2804 servers.push_back(server); |
| 2801 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_)); | 2805 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_)); |
| 2802 EXPECT_EQ(2U, turn_servers_.size()); | 2806 EXPECT_EQ(2U, turn_servers_.size()); |
| 2803 EXPECT_NE(turn_servers_[0].priority, turn_servers_[1].priority); | 2807 EXPECT_NE(turn_servers_[0].priority, turn_servers_[1].priority); |
| 2804 } | 2808 } |
| 2805 | 2809 |
| 2806 #endif // if !defined(THREAD_SANITIZER) | 2810 #endif // if !defined(THREAD_SANITIZER) |
| 2807 | 2811 |
| 2808 } // namespace | 2812 } // namespace |
| OLD | NEW |