Removes misleading documentation. Formatting fixes.

This commit is contained in:
Boris Grozev 2015-09-09 14:09:58 -05:00
parent e13af70717
commit 68421465a7
2 changed files with 21 additions and 22 deletions

View File

@ -1,14 +1,14 @@
var SDPUtil = require("./SDPUtil"); var SDPUtil = require("./SDPUtil");
function SDPDiffer(mySDP, otherSDP) { function SDPDiffer(mySDP, otherSDP)
{
this.mySDP = mySDP; this.mySDP = mySDP;
this.otherSDP = otherSDP; this.otherSDP = otherSDP;
} }
/** /**
* Returns map of MediaChannel that contains only media not contained in <tt>otherSdp</tt>. Mapped by channel idx. * Returns map of MediaChannel that contains media contained in
* @param otherSdp the other SDP to check ssrc with. * 'mySDP', but not contained in 'otherSdp'. Mapped by channel idx.
*/ */
SDPDiffer.prototype.getNewMedia = function() { SDPDiffer.prototype.getNewMedia = function() {
@ -30,7 +30,8 @@ SDPDiffer.prototype.getNewMedia = function() {
return false; return false;
} }
else if (this[i] != array[i]) { else if (this[i] != array[i]) {
// Warning - two different object instances will never be equal: {x:20} != {x:20} // Warning - two different object instances will never be
// equal: {x:20} != {x:20}
return false; return false;
} }
} }
@ -48,10 +49,11 @@ SDPDiffer.prototype.getNewMedia = function() {
newMedia[othersMediaIdx] = othersMedia; newMedia[othersMediaIdx] = othersMedia;
return; return;
} }
// Look for new ssrcs accross the channel // Look for new ssrcs across the channel
Object.keys(othersMedia.ssrcs).forEach(function(ssrc) { Object.keys(othersMedia.ssrcs).forEach(function(ssrc) {
if(Object.keys(myMedia.ssrcs).indexOf(ssrc) === -1) { if(Object.keys(myMedia.ssrcs).indexOf(ssrc) === -1) {
// Allocate channel if we've found ssrc that doesn't exist in our channel // Allocate channel if we've found ssrc that doesn't exist in
// our channel
if(!newMedia[othersMediaIdx]){ if(!newMedia[othersMediaIdx]){
newMedia[othersMediaIdx] = { newMedia[othersMediaIdx] = {
mediaindex: othersMedia.mediaindex, mediaindex: othersMedia.mediaindex,
@ -71,8 +73,9 @@ SDPDiffer.prototype.getNewMedia = function() {
var matched = false; var matched = false;
for (var i = 0; i < myMedia.ssrcGroups.length; i++) { for (var i = 0; i < myMedia.ssrcGroups.length; i++) {
var mySsrcGroup = myMedia.ssrcGroups[i]; var mySsrcGroup = myMedia.ssrcGroups[i];
if (otherSsrcGroup.semantics == mySsrcGroup.semantics if (otherSsrcGroup.semantics == mySsrcGroup.semantics &&
&& arrayEquals.apply(otherSsrcGroup.ssrcs, [mySsrcGroup.ssrcs])) { arrayEquals.apply(otherSsrcGroup.ssrcs,
[mySsrcGroup.ssrcs])) {
matched = true; matched = true;
break; break;
@ -99,27 +102,21 @@ SDPDiffer.prototype.getNewMedia = function() {
}; };
/** /**
* Sends SSRC update IQ. * TODO: document!
* @param sdpMediaSsrcs SSRCs map obtained from SDP.getNewMedia. Cntains SSRCs to add/remove.
* @param sid session identifier that will be put into the IQ.
* @param initiator initiator identifier.
* @param toJid destination Jid
* @param isAdd indicates if this is remove or add operation.
*/ */
SDPDiffer.prototype.toJingle = function(modify) { SDPDiffer.prototype.toJingle = function(modify) {
var sdpMediaSsrcs = this.getNewMedia(); var sdpMediaSsrcs = this.getNewMedia();
var self = this;
// FIXME: only announce video ssrcs since we mix audio and dont need
// the audio ssrcs therefore
var modified = false; var modified = false;
Object.keys(sdpMediaSsrcs).forEach(function(mediaindex){ Object.keys(sdpMediaSsrcs).forEach(function(mediaindex){
modified = true; modified = true;
var media = sdpMediaSsrcs[mediaindex]; var media = sdpMediaSsrcs[mediaindex];
modify.c('content', {name: media.mid}); modify.c('content', {name: media.mid});
modify.c('description', {xmlns:'urn:xmpp:jingle:apps:rtp:1', media: media.mid}); modify.c('description',
// FIXME: not completly sure this operates on blocks and / or handles different ssrcs correctly {xmlns:'urn:xmpp:jingle:apps:rtp:1', media: media.mid});
// FIXME: not completely sure this operates on blocks and / or handles
// different ssrcs correctly
// generate sources from lines // generate sources from lines
Object.keys(media.ssrcs).forEach(function(ssrcNum) { Object.keys(media.ssrcs).forEach(function(ssrcNum) {
var mediaSsrc = media.ssrcs[ssrcNum]; var mediaSsrc = media.ssrcs[ssrcNum];

View File

@ -1,3 +1,4 @@
/* global $ */
var RTC = require('../RTC/RTC'); var RTC = require('../RTC/RTC');
var RTCBrowserType = require("../RTC/RTCBrowserType.js"); var RTCBrowserType = require("../RTC/RTCBrowserType.js");
var XMPPEvents = require("../../service/xmpp/XMPPEvents"); var XMPPEvents = require("../../service/xmpp/XMPPEvents");
@ -174,7 +175,8 @@ var normalizePlanB = function(desc) {
} }
if (typeof mLine.ssrcs !== 'undefined' && Array.isArray(mLine.ssrcs)) { if (typeof mLine.ssrcs !== 'undefined' && Array.isArray(mLine.ssrcs)) {
for (var i = 0; i<mLine.ssrcs.length; i++){ var i;
for (i = 0; i<mLine.ssrcs.length; i++){
if (typeof mLine.ssrcs[i] === 'object' if (typeof mLine.ssrcs[i] === 'object'
&& typeof mLine.ssrcs[i].id !== 'undefined' && typeof mLine.ssrcs[i].id !== 'undefined'
&& $.inArray(mLine.ssrcs[i].id, firstSsrcs) == 0) { && $.inArray(mLine.ssrcs[i].id, firstSsrcs) == 0) {
@ -183,7 +185,7 @@ var normalizePlanB = function(desc) {
} }
} }
for (var i = 0; i<mLine.ssrcs.length; i++){ for (i = 0; i<mLine.ssrcs.length; i++){
if (typeof mLine.ssrcs[i] !== 'undefined') { if (typeof mLine.ssrcs[i] !== 'undefined') {
newSsrcLines.push(mLine.ssrcs[i]); newSsrcLines.push(mLine.ssrcs[i]);
} }