From df919fb42560e930797c82b2f007650ffeaebb30 Mon Sep 17 00:00:00 2001 From: Jonas Olsson Date: Tue, 22 Jan 2019 11:21:00 +0100 Subject: [PATCH] Don't pretend we've received an end-of-candidates indication. Since end-of-candidates signalling isn't implemented yet, the ice transport shouldn't reach completed. We also shouldn't assume that the transport has failed because gathering is complete without candidates, as we might still get remote candidates. Bug: chromium:922588 Change-Id: I332f57be494efc775819d80908e9f39610311f82 Reviewed-on: https://webrtc-review.googlesource.com/c/118741 Reviewed-by: Steve Anton Commit-Queue: Jonas Olsson Cr-Commit-Position: refs/heads/master@{#26365} --- p2p/base/p2p_transport_channel.cc | 25 ++++++---------------- p2p/base/p2p_transport_channel_unittest.cc | 2 +- pc/peer_connection_integrationtest.cc | 4 ++-- 3 files changed, 10 insertions(+), 21 deletions(-) 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);