rtcpeerconnection
Advanced tools
Comparing version 3.0.12 to 3.0.13
{ | ||
"name": "rtcpeerconnection", | ||
"version": "3.0.12", | ||
"version": "3.0.13", | ||
"description": "A tiny browser module that normalizes and simplifies the API for WebRTC peer connections.", | ||
@@ -5,0 +5,0 @@ "main": "rtcpeerconnection.js", |
@@ -33,3 +33,4 @@ var util = require('util'); | ||
this.enableMultiStreamHacks = false; | ||
if (constraints && constraints.optional) { | ||
if (constraints && constraints.optional && | ||
webrtc.prefix === 'webkit') { | ||
constraints.optional.forEach(function (constraint, idx) { | ||
@@ -66,2 +67,14 @@ if (constraint.enableMultiStreamHacks) { | ||
// EXPERIMENTAL FLAG, might get removed without notice | ||
// this attemps to strip out candidates with an already known foundation | ||
// and type -- i.e. those which are gathered via the same TURN server | ||
// but different transports (TURN udp, tcp and tls respectively) | ||
if (constraints && constraints.optional && webrtc.prefix === 'webkit') { | ||
constraints.optional.forEach(function (constraint, idx) { | ||
if (constraint.andyetFasterICE) { | ||
self.eliminateDuplicateCandidates = constraint.andyetFasterICE; | ||
} | ||
}); | ||
} | ||
// EXPERIMENTAL FLAG, might get removed without notice | ||
this.assumeSetLocalSuccess = false; | ||
@@ -160,2 +173,4 @@ if (constraints && constraints.optional) { | ||
this._localDataChannels = []; | ||
this._relayCandidateBuffer = []; | ||
} | ||
@@ -282,3 +297,3 @@ | ||
var hasConstraints = arguments.length === 2; | ||
var mediaConstraints = hasConstraints ? constraints : { | ||
var mediaConstraints = hasConstraints && constraints ? constraints : { | ||
mandatory: { | ||
@@ -307,2 +322,3 @@ OfferToReceiveAudio: true, | ||
} | ||
self._relayCandidateBuffer = []; | ||
self.pc.setLocalDescription(offer, | ||
@@ -457,3 +473,3 @@ function () { | ||
var callback = hasConstraints ? cb : constraints; | ||
var mediaConstraints = hasConstraints ? constraints : { | ||
var mediaConstraints = hasConstraints && constraints ? constraints : { | ||
mandatory: { | ||
@@ -588,2 +604,3 @@ OfferToReceiveAudio: true, | ||
} | ||
self._relayCandidateBuffer = []; | ||
self.pc.setLocalDescription(answer, | ||
@@ -667,5 +684,25 @@ function () { | ||
var cand = SJJ.toCandidateJSON(ice.candidate); | ||
if (this.eliminateDuplicateCandidates && cand.type === 'relay') { | ||
// drop candidates with same foundation, component | ||
// take local type pref into account so we don't ignore udp | ||
// 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); | ||
// remember: local type pref of udp is 0, tcp 1, tls 2 | ||
if (idx > -1 && ((cand.priority >> 24) >= (already[idx].priority >> 24))) { | ||
// drop it, same foundation with higher (worse) type pref | ||
return; | ||
} | ||
this._relayCandidateBuffer.push(cand); | ||
} | ||
if (self.config.useJingle) { | ||
if (!ice.sdpMid) { // firefox doesn't set this | ||
ice.sdpMid = self.localDescription.contents[ice.sdpMLineIndex].name; | ||
if (self.pc.remoteDescription && self.pc.remoteDescription.type === 'offer') { | ||
// preserve name from remote | ||
ice.sdpMid = self.remoteDescription.contents[ice.sdpMLineIndex].name; | ||
} else { | ||
ice.sdpMid = self.localDescription.contents[ice.sdpMLineIndex].name; | ||
} | ||
} | ||
@@ -672,0 +709,0 @@ if (!self.config.ice[ice.sdpMid]) { |
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
206228
14
5607