rtcpeerconnection
Advanced tools
Comparing version 3.0.4 to 3.0.5
{ | ||
"name": "rtcpeerconnection", | ||
"version": "3.0.4", | ||
"version": "3.0.5", | ||
"description": "A tiny browser module that normalizes and simplifies the API for WebRTC peer connections.", | ||
@@ -5,0 +5,0 @@ "main": "rtcpeerconnection.js", |
@@ -48,2 +48,17 @@ var _ = require('underscore'); | ||
// EXPERIMENTAL FLAG, might get removed without notice | ||
// bundle up ice candidates, only works for jingle mode | ||
// number > 0 is the delay to wait for additional candidates | ||
// ~20ms seems good | ||
this.batchIceCandidates = 0; | ||
if (constraints && constraints.optional) { | ||
constraints.optional.forEach(function (constraint, idx) { | ||
if (constraint.andyetBatchIce) { | ||
self.batchIceCandidates = constraint.andyetBatchIce; | ||
} | ||
}); | ||
} | ||
this.batchedIceCandidates = []; | ||
this.pc = new peerconn(config, constraints); | ||
@@ -178,5 +193,5 @@ | ||
if (update.contents) { | ||
if (update.contents || (update.jingle && update.jingle.contents)) { | ||
var contentNames = _.pluck(this.remoteDescription.contents, 'name'); | ||
var contents = update.contents; | ||
var contents = update.contents || update.jingle.contents; | ||
@@ -209,3 +224,3 @@ contents.forEach(function (content) { | ||
// working around https://code.google.com/p/webrtc/issues/detail?id=3669 | ||
if (update.candidate.candidate.indexOf('a=') !== 0) { | ||
if (update.candidate && update.candidate.candidate.indexOf('a=') !== 0) { | ||
update.candidate.candidate = 'a=' + update.candidate.candidate; | ||
@@ -579,2 +594,3 @@ } | ||
}; | ||
this._checkLocalCandidate(ice.candidate); | ||
@@ -615,4 +631,28 @@ var cand = SJJ.toCandidateJSON(ice.candidate); | ||
}; | ||
if (self.batchIceCandidates > 0) { | ||
if (self.batchedIceCandidates.length === 0) { | ||
window.setTimeout(function () { | ||
var contents = {}; | ||
self.batchedIceCandidates.forEach(function (content) { | ||
content = content.contents[0]; | ||
if (!contents[content.name]) contents[content.name] = content; | ||
contents[content.name].transport.candidates.push(content.transport.candidates[0]); | ||
}); | ||
var newCand = { | ||
jingle: { | ||
contents: [] | ||
} | ||
}; | ||
Object.keys(contents).forEach(function (name) { | ||
newCand.jingle.contents.push(contents[name]); | ||
}); | ||
self.batchedIceCandidates = []; | ||
self.emit('ice', newCand); | ||
}, self.batchIceCandidates); | ||
} | ||
self.batchedIceCandidates.push(expandedCandidate.jingle); | ||
return; | ||
} | ||
} | ||
this._checkLocalCandidate(ice.candidate); | ||
this.emit('ice', expandedCandidate); | ||
@@ -619,0 +659,0 @@ } else { |
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
175927
13
4651