Don't transition ICE to Checking if there are no transports

This attempts to make it more clear that an offer or answer with
no transports will no start ICE.

Bug: None
Change-Id: Ifb8d9e445b8fbef1fb1590477dd6bdb4fc651a90
Reviewed-on: https://webrtc-review.googlesource.com/73640
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23070}
This commit is contained in:
Steve Anton
2018-05-01 14:32:17 -07:00
committed by Commit Bot
parent 878a3df8a2
commit f764cf4677
2 changed files with 16 additions and 0 deletions

View File

@ -2348,6 +2348,7 @@ RTCError PeerConnection::ApplyRemoteDescription(
// read to determine the current checking state. The existing SignalConnecting
// actually means "gathering candidates", so cannot be be used here.
if (remote_description()->GetType() != SdpType::kOffer &&
remote_description()->number_of_mediasections() > 0u &&
ice_connection_state() == PeerConnectionInterface::kIceConnectionNew) {
SetIceConnectionState(PeerConnectionInterface::kIceConnectionChecking);
}

View File

@ -351,6 +351,21 @@ TEST_P(PeerConnectionIceTest, SetRemoteDescriptionFailsIfNoIceCredentials) {
EXPECT_FALSE(callee->SetRemoteDescription(std::move(offer)));
}
// Test that doing an offer/answer exchange with no transport (i.e., no data
// channel or media) results in the ICE connection state staying at New.
TEST_P(PeerConnectionIceTest,
OfferAnswerWithNoTransportsDoesNotChangeIceConnectionState) {
auto caller = CreatePeerConnection();
auto callee = CreatePeerConnection();
ASSERT_TRUE(caller->ExchangeOfferAnswerWith(callee.get()));
EXPECT_EQ(PeerConnectionInterface::kIceConnectionNew,
caller->pc()->ice_connection_state());
EXPECT_EQ(PeerConnectionInterface::kIceConnectionNew,
callee->pc()->ice_connection_state());
}
// The following group tests that ICE candidates are not generated before
// SetLocalDescription is called on a PeerConnection.