onIceCandidate_(event) {
    if (event.candidate) {
      this.numIceCandidatesReceived_++;
      this.lastIceCandidateTime_ = Date.now();
      if (this.numIceCandidatesReceived_ == 1) {
        // This is the first ICE candidate.  Set a timer to abort gathering
        // candidates.  This is needed because sometimes the end of ICE
        // candidate
        // gathering is not detected right away even though all candidates have
        // been gathered.
        mr.Assertions.assert(this.iceCandidateGatheringTimerId_ == null);
        this.iceCandidateGatheringTimerId_ = setTimeout(() => {
          this.logger_.info('ICE candidate gathering timed out.');
          this.iceCandidateGatheringTimerId_ = null;
          this.resolveSessionDescription_();
        }, PeerConnection.ICE_CANDIDATE_GATHERING_TIMEOUT_MS_);
      } else if (this.sessionDescriptionResolved_) {
        // This branch runs when additional ICE candidates are reported after
        // the timeout above fires.
        this.logger_.warning(
            'Received ICE candidate after resolving session description.');
      }
    } else {
      this.logger_.info('End of ICE candidates.');
      mr.webrtc.PeerConnectionAnalytics
          .recordIceCandidateGatheringReportedDuration(
              Date.now() - this.offerCreationTime_);

      // This is a no-op if the timout above has already fired.
      this.resolveSessionDescription_();

      // Record the true duration of candidate gathering based on the time the
      // last candidate was reported.  Don't record anything if no candidates
      // were
      // found, because the computed duration will be invalid.
      if (this.numIceCandidatesReceived_ > 0) {
        mr.webrtc.PeerConnectionAnalytics
            .recordIceCandidateGatheringRealDuration(
                this.lastIceCandidateTime_ - this.offerCreationTime_);
      }
    }
  }
/**
   * Resolves the session description once all ice candidates have been
   * received.
   * @param {RTCPeerConnectionIceEvent} event The ICE candidate event.
   * @private
   */
Resolves the session description once all ice candidates have been
received.
@param {RTCPeerConnectionIceEvent} event The ICE candidate event.
@private
Resolves the session description once all ice candidates have been received . @param { RTCPeerConnectionIceEvent } event The ICE candidate event . @private
onIceCandidate_(event) {
    if (event.candidate) {
      this.numIceCandidatesReceived_++;
      this.lastIceCandidateTime_ = Date.now();
      if (this.numIceCandidatesReceived_ == 1) {
        mr.Assertions.assert(this.iceCandidateGatheringTimerId_ == null);
        this.iceCandidateGatheringTimerId_ = setTimeout(() => {
          this.logger_.info('ICE candidate gathering timed out.');
          this.iceCandidateGatheringTimerId_ = null;
          this.resolveSessionDescription_();
        }, PeerConnection.ICE_CANDIDATE_GATHERING_TIMEOUT_MS_);
      } else if (this.sessionDescriptionResolved_) {
        this.logger_.warning(
            'Received ICE candidate after resolving session description.');
      }
    } else {
      this.logger_.info('End of ICE candidates.');
      mr.webrtc.PeerConnectionAnalytics
          .recordIceCandidateGatheringReportedDuration(
              Date.now() - this.offerCreationTime_);
      this.resolveSessionDescription_();
      if (this.numIceCandidatesReceived_ > 0) {
        mr.webrtc.PeerConnectionAnalytics
            .recordIceCandidateGatheringRealDuration(
                this.lastIceCandidateTime_ - this.offerCreationTime_);
      }
    }
  }
onIceCandidate_ ( event ) { if ( event . candidate ) { this . numIceCandidatesReceived_ ++ ; this . lastIceCandidateTime_ = Date . now ( ) ; if ( this . numIceCandidatesReceived_ == 1 ) { mr . Assertions . assert ( this . iceCandidateGatheringTimerId_ == null ) ; this . iceCandidateGatheringTimerId_ = setTimeout ( ( ) => { this . logger_ . info ( 'ICE candidate gathering timed out.' ) ; this . iceCandidateGatheringTimerId_ = null ; this . resolveSessionDescription_ ( ) ; } , PeerConnection . ICE_CANDIDATE_GATHERING_TIMEOUT_MS_ ) ; } else if ( this . sessionDescriptionResolved_ ) { this . logger_ . warning ( 'Received ICE candidate after resolving session description.' ) ; } } else { this . logger_ . info ( 'End of ICE candidates.' ) ; mr . webrtc . PeerConnectionAnalytics . recordIceCandidateGatheringReportedDuration ( Date . now ( ) - this . offerCreationTime_ ) ; this . resolveSessionDescription_ ( ) ; if ( this . numIceCandidatesReceived_ > 0 ) { mr . webrtc . PeerConnectionAnalytics . recordIceCandidateGatheringRealDuration ( this . lastIceCandidateTime_ - this . offerCreationTime_ ) ; } } }
Resolves the session description once all ice candidates have been
 received.
Resolves the session description once all ice candidates have been received .
// This is the first ICE candidate.  Set a timer to abort gathering // candidates.  This is needed because sometimes the end of ICE // candidate // gathering is not detected right away even though all candidates have // been gathered. // This branch runs when additional ICE candidates are reported after // the timeout above fires. // This is a no-op if the timout above has already fired. // Record the true duration of candidate gathering based on the time the // last candidate was reported.  Don't record anything if no candidates // were // found, because the computed duration will be invalid.