Bug 1290049 - only process ice connection state change if new state differs from old state. r=bwc
MozReview-Commit-ID: KAM1XVIn4Qw
--- 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)) {