Reinstate old iceConnectionState "completed" behavior
The old iceConnectionState only becomes completed on the controlling side, and only if we're not configured to continually gather ICE candidates. This change makes the new ICE connection state do the same thing. Bug: webrtc:10356 Change-Id: I82ca854a638a52674e4ca43364cf454dacb0cf1e Reviewed-on: https://webrtc-review.googlesource.com/c/124360 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org> Cr-Commit-Position: refs/heads/master@{#26950}
This commit is contained in:
@ -1401,9 +1401,14 @@ void JsepTransportController::UpdateAggregateStates_n() {
|
||||
// None of the previous states apply and any RTCIceTransports are in the
|
||||
// "new" or "checking" state.
|
||||
new_ice_connection_state = PeerConnectionInterface::kIceConnectionChecking;
|
||||
} else if (total_ice_completed + total_ice_closed == total_ice) {
|
||||
} else if (total_ice_completed + total_ice_closed == total_ice ||
|
||||
all_completed) {
|
||||
// None of the previous states apply and all RTCIceTransports are in the
|
||||
// "completed" or "closed" state.
|
||||
//
|
||||
// TODO(https://bugs.webrtc.org/10356): The all_completed condition is added
|
||||
// to mimic the behavior of the old ICE connection state, and should be
|
||||
// removed once we get end-of-candidates signaling in place.
|
||||
new_ice_connection_state = PeerConnectionInterface::kIceConnectionCompleted;
|
||||
} else if (total_ice_connected + total_ice_completed + total_ice_closed ==
|
||||
total_ice) {
|
||||
@ -1415,6 +1420,16 @@ void JsepTransportController::UpdateAggregateStates_n() {
|
||||
}
|
||||
|
||||
if (standardized_ice_connection_state_ != new_ice_connection_state) {
|
||||
if (standardized_ice_connection_state_ ==
|
||||
PeerConnectionInterface::kIceConnectionChecking &&
|
||||
new_ice_connection_state ==
|
||||
PeerConnectionInterface::kIceConnectionCompleted) {
|
||||
// Ensure that we never skip over the "connected" state.
|
||||
invoker_.AsyncInvoke<void>(RTC_FROM_HERE, signaling_thread_, [this] {
|
||||
SignalStandardizedIceConnectionState(
|
||||
PeerConnectionInterface::kIceConnectionConnected);
|
||||
});
|
||||
}
|
||||
standardized_ice_connection_state_ = new_ice_connection_state;
|
||||
invoker_.AsyncInvoke<void>(
|
||||
RTC_FROM_HERE, signaling_thread_, [this, new_ice_connection_state] {
|
||||
|
||||
@ -281,6 +281,13 @@ class PeerConnectionWrapper : public webrtc::PeerConnectionObserver,
|
||||
ice_connection_state_history_.clear();
|
||||
}
|
||||
|
||||
// Every standardized ICE connection state in order that has been seen by the
|
||||
// observer.
|
||||
std::vector<PeerConnectionInterface::IceConnectionState>
|
||||
standardized_ice_connection_state_history() const {
|
||||
return standardized_ice_connection_state_history_;
|
||||
}
|
||||
|
||||
// Every PeerConnection state in order that has been seen by the observer.
|
||||
std::vector<PeerConnectionInterface::PeerConnectionState>
|
||||
peer_connection_state_history() const {
|
||||
@ -894,6 +901,10 @@ class PeerConnectionWrapper : public webrtc::PeerConnectionObserver,
|
||||
EXPECT_EQ(pc()->ice_connection_state(), new_state);
|
||||
ice_connection_state_history_.push_back(new_state);
|
||||
}
|
||||
void OnStandardizedIceConnectionChange(
|
||||
webrtc::PeerConnectionInterface::IceConnectionState new_state) override {
|
||||
standardized_ice_connection_state_history_.push_back(new_state);
|
||||
}
|
||||
void OnConnectionChange(
|
||||
webrtc::PeerConnectionInterface::PeerConnectionState new_state) override {
|
||||
peer_connection_state_history_.push_back(new_state);
|
||||
@ -981,6 +992,8 @@ class PeerConnectionWrapper : public webrtc::PeerConnectionObserver,
|
||||
|
||||
std::vector<PeerConnectionInterface::IceConnectionState>
|
||||
ice_connection_state_history_;
|
||||
std::vector<PeerConnectionInterface::IceConnectionState>
|
||||
standardized_ice_connection_state_history_;
|
||||
std::vector<PeerConnectionInterface::PeerConnectionState>
|
||||
peer_connection_state_history_;
|
||||
std::vector<PeerConnectionInterface::IceGatheringState>
|
||||
@ -3928,7 +3941,7 @@ TEST_P(PeerConnectionIntegrationIceStatesTest, VerifyIceStates) {
|
||||
|
||||
ASSERT_EQ(PeerConnectionInterface::kIceConnectionCompleted,
|
||||
caller()->ice_connection_state());
|
||||
ASSERT_EQ(PeerConnectionInterface::kIceConnectionConnected,
|
||||
ASSERT_EQ(PeerConnectionInterface::kIceConnectionCompleted,
|
||||
caller()->standardized_ice_connection_state());
|
||||
|
||||
// Verify that the observer was notified of the intermediate transitions.
|
||||
@ -3936,6 +3949,10 @@ TEST_P(PeerConnectionIntegrationIceStatesTest, VerifyIceStates) {
|
||||
ElementsAre(PeerConnectionInterface::kIceConnectionChecking,
|
||||
PeerConnectionInterface::kIceConnectionConnected,
|
||||
PeerConnectionInterface::kIceConnectionCompleted));
|
||||
EXPECT_THAT(caller()->standardized_ice_connection_state_history(),
|
||||
ElementsAre(PeerConnectionInterface::kIceConnectionChecking,
|
||||
PeerConnectionInterface::kIceConnectionConnected,
|
||||
PeerConnectionInterface::kIceConnectionCompleted));
|
||||
EXPECT_THAT(
|
||||
caller()->peer_connection_state_history(),
|
||||
ElementsAre(PeerConnectionInterface::PeerConnectionState::kConnecting,
|
||||
@ -3963,7 +3980,7 @@ TEST_P(PeerConnectionIntegrationIceStatesTest, VerifyIceStates) {
|
||||
ASSERT_EQ_SIMULATED_WAIT(PeerConnectionInterface::kIceConnectionCompleted,
|
||||
caller()->ice_connection_state(), kDefaultTimeout,
|
||||
fake_clock);
|
||||
ASSERT_EQ_SIMULATED_WAIT(PeerConnectionInterface::kIceConnectionConnected,
|
||||
ASSERT_EQ_SIMULATED_WAIT(PeerConnectionInterface::kIceConnectionCompleted,
|
||||
caller()->standardized_ice_connection_state(),
|
||||
kDefaultTimeout, fake_clock);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user