Replace the IceConnectionState implementation.
PeerConnection::ice_connection_state() used to return a value based on both DTLS and ICE transports.
Now that we have PeerConnection::peer_connection_state() to fill that role we can change the implementation of ice_connection_state over to match the spec.
Bug: webrtc:6145
Change-Id: Ia4f348f728f24faf4b976c63dea2187bb1f01ef0
Reviewed-on: https://webrtc-review.googlesource.com/c/108780
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25773}
diff --git a/pc/peerconnection_integrationtest.cc b/pc/peerconnection_integrationtest.cc
index a7f7aad..7cd03a4 100644
--- a/pc/peerconnection_integrationtest.cc
+++ b/pc/peerconnection_integrationtest.cc
@@ -553,6 +553,10 @@
return pc()->ice_connection_state();
}
+ webrtc::PeerConnectionInterface::PeerConnectionState peer_connection_state() {
+ return pc()->peer_connection_state();
+ }
+
webrtc::PeerConnectionInterface::IceGatheringState ice_gathering_state() {
return pc()->ice_gathering_state();
}
@@ -1201,17 +1205,11 @@
}
bool DtlsConnected() {
- // TODO(deadbeef): kIceConnectionConnected currently means both ICE and DTLS
- // are connected. This is an important distinction. Once we have separate
- // ICE and DTLS state, this check needs to use the DTLS state.
- return (callee()->ice_connection_state() ==
- webrtc::PeerConnectionInterface::kIceConnectionConnected ||
- callee()->ice_connection_state() ==
- webrtc::PeerConnectionInterface::kIceConnectionCompleted) &&
- (caller()->ice_connection_state() ==
- webrtc::PeerConnectionInterface::kIceConnectionConnected ||
- caller()->ice_connection_state() ==
- webrtc::PeerConnectionInterface::kIceConnectionCompleted);
+ return callee()->peer_connection_state() ==
+ webrtc::PeerConnectionInterface::PeerConnectionState::
+ kConnected &&
+ caller()->peer_connection_state() ==
+ webrtc::PeerConnectionInterface::PeerConnectionState::kConnected;
}
// When |event_log_factory| is null, the default implementation of the event
@@ -1601,7 +1599,10 @@
EXPECT_EQ_WAIT(rtc::SrtpCryptoSuiteToName(expected_cipher_suite),
caller()->OldGetStats()->SrtpCipher(), kDefaultTimeout);
// TODO(bugs.webrtc.org/9456): Fix it.
- EXPECT_EQ(1, webrtc::metrics::NumEvents(
+ EXPECT_LE(1, webrtc::metrics::NumEvents(
+ "WebRTC.PeerConnection.SrtpCryptoSuite.Audio",
+ expected_cipher_suite));
+ EXPECT_GE(2, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.SrtpCryptoSuite.Audio",
expected_cipher_suite));
}
@@ -2824,7 +2825,10 @@
EXPECT_EQ_WAIT(rtc::SrtpCryptoSuiteToName(kDefaultSrtpCryptoSuite),
caller()->OldGetStats()->SrtpCipher(), kDefaultTimeout);
// TODO(bugs.webrtc.org/9456): Fix it.
- EXPECT_EQ(1, webrtc::metrics::NumEvents(
+ EXPECT_LE(1, webrtc::metrics::NumEvents(
+ "WebRTC.PeerConnection.SrtpCryptoSuite.Audio",
+ kDefaultSrtpCryptoSuite));
+ EXPECT_GE(2, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.SrtpCryptoSuite.Audio",
kDefaultSrtpCryptoSuite));
}
@@ -2846,7 +2850,10 @@
EXPECT_EQ_WAIT(rtc::SrtpCryptoSuiteToName(kDefaultSrtpCryptoSuite),
caller()->OldGetStats()->SrtpCipher(), kDefaultTimeout);
// TODO(bugs.webrtc.org/9456): Fix it.
- EXPECT_EQ(1, webrtc::metrics::NumEvents(
+ EXPECT_LE(1, webrtc::metrics::NumEvents(
+ "WebRTC.PeerConnection.SrtpCryptoSuite.Audio",
+ kDefaultSrtpCryptoSuite));
+ EXPECT_GE(2, webrtc::metrics::NumEvents(
"WebRTC.PeerConnection.SrtpCryptoSuite.Audio",
kDefaultSrtpCryptoSuite));
}
@@ -3548,8 +3555,13 @@
// fixed, this test should be updated.
EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionCompleted,
caller()->ice_connection_state(), kDefaultTimeout);
- EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionConnected,
- callee()->ice_connection_state(), kDefaultTimeout);
+ EXPECT_TRUE_WAIT(
+ callee()->ice_connection_state() ==
+ webrtc::PeerConnectionInterface::kIceConnectionConnected ||
+ callee()->ice_connection_state() ==
+ webrtc::PeerConnectionInterface::kIceConnectionCompleted,
+ kDefaultTimeout)
+ << callee()->ice_connection_state();
}
// Replaces the first candidate with a static address and configures a
@@ -3864,8 +3876,13 @@
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionCompleted,
caller()->ice_connection_state(), kMaxWaitForFramesMs);
- EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionConnected,
- callee()->ice_connection_state(), kMaxWaitForFramesMs);
+ EXPECT_TRUE_WAIT(
+ callee()->ice_connection_state() ==
+ webrtc::PeerConnectionInterface::kIceConnectionConnected ||
+ callee()->ice_connection_state() ==
+ webrtc::PeerConnectionInterface::kIceConnectionCompleted,
+ kDefaultTimeout)
+ << callee()->ice_connection_state();
// To verify that the ICE restart actually occurs, get
// ufrag/password/candidates before and after restart.
@@ -3896,7 +3913,7 @@
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionCompleted,
caller()->ice_connection_state(), kMaxWaitForFramesMs);
- EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionConnected,
+ EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionCompleted,
callee()->ice_connection_state(), kMaxWaitForFramesMs);
// Grab the ufrags/candidates again.