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 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 } | 951 } |
952 if (callee_) { | 952 if (callee_) { |
953 callee_->set_signaling_message_receiver(nullptr); | 953 callee_->set_signaling_message_receiver(nullptr); |
954 } | 954 } |
955 } | 955 } |
956 | 956 |
957 bool SignalingStateStable() { | 957 bool SignalingStateStable() { |
958 return caller_->SignalingStateStable() && callee_->SignalingStateStable(); | 958 return caller_->SignalingStateStable() && callee_->SignalingStateStable(); |
959 } | 959 } |
960 | 960 |
| 961 bool DtlsConnected() { |
| 962 // TODO(deadbeef): kIceConnectionConnected currently means both ICE and DTLS |
| 963 // are connected. This is an important distinction. Once we have separate |
| 964 // ICE and DTLS state, this check needs to use the DTLS state. |
| 965 return (callee()->ice_connection_state() == |
| 966 webrtc::PeerConnectionInterface::kIceConnectionConnected || |
| 967 callee()->ice_connection_state() == |
| 968 webrtc::PeerConnectionInterface::kIceConnectionCompleted) && |
| 969 (caller()->ice_connection_state() == |
| 970 webrtc::PeerConnectionInterface::kIceConnectionConnected || |
| 971 caller()->ice_connection_state() == |
| 972 webrtc::PeerConnectionInterface::kIceConnectionCompleted); |
| 973 } |
| 974 |
961 bool CreatePeerConnectionWrappers() { | 975 bool CreatePeerConnectionWrappers() { |
962 return CreatePeerConnectionWrappersWithConfig( | 976 return CreatePeerConnectionWrappersWithConfig( |
963 PeerConnectionInterface::RTCConfiguration(), | 977 PeerConnectionInterface::RTCConfiguration(), |
964 PeerConnectionInterface::RTCConfiguration()); | 978 PeerConnectionInterface::RTCConfiguration()); |
965 } | 979 } |
966 | 980 |
967 bool CreatePeerConnectionWrappersWithConstraints( | 981 bool CreatePeerConnectionWrappersWithConstraints( |
968 MediaConstraintsInterface* caller_constraints, | 982 MediaConstraintsInterface* caller_constraints, |
969 MediaConstraintsInterface* callee_constraints) { | 983 MediaConstraintsInterface* callee_constraints) { |
970 caller_.reset(PeerConnectionWrapper::CreateWithConstraints( | 984 caller_.reset(PeerConnectionWrapper::CreateWithConstraints( |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1238 // Verifies the DtmfSenderObserver callbacks for a DtmfSender (one in each | 1252 // Verifies the DtmfSenderObserver callbacks for a DtmfSender (one in each |
1239 // direction). | 1253 // direction). |
1240 TEST_F(PeerConnectionIntegrationTest, DtmfSenderObserver) { | 1254 TEST_F(PeerConnectionIntegrationTest, DtmfSenderObserver) { |
1241 ASSERT_TRUE(CreatePeerConnectionWrappers()); | 1255 ASSERT_TRUE(CreatePeerConnectionWrappers()); |
1242 ConnectFakeSignaling(); | 1256 ConnectFakeSignaling(); |
1243 // Only need audio for DTMF. | 1257 // Only need audio for DTMF. |
1244 caller()->AddAudioOnlyMediaStream(); | 1258 caller()->AddAudioOnlyMediaStream(); |
1245 callee()->AddAudioOnlyMediaStream(); | 1259 callee()->AddAudioOnlyMediaStream(); |
1246 caller()->CreateAndSetAndSignalOffer(); | 1260 caller()->CreateAndSetAndSignalOffer(); |
1247 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); | 1261 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); |
| 1262 // DTLS must finish before the DTMF sender can be used reliably. |
| 1263 ASSERT_TRUE_WAIT(DtlsConnected(), kDefaultTimeout); |
1248 TestDtmfFromSenderToReceiver(caller(), callee()); | 1264 TestDtmfFromSenderToReceiver(caller(), callee()); |
1249 TestDtmfFromSenderToReceiver(callee(), caller()); | 1265 TestDtmfFromSenderToReceiver(callee(), caller()); |
1250 } | 1266 } |
1251 | 1267 |
1252 // Basic end-to-end test, verifying media can be encoded/transmitted/decoded | 1268 // Basic end-to-end test, verifying media can be encoded/transmitted/decoded |
1253 // between two connections, using DTLS-SRTP. | 1269 // between two connections, using DTLS-SRTP. |
1254 TEST_F(PeerConnectionIntegrationTest, EndToEndCallWithDtls) { | 1270 TEST_F(PeerConnectionIntegrationTest, EndToEndCallWithDtls) { |
1255 ASSERT_TRUE(CreatePeerConnectionWrappers()); | 1271 ASSERT_TRUE(CreatePeerConnectionWrappers()); |
1256 ConnectFakeSignaling(); | 1272 ConnectFakeSignaling(); |
1257 // Do normal offer/answer and wait for some frames to be received in each | 1273 // Do normal offer/answer and wait for some frames to be received in each |
(...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2774 virtual_socket_server()->set_delay_mean(media_hop_delay_ms); | 2790 virtual_socket_server()->set_delay_mean(media_hop_delay_ms); |
2775 virtual_socket_server()->UpdateDelayDistribution(); | 2791 virtual_socket_server()->UpdateDelayDistribution(); |
2776 | 2792 |
2777 // Set "offer to receive audio/video" without adding any tracks, so we just | 2793 // Set "offer to receive audio/video" without adding any tracks, so we just |
2778 // set up ICE/DTLS with no media. | 2794 // set up ICE/DTLS with no media. |
2779 PeerConnectionInterface::RTCOfferAnswerOptions options; | 2795 PeerConnectionInterface::RTCOfferAnswerOptions options; |
2780 options.offer_to_receive_audio = 1; | 2796 options.offer_to_receive_audio = 1; |
2781 options.offer_to_receive_video = 1; | 2797 options.offer_to_receive_video = 1; |
2782 caller()->SetOfferAnswerOptions(options); | 2798 caller()->SetOfferAnswerOptions(options); |
2783 caller()->CreateAndSetAndSignalOffer(); | 2799 caller()->CreateAndSetAndSignalOffer(); |
2784 // TODO(deadbeef): kIceConnectionConnected currently means both ICE and DTLS | 2800 EXPECT_TRUE_SIMULATED_WAIT(DtlsConnected(), total_connection_time_ms, |
2785 // are connected. This is an important distinction. Once we have separate ICE | 2801 fake_clock); |
2786 // and DTLS state, this check needs to use the DTLS state. | |
2787 EXPECT_TRUE_SIMULATED_WAIT( | |
2788 (callee()->ice_connection_state() == | |
2789 webrtc::PeerConnectionInterface::kIceConnectionConnected || | |
2790 callee()->ice_connection_state() == | |
2791 webrtc::PeerConnectionInterface::kIceConnectionCompleted) && | |
2792 (caller()->ice_connection_state() == | |
2793 webrtc::PeerConnectionInterface::kIceConnectionConnected || | |
2794 caller()->ice_connection_state() == | |
2795 webrtc::PeerConnectionInterface::kIceConnectionCompleted), | |
2796 total_connection_time_ms, fake_clock); | |
2797 // Need to free the clients here since they're using things we created on | 2802 // Need to free the clients here since they're using things we created on |
2798 // the stack. | 2803 // the stack. |
2799 delete SetCallerPcWrapperAndReturnCurrent(nullptr); | 2804 delete SetCallerPcWrapperAndReturnCurrent(nullptr); |
2800 delete SetCalleePcWrapperAndReturnCurrent(nullptr); | 2805 delete SetCalleePcWrapperAndReturnCurrent(nullptr); |
2801 } | 2806 } |
2802 | 2807 |
2803 // Test that audio and video flow end-to-end when codec names don't use the | 2808 // Test that audio and video flow end-to-end when codec names don't use the |
2804 // expected casing, given that they're supposed to be case insensitive. To test | 2809 // expected casing, given that they're supposed to be case insensitive. To test |
2805 // this, all but one codec is removed from each media description, and its | 2810 // this, all but one codec is removed from each media description, and its |
2806 // casing is changed. | 2811 // casing is changed. |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2900 caller()->CreateAndSetAndSignalOffer(); | 2905 caller()->CreateAndSetAndSignalOffer(); |
2901 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); | 2906 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); |
2902 // Wait for additional audio frames to be received by the callee. | 2907 // Wait for additional audio frames to be received by the callee. |
2903 ExpectNewFramesReceivedWithWait(0, 0, kDefaultExpectedAudioFrameCount, 0, | 2908 ExpectNewFramesReceivedWithWait(0, 0, kDefaultExpectedAudioFrameCount, 0, |
2904 kMaxWaitForFramesMs); | 2909 kMaxWaitForFramesMs); |
2905 } | 2910 } |
2906 | 2911 |
2907 } // namespace | 2912 } // namespace |
2908 | 2913 |
2909 #endif // if !defined(THREAD_SANITIZER) | 2914 #endif // if !defined(THREAD_SANITIZER) |
OLD | NEW |