Socket
Socket
Sign inDemoInstall

rtcpeerconnection

Package Overview
Dependencies
Maintainers
4
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rtcpeerconnection - npm Package Compare versions

Comparing version 2.6.5 to 2.6.6

2

package.json
{
"name": "rtcpeerconnection",
"version": "2.6.5",
"version": "2.6.6",
"description": "A tiny browser module that normalizes and simplifies the API for WebRTC peer connections.",

@@ -5,0 +5,0 @@ "main": "rtcpeerconnection.js",

@@ -129,3 +129,31 @@ var _ = require('underscore');

// helper function to check if a remote candidate is a stun/relay
// candidate or an ipv6 candidate
PeerConnection.prototype._checkLocalCandidate = function (candidate) {
var cand = SJJ.toCandidateJSON(candidate);
if (cand.type == 'srflx') {
this.hadLocalStunCandidate = true;
} else if (cand.type == 'relay') {
this.hadLocalRelayCandidate = true;
}
if (cand.ip.indexOf(':') != -1) {
this.hadLocalIPv6Candidate = true;
}
};
// helper function to check if a remote candidate is a stun/relay
// candidate or an ipv6 candidate
PeerConnection.prototype._checkRemoteCandidate = function (candidate) {
var cand = SJJ.toCandidateJSON(candidate);
if (cand.type == 'srflx') {
this.hadRemoteStunCandidate = true;
} else if (cand.type == 'relay') {
this.hadRemoteRelayCandidate = true;
}
if (cand.ip.indexOf(':') != -1) {
this.hadRemoteIPv6Candidate = true;
}
};
// Init and add ice candidate object with correct constructor

@@ -163,10 +191,3 @@ PeerConnection.prototype.processIce = function (update, cb) {

);
if (candidate.type === 'srflx') {
self.hadRemoteStunCandidate = true;
} else if (candidate.type === 'relay') {
self.hadRemoteRelayCandidate = true;
}
if (candidate.ip.indexOf(':') != -1) {
self.hadRemoteIPv6Candidate = true;
}
self._checkRemoteCandidate(iceCandidate);
});

@@ -181,11 +202,3 @@ });

self.pc.addIceCandidate(new webrtc.IceCandidate(update.candidate));
var cand = SJJ.toCandidateJSON(update.candidate.candidate);
if (cand.type == 'srflx') {
self.hadRemoteStunCandidate = true;
} else if (cand.type == 'relay') {
self.hadRemoteRelayCandidate = true;
}
if (cand.ip.indexOf(':') != -1) {
self.hadRemoteIPv6Candidate = true;
}
self._checkRemoteCandidate(update.candidate.candidate);
}

@@ -236,2 +249,7 @@ cb();

}
expandedOffer.sdp.split('\r\n').forEach(function (line) {
if (line.indexOf('a=candidate:') === 0) {
self._checkLocalCandidate(line);
}
});

@@ -270,2 +288,3 @@ self.emit('offer', expandedOffer);

}
/*
if (this.enableMultiStreamHacks) {

@@ -295,8 +314,17 @@ // add a mixed video stream as first stream

}
*/
offer.sdp = SJJ.toSessionSDP(offer.jingle, self.config.sdpSessionID);
self.remoteDescription = offer.jingle;
}
self.pc.setRemoteDescription(new webrtc.SessionDescription(offer), function () {
cb();
}, cb);
offer.sdp.split('\r\n').forEach(function (line) {
if (line.indexOf('a=candidate:') === 0) {
self._checkRemoteCandidate(line);
}
});
self.pc.setRemoteDescription(new webrtc.SessionDescription(offer),
function () {
cb();
},
cb
);
};

@@ -349,2 +377,7 @@

}
answer.sdp.split('\r\n').forEach(function (line) {
if (line.indexOf('a=candidate:') === 0) {
self._checkRemoteCandidate(line);
}
});
self.pc.setRemoteDescription(

@@ -380,2 +413,3 @@ new webrtc.SessionDescription(answer),

var sim = [];
var rtx = [];
if (self.enableChromeNativeSimulcast) {

@@ -387,3 +421,7 @@ // native simulcast part 1: add another SSRC

var groups = answer.jingle.contents[1].description.sourceGroups || [];
if (groups.length === 0 && // FIXME: should check for SIM group exist
var hasSim = false;
groups.forEach(function (group) {
if (group.semantics == 'SIM') hasSim = true;
});
if (!hasSim &&
answer.jingle.contents[1].description.sources.length) {

@@ -394,11 +432,19 @@ var newssrc = JSON.parse(JSON.stringify(answer.jingle.contents[1].description.sources[0]));

answer.jingle.contents[1].description.sources.forEach(function (source) {
sim.push(source.ssrc);
sim.push(answer.jingle.contents[1].description.sources[0].ssrc);
sim.push(newssrc.ssrc);
groups.push({
semantics: 'SIM',
sources: sim
});
answer.jingle.contents[1].description.sourceGroups = [
{
semantics: 'SIM',
sources: sim
}
];
// also create an RTX one for the SIM one
var rtxssrc = JSON.parse(JSON.stringify(newssrc));
rtxssrc.ssrc = '' + Math.floor(Math.random() * 0xffffffff); // FIXME: look for conflicts
answer.jingle.contents[1].description.sources.push(rtxssrc);
groups.push({
semantics: 'FID',
sources: [newssrc.ssrc, rtxssrc.ssrc]
});
answer.jingle.contents[1].description.sourceGroups = groups;
answer.sdp = SJJ.toSessionSDP(answer.jingle, self.config.sdpSessionID);

@@ -423,17 +469,24 @@ }

// signal multiple tracks to the receiver
// for anything in the SIM group
if (!expandedAnswer.jingle) {
expandedAnswer.jingle = SJJ.toSessionJSON(answer.sdp);
}
var groups = expandedAnswer.jingle.contents[1].description.sourceGroups || [];
expandedAnswer.jingle.contents[1].description.sources.forEach(function (source, idx) {
if (sim.indexOf(source.ssrc) != -1) {
source.parameters = source.parameters.map(function (parameter) {
if (parameter.key === 'msid') {
parameter.value += '-' + idx;
}
return parameter;
});
}
// the floor idx/2 is a hack that relies on a particular order
// of groups, alternating between sim and rtx
source.parameters = source.parameters.map(function (parameter) {
if (parameter.key === 'msid') {
parameter.value += '-' + Math.floor(idx / 2);
}
return parameter;
});
});
expandedAnswer.sdp = SJJ.toSessionSDP(expandedAnswer.jingle);
}
expandedAnswer.sdp.split('\r\n').forEach(function (line) {
if (line.indexOf('a=candidate:') === 0) {
self._checkLocalCandidate(line);
}
});
self.emit('answer', expandedAnswer);

@@ -498,11 +551,3 @@ cb(null, expandedAnswer);

}
if (cand.type === 'srflx') {
this.hadLocalStunCandidate = true;
} else if (cand.type == 'relay') {
this.hadLocalRelayCandidate = true;
}
if (cand.ip.indexOf(':') != -1) {
self.hadLocalIPv6Candidate = true;
}
this._checkLocalCandidate(ice.candidate);
this.emit('ice', expandedCandidate);

@@ -547,5 +592,7 @@ } else {

var items = [];
res.forEach(function (result) {
items.push(result);
});
for (var result in res) {
if (typeof res[result] === 'object') {
items.push(res[result]);
}
}
cb(null, items);

@@ -552,0 +599,0 @@ },

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc