Bug 1290049 - only process ice connection state change if new state differs from old state. r=bwc draft
authorMichael Froman <mfroman@mozilla.com>
Tue, 11 Oct 2016 22:14:23 -0500
changeset 425394 18244caa318b8bccd969cd50069265b467477f26
parent 425306 cb2dd5a34dd7b374500fedd72fe19df13c9a7a4d
child 533918 381f27be7c1a3f9ccc296be48e699677378bd55e
push id32422
push userbmo:mfroman@nostrum.com
push dateFri, 14 Oct 2016 18:14:17 +0000
reviewersbwc
bugs1290049
milestone52.0a1
Bug 1290049 - only process ice connection state change if new state differs from old state. r=bwc MozReview-Commit-ID: KAM1XVIn4Qw
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -3407,16 +3407,21 @@ static bool isFailed(PCImplIceConnection
 void PeerConnectionImpl::IceConnectionStateChange(
     NrIceCtx* ctx,
     NrIceCtx::ConnectionState state) {
   PC_AUTO_ENTER_API_CALL_VOID_RETURN(false);
 
   CSFLogDebug(logTag, "%s", __FUNCTION__);
 
   auto domState = toDomIceConnectionState(state);
+  if (domState == mIceConnectionState) {
+    // no work to be done since the states are the same.
+    // this can happen during ICE rollback situations.
+    return;
+  }
 
 #if !defined(MOZILLA_EXTERNAL_LINKAGE)
   if (!isDone(mIceConnectionState) && isDone(domState)) {
     // mIceStartTime can be null if going directly from New to Closed, in which
     // case we don't count it as a success or a failure.
     if (!mIceStartTime.IsNull()){
       TimeDuration timeDelta = TimeStamp::Now() - mIceStartTime;
       if (isSucceeded(domState)) {