Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit df65d0f

Browse files
authored
Fix an issue to prevent from lossing cached remote ICE candidates. (#412)
Cached remote ICE candidate can be added to PeerConnection when signaling state is 'have-remote-offer' when current endpoint is answerer, or 'stable' when current endpoint is offerer.
1 parent 5efcefd commit df65d0f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/sdk/p2p/peerconnection-channel.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -571,18 +571,18 @@ class P2PPeerConnectionChannel extends EventDispatcher {
571571

572572
_onSignalingStateChange(event) {
573573
Logger.debug('Signaling state changed: ' + this._pc.signalingState);
574-
if (this._pc.signalingState === 'closed') {
575-
// stopChatLocally(peer, peer.id);
576-
} else if (this._pc.signalingState === 'stable') {
574+
if (this._pc.signalingState === 'have-remote-offer' ||
575+
this._pc.signalingState === 'stable') {
576+
this._drainPendingRemoteIceCandidates();
577+
}
578+
if (this._pc.signalingState === 'stable') {
577579
this._negotiating = false;
578580
if (this._isNegotiationNeeded) {
579581
this._onNegotiationneeded();
580582
} else {
581583
this._drainPendingStreams();
582584
this._drainPendingMessages();
583585
}
584-
} else if (this._pc.signalingState === 'have-remote-offer') {
585-
this._drainPendingRemoteIceCandidates();
586586
}
587587
}
588588

0 commit comments

Comments
 (0)