Restore the behavior where an ICE restart redetermines the ICE role.
We thought we could safely remove this, but older versions of Chrome
don't do role conflict resolution properly, so it's actually not safe
to yet.
BUG=628676
Review-Url: https://codereview.webrtc.org/2152963003
Cr-Commit-Position: refs/heads/master@{#13492}
diff --git a/webrtc/p2p/base/transportcontroller.cc b/webrtc/p2p/base/transportcontroller.cc
index 2860f87..b5021cc 100644
--- a/webrtc/p2p/base/transportcontroller.cc
+++ b/webrtc/p2p/base/transportcontroller.cc
@@ -446,6 +446,21 @@
return true;
}
+ // Older versions of Chrome expect the ICE role to be re-determined when an
+ // ICE restart occurs, and also don't perform conflict resolution correctly,
+ // so for now we can't safely stop doing this.
+ // See: https://bugs.chromium.org/p/chromium/issues/detail?id=628676
+ // TODO(deadbeef): Remove this when these old versions of Chrome reach a low
+ // enough population.
+ if (transport->local_description() &&
+ IceCredentialsChanged(transport->local_description()->ice_ufrag,
+ transport->local_description()->ice_pwd,
+ tdesc.ice_ufrag, tdesc.ice_pwd)) {
+ IceRole new_ice_role =
+ (action == CA_OFFER) ? ICEROLE_CONTROLLING : ICEROLE_CONTROLLED;
+ SetIceRole(new_ice_role);
+ }
+
return transport->SetLocalTransportDescription(tdesc, action, err);
}