diff --git a/p2p/base/p2p_transport_channel.cc b/p2p/base/p2p_transport_channel.cc index 212ed30103..6fee0249ba 100644 --- a/p2p/base/p2p_transport_channel.cc +++ b/p2p/base/p2p_transport_channel.cc @@ -394,7 +394,7 @@ IceTransportState P2PTransportChannel::ComputeState() const { // Compute the current RTCIceTransportState as described in // https://www.w3.org/TR/webrtc/#dom-rtcicetransportstate -// TODO(bugs.webrtc.org/9218): Avoid prematurely signalling kFailed once we have +// TODO(bugs.webrtc.org/9218): Start signaling kCompleted once we have // implemented end-of-candidates signalling. webrtc::IceTransportState P2PTransportChannel::ComputeIceTransportState() const { @@ -413,23 +413,12 @@ webrtc::IceTransportState P2PTransportChannel::ComputeIceTransportState() return webrtc::IceTransportState::kFailed; } - switch (gathering_state_) { - case kIceGatheringComplete: - if (has_connection) - return webrtc::IceTransportState::kCompleted; - else - return webrtc::IceTransportState::kFailed; - case kIceGatheringNew: - return webrtc::IceTransportState::kNew; - case kIceGatheringGathering: - if (has_connection) - return webrtc::IceTransportState::kConnected; - else - return webrtc::IceTransportState::kChecking; - default: - RTC_NOTREACHED(); - return webrtc::IceTransportState::kFailed; - } + if (gathering_state_ == kIceGatheringNew) + return webrtc::IceTransportState::kNew; + else if (has_connection) + return webrtc::IceTransportState::kConnected; + else + return webrtc::IceTransportState::kChecking; } void P2PTransportChannel::SetIceParameters(const IceParameters& ice_params) { diff --git a/p2p/base/p2p_transport_channel_unittest.cc b/p2p/base/p2p_transport_channel_unittest.cc index 9beb075e6f..10b07b149a 100644 --- a/p2p/base/p2p_transport_channel_unittest.cc +++ b/p2p/base/p2p_transport_channel_unittest.cc @@ -4146,7 +4146,7 @@ TEST_F(P2PTransportChannelPingTest, TestGetState) { Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1, &clock); Connection* conn2 = WaitForConnectionTo(&ch, "2.2.2.2", 2, &clock); // Gathering complete with candidates. - EXPECT_EQ(webrtc::IceTransportState::kCompleted, ch.GetIceTransportState()); + EXPECT_EQ(webrtc::IceTransportState::kConnected, ch.GetIceTransportState()); ASSERT_TRUE(conn1 != nullptr); ASSERT_TRUE(conn2 != nullptr); // Now there are two connections, so the transport channel is connecting. diff --git a/pc/peer_connection_integrationtest.cc b/pc/peer_connection_integrationtest.cc index 1698eac0f7..dd7f1d83cd 100644 --- a/pc/peer_connection_integrationtest.cc +++ b/pc/peer_connection_integrationtest.cc @@ -3827,7 +3827,7 @@ TEST_P(PeerConnectionIntegrationIceStatesTest, VerifyIceStates) { ASSERT_EQ(PeerConnectionInterface::kIceConnectionCompleted, caller()->ice_connection_state()); - ASSERT_EQ(PeerConnectionInterface::kIceConnectionCompleted, + ASSERT_EQ(PeerConnectionInterface::kIceConnectionConnected, caller()->standardized_ice_connection_state()); // Verify that the observer was notified of the intermediate transitions. @@ -3860,7 +3860,7 @@ TEST_P(PeerConnectionIntegrationIceStatesTest, VerifyIceStates) { RTC_LOG(LS_INFO) << "Firewall rules cleared"; ASSERT_EQ_WAIT(PeerConnectionInterface::kIceConnectionCompleted, caller()->ice_connection_state(), kDefaultTimeout); - ASSERT_EQ_WAIT(PeerConnectionInterface::kIceConnectionCompleted, + ASSERT_EQ_WAIT(PeerConnectionInterface::kIceConnectionConnected, caller()->standardized_ice_connection_state(), kDefaultTimeout);