Do not transition ICE gathering state to 'complete' when closing

Bug: webrtc:4728
Change-Id: I6bcb3dd0eb47dc945d96555f9481146f22ceb4fa
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/167440
Reviewed-by: Qingsi Wang <qingsi@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30433}
This commit is contained in:
Steve Anton 2020-01-24 14:53:37 -08:00 committed by Commit Bot
parent be99ee8f17
commit ec47b57f14
2 changed files with 9 additions and 4 deletions

View File

@ -4780,10 +4780,6 @@ void PeerConnection::ChangeSignalingState(
PeerConnectionInterface::IceConnectionState::kIceConnectionClosed;
connection_state_ = PeerConnectionInterface::PeerConnectionState::kClosed;
Observer()->OnConnectionChange(connection_state_);
if (ice_gathering_state_ != kIceGatheringComplete) {
ice_gathering_state_ = kIceGatheringComplete;
Observer()->OnIceGatheringChange(ice_gathering_state_);
}
}
Observer()->OnSignalingChange(signaling_state_);
}

View File

@ -1404,4 +1404,13 @@ TEST_P(PeerConnectionIceTest, IceCredentialsCreateAnswer) {
}
}
// Regression test for https://bugs.chromium.org/p/webrtc/issues/detail?id=4728
TEST_P(PeerConnectionIceTest, CloseDoesNotTransitionGatheringStateToComplete) {
auto pc = CreatePeerConnectionWithAudioVideo();
pc->pc()->Close();
EXPECT_FALSE(pc->IsIceGatheringDone());
EXPECT_EQ(PeerConnectionInterface::kIceGatheringNew,
pc->pc()->ice_gathering_state());
}
} // namespace webrtc