Bug 1290049 - only process ice connection state change if new state differs from old state. r=bwc a=ritu
authorMichael Froman <mfroman@mozilla.com>
Tue, 11 Oct 2016 22:14:23 -0500
changeset 350750 8ebdcfa6203a25d4c8d8a73daa3342f6a64c1090
parent 350749 9f719285cd161a538446d0601162b474914e8a14
child 350751 0cf671e08f5c41c82aa9930dd5084699683d0901
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbwc, ritu
bugs1290049
milestone50.0
Bug 1290049 - only process ice connection state change if new state differs from old state. r=bwc a=ritu 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
@@ -3270,16 +3270,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)) {