Simplifies code.

This commit is contained in:
Boris Grozev 2014-10-13 12:36:19 +03:00
parent c5ce510da5
commit ea93bc6f41
1 changed files with 42 additions and 41 deletions

View File

@ -662,7 +662,12 @@ ColibriFocus.prototype.initiate = function (peer, isInitiator) {
var participant = this.peers.indexOf(peer);
console.log('tell', peer, participant);
var sdp;
if (this.peerconnection !== null && this.peerconnection.signalingState == 'stable') {
if (!(this.peerconnection !== null && this.peerconnection.signalingState == 'stable')) {
console.error('can not initiate a new session without a stable peerconnection');
return;
}
sdp = new SDP(this.peerconnection.remoteDescription.sdp);
var localSDP = new SDP(this.peerconnection.localDescription.sdp);
// throw away stuff we don't want
@ -703,10 +708,6 @@ ColibriFocus.prototype.initiate = function (peer, isInitiator) {
}
}
sdp.raw = sdp.session + sdp.media.join('');
} else {
console.error('can not initiate a new session without a stable peerconnection');
return;
}
// add stuff we got from the bridge
for (var j = 0; j < sdp.media.length; j++) {