rtcpeerconnection
Advanced tools
Comparing version 2.6.2 to 2.6.3
{ | ||
"name": "rtcpeerconnection", | ||
"version": "2.6.2", | ||
"version": "2.6.3", | ||
"description": "A tiny browser module that normalizes and simplifies the API for WebRTC peer connections.", | ||
@@ -5,0 +5,0 @@ "main": "rtcpeerconnection.js", |
@@ -16,2 +16,14 @@ var _ = require('underscore'); | ||
// make sure this only gets enabled in Google Chrome | ||
this.enableChromeNativeSimulcast = false; | ||
if (constraints && constraints.optional && | ||
webrtc.prefix === 'webkit' && | ||
navigator.appVersion.match(/Chromium\//) === null) { | ||
constraints.optional.forEach(function (constraint, idx) { | ||
if (constraint.enableChromeNativeSimulcast) { | ||
self.enableChromeNativeSimulcast = true; | ||
} | ||
}); | ||
} | ||
this.pc = new peerconn(config, constraints); | ||
@@ -237,2 +249,9 @@ | ||
if (offer.jingle) { | ||
if (this.enableChromeNativeSimulcast) { | ||
offer.jingle.contents.forEach(function (content) { | ||
if (content.name === 'video') { | ||
content.description.googConferenceFlag = true; | ||
} | ||
}); | ||
} | ||
offer.sdp = SJJ.toSessionSDP(offer.jingle, self.config.sdpSessionID); | ||
@@ -318,28 +337,27 @@ self.remoteDescription = offer.jingle; | ||
} | ||
// make sure this only gets enabled in Google Chrome | ||
var enableChromeNativeSimulcast = (constraints.enableChromeNativeSimulcast && | ||
webrtc.prefix === 'webkit' && | ||
navigator.appVersion.match(/Chromium\//) === null) || false; | ||
delete constraints.enableChromeNativeSimulcast; | ||
self.pc.createAnswer( | ||
function (answer) { | ||
var sim = []; | ||
if (enableChromeNativeSimulcast) { | ||
if (self.enableChromeNativeSimulcast) { | ||
// native simulcast part 1: add another SSRC | ||
answer.jingle = SJJ.toSessionJSON(answer.sdp); | ||
if (answer.jingle.contents.length >= 2 && answer.jingle.contents[1].name === 'video') { | ||
var newssrc = JSON.parse(JSON.stringify(answer.jingle.contents[1].description.sources[0])); | ||
newssrc.ssrc = '' + Math.floor(Math.random() * 0xffffffff); // FIXME: look for conflicts | ||
answer.jingle.contents[1].description.sources.push(newssrc); | ||
var hasSimgroup = false; | ||
var groups = answer.jingle.contents[1].description.sourceGroups || []; | ||
if (groups.length === 0) { // FIXME: should check for SIM group exist | ||
var newssrc = JSON.parse(JSON.stringify(answer.jingle.contents[1].description.sources[0])); | ||
newssrc.ssrc = '' + Math.floor(Math.random() * 0xffffffff); // FIXME: look for conflicts | ||
answer.jingle.contents[1].description.sources.push(newssrc); | ||
answer.jingle.contents[1].description.sources.forEach(function (source) { | ||
sim.push(source.ssrc); | ||
}); | ||
answer.jingle.contents[1].description.sourceGroups = [ | ||
{ | ||
semantics: 'SIM', | ||
sources: sim | ||
} | ||
]; | ||
answer.sdp = SJJ.toSessionSDP(answer.jingle, self.config.sdpSessionID); | ||
answer.jingle.contents[1].description.sources.forEach(function (source) { | ||
sim.push(source.ssrc); | ||
}); | ||
answer.jingle.contents[1].description.sourceGroups = [ | ||
{ | ||
semantics: 'SIM', | ||
sources: sim | ||
} | ||
]; | ||
answer.sdp = SJJ.toSessionSDP(answer.jingle, self.config.sdpSessionID); | ||
} | ||
} | ||
@@ -359,3 +377,3 @@ } | ||
} | ||
if (enableChromeNativeSimulcast) { | ||
if (self.enableChromeNativeSimulcast) { | ||
// native simulcast part 2: | ||
@@ -362,0 +380,0 @@ // signal multiple tracks to the receiver |
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
153798
4051