rtcpeerconnection
Advanced tools
Comparing version 3.0.13 to 3.0.14
{ | ||
"name": "rtcpeerconnection", | ||
"version": "3.0.13", | ||
"version": "3.0.14", | ||
"description": "A tiny browser module that normalizes and simplifies the API for WebRTC peer connections.", | ||
@@ -5,0 +5,0 @@ "main": "rtcpeerconnection.js", |
@@ -76,3 +76,14 @@ var util = require('util'); | ||
} | ||
// EXPERIMENTAL FLAG, might get removed without notice | ||
// when using a server such as the jitsi videobridge we don't need to signal | ||
// our candidates | ||
if (constraints && constraints.optional) { | ||
constraints.optional.forEach(function (constraint, idx) { | ||
if (constraint.andyetDontSignalCandidates) { | ||
self.dontSignalCandidates = constraint.andyetDontSignalCandidates; | ||
} | ||
}); | ||
} | ||
// EXPERIMENTAL FLAG, might get removed without notice | ||
@@ -173,3 +184,3 @@ this.assumeSetLocalSuccess = false; | ||
this._relayCandidateBuffer = []; | ||
this._candidateBuffer = []; | ||
} | ||
@@ -320,3 +331,3 @@ | ||
} | ||
self._relayCandidateBuffer = []; | ||
self._candidateBuffer = []; | ||
self.pc.setLocalDescription(offer, | ||
@@ -601,3 +612,3 @@ function () { | ||
} | ||
self._relayCandidateBuffer = []; | ||
self._candidateBuffer = []; | ||
self.pc.setLocalDescription(answer, | ||
@@ -669,2 +680,3 @@ function () { | ||
if (event.candidate) { | ||
if (this.dontSignalCandidates) return; | ||
var ice = event.candidate; | ||
@@ -682,2 +694,5 @@ | ||
var cand = SJJ.toCandidateJSON(ice.candidate); | ||
var already; | ||
var idx; | ||
if (this.eliminateDuplicateCandidates && cand.type === 'relay') { | ||
@@ -687,6 +702,10 @@ // drop candidates with same foundation, component | ||
// ones when we know about a TCP one. unlikely but... | ||
var already = this._relayCandidateBuffer.map(function (c) { | ||
return c.foundation + ':' + c.component; | ||
}); | ||
var idx = already.indexOf(cand.foundation + ':' + cand.component); | ||
already = this._candidateBuffer.filter( | ||
function (c) { | ||
return c.type === 'relay'; | ||
}).map(function (c) { | ||
return c.foundation + ':' + c.component; | ||
} | ||
); | ||
idx = already.indexOf(cand.foundation + ':' + cand.component); | ||
// remember: local type pref of udp is 0, tcp 1, tls 2 | ||
@@ -697,4 +716,23 @@ if (idx > -1 && ((cand.priority >> 24) >= (already[idx].priority >> 24))) { | ||
} | ||
this._relayCandidateBuffer.push(cand); | ||
} | ||
if (this.config.bundlePolicy === 'max-bundle') { | ||
// drop candidates which are duplicate for audio/video/data | ||
// duplicate means same host/port but different sdpMid | ||
already = this._candidateBuffer.filter( | ||
function (c) { | ||
return cand.type === c.type; | ||
}).map(function (cand) { | ||
return cand.address + ':' + cand.port; | ||
} | ||
); | ||
idx = already.indexOf(cand.address + ':' + cand.port); | ||
if (idx > -1) return; | ||
} | ||
// also drop rtcp candidates since we know the peer supports RTCP-MUX | ||
// this is a workaround until browsers implement this natively | ||
if (this.config.rtcpMuxPolicy === 'require' && cand.component === '2') { | ||
return; | ||
} | ||
this._candidateBuffer.push(cand); | ||
if (self.config.useJingle) { | ||
@@ -701,0 +739,0 @@ if (!ice.sdpMid) { // firefox doesn't set this |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
209140
5677