Transition ICE gathering state to "new" once all transports go away

Bug: chromium:1115080
Change-Id: I524ed48ffc2520ce21ad4bdc25fa3b86d9e41af5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/182081
Reviewed-by: Guido Urdaneta <guidou@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31976}
This commit is contained in:
Harald Alvestrand 2020-08-20 14:50:10 +02:00 committed by Commit Bot
parent 1d7a3fe6ed
commit bedb605c82
3 changed files with 34 additions and 1 deletions

View File

@ -1381,7 +1381,10 @@ void JsepTransportController::UpdateAggregateStates_n() {
});
}
if (all_done_gathering) {
// Compute the gathering state.
if (dtls_transports.empty()) {
new_gathering_state = cricket::kIceGatheringNew;
} else if (all_done_gathering) {
new_gathering_state = cricket::kIceGatheringComplete;
} else if (any_gathering) {
new_gathering_state = cricket::kIceGatheringGathering;

View File

@ -7024,6 +7024,11 @@ void PeerConnection::OnTransportControllerGatheringState(
OnIceGatheringChange(PeerConnectionInterface::kIceGatheringGathering);
} else if (state == cricket::kIceGatheringComplete) {
OnIceGatheringChange(PeerConnectionInterface::kIceGatheringComplete);
} else if (state == cricket::kIceGatheringNew) {
OnIceGatheringChange(PeerConnectionInterface::kIceGatheringNew);
} else {
RTC_LOG(LS_ERROR) << "Unknown state received: " << state;
RTC_NOTREACHED();
}
}

View File

@ -5574,6 +5574,31 @@ TEST_F(PeerConnectionIntegrationTestUnifiedPlan,
}
}
TEST_F(PeerConnectionIntegrationTestUnifiedPlan,
StopTransceiverRemovesDtlsTransports) {
RTCConfiguration config;
ASSERT_TRUE(CreatePeerConnectionWrappersWithConfig(config, config));
ConnectFakeSignaling();
auto audio_transceiver_or_error =
caller()->pc()->AddTransceiver(caller()->CreateLocalAudioTrack());
ASSERT_TRUE(audio_transceiver_or_error.ok());
auto audio_transceiver = audio_transceiver_or_error.MoveValue();
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
audio_transceiver->StopStandard();
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
ASSERT_EQ(0U, caller()->pc()->GetTransceivers().size());
EXPECT_EQ(PeerConnectionInterface::kIceGatheringNew,
caller()->pc()->ice_gathering_state());
EXPECT_THAT(caller()->ice_gathering_state_history(),
ElementsAre(PeerConnectionInterface::kIceGatheringGathering,
PeerConnectionInterface::kIceGatheringComplete,
PeerConnectionInterface::kIceGatheringNew));
}
#ifdef HAVE_SCTP
TEST_F(PeerConnectionIntegrationTestUnifiedPlan,