Fix comparison warnings.

This commit is contained in:
Boris Grozev 2015-11-20 14:17:18 -06:00
parent 40aacec769
commit e3a886b492
7 changed files with 17 additions and 17 deletions

View File

@ -167,14 +167,13 @@ DataChannels.prototype.handleSelectedEndpointEvent = function (userResource) {
DataChannels.prototype.handlePinnedEndpointEvent = function (userResource) {
logger.log('pinned endpoint changed: ', userResource);
if (this._dataChannels && this._dataChannels.length != 0) {
if (this._dataChannels && this._dataChannels.length !== 0) {
this._dataChannels.some(function (dataChannel) {
if (dataChannel.readyState == 'open') {
dataChannel.send(JSON.stringify({
'colibriClass': 'PinnedEndpointChangedEvent',
'pinnedEndpoint':
(!userResource || userResource == null)?
null : userResource
userResource ? userResource : null
}));
return true;

View File

@ -33,9 +33,10 @@ function getPreviousResolution(resolution) {
var order = Resolutions[resolution].order;
var res = null;
var resName = null;
for(var i in Resolutions) {
var tmp = Resolutions[i];
if(res == null || (res.order < tmp.order && tmp.order < order)) {
var tmp, i;
for(i in Resolutions) {
tmp = Resolutions[i];
if (!res || (res.order < tmp.order && tmp.order < order)) {
resName = i;
res = tmp;
}
@ -678,7 +679,7 @@ var RTCUtils = {
error.name == "OverconstrainedError") &&
(error.constraintName == "minWidth" || error.constraintName == "maxWidth" ||
error.constraintName == "minHeight" || error.constraintName == "maxHeight")
&& resolution != null) {
&& resolution) {
self.getUserMediaWithConstraints(['audio', 'video'],
function (stream) {
var streams = self.successCallback(stream, resolution);

View File

@ -108,7 +108,7 @@ var ConnectionQuality = {
updateLocalStats: function (data) {
stats = data;
eventEmitter.emit(CQEvents.LOCALSTATS_UPDATED, 100 - stats.packetLoss.total, stats);
if (sendIntervalId == null) {
if (!sendIntervalId) {
startSendingStats();
}
},
@ -119,7 +119,7 @@ var ConnectionQuality = {
* @param data the statistics
*/
updateRemoteStats: function (jid, data) {
if (data == null || data.packetLoss_total == null) {
if (!data || !data.packetLoss_total) {
eventEmitter.emit(CQEvents.REMOTESTATS_UPDATED, jid, null, null);
return;
}

View File

@ -843,7 +843,7 @@ JingleSessionPC.prototype.addSource = function (elem, fromJid) {
return this.getAttribute('ssrc');
}).get();
if (ssrcs.length != 0) {
if (ssrcs.length) {
lines += 'a=ssrc-group:' + semantics + ' ' + ssrcs.join(' ') + '\r\n';
}
});
@ -922,7 +922,7 @@ JingleSessionPC.prototype.removeSource = function (elem, fromJid) {
return this.getAttribute('ssrc');
}).get();
if (ssrcs.length != 0) {
if (ssrcs.length) {
lines += 'a=ssrc-group:' + semantics + ' ' + ssrcs.join(' ') + '\r\n';
}
});
@ -1367,7 +1367,7 @@ JingleSessionPC.prototype.setLocalDescription = function () {
var session = transform.parse(this.peerconnection.localDescription.sdp);
session.media.forEach(function (media) {
if (media.ssrcs != null && media.ssrcs.length > 0) {
if (media.ssrcs && media.ssrcs.length > 0) {
// TODO(gp) maybe exclude FID streams?
media.ssrcs.forEach(function (ssrc) {
if (ssrc.attribute !== 'cname') {

View File

@ -47,7 +47,7 @@ SDP.prototype.getMediaSsrcMap = function() {
tmp.forEach(function(line){
var semantics = line.substr(0, idx).substr(13);
var ssrcs = line.substr(14 + semantics.length).split(' ');
if (ssrcs.length != 0) {
if (ssrcs.length) {
media.ssrcGroups.push({
semantics: semantics,
ssrcs: ssrcs
@ -268,7 +268,7 @@ SDP.prototype.toJingle = function (elem, thecreator, ssrcs) {
idx = line.indexOf(' ');
var semantics = line.substr(0, idx).substr(13);
var ssrcs = line.substr(14 + semantics.length).split(' ');
if (ssrcs.length != 0) {
if (ssrcs.length) {
elem.c('ssrc-group', { semantics: semantics, xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
ssrcs.forEach(function(ssrc) {
elem.c('source', { ssrc: ssrc })
@ -599,7 +599,7 @@ SDP.prototype.jingle2media = function (content) {
return this.getAttribute('ssrc');
}).get();
if (ssrcs.length != 0) {
if (ssrcs.length) {
media += 'a=ssrc-group:' + semantics + ' ' + ssrcs.join(' ') + '\r\n';
}
});

View File

@ -143,7 +143,7 @@ SDPDiffer.prototype.toJingle = function(modify) {
// generate source groups from lines
media.ssrcGroups.forEach(function(ssrcGroup) {
if (ssrcGroup.ssrcs.length != 0) {
if (ssrcGroup.ssrcs.length) {
modify.c('ssrc-group', {
semantics: ssrcGroup.semantics,

View File

@ -182,7 +182,7 @@ var normalizePlanB = function(desc) {
for (i = 0; i<mLine.ssrcs.length; i++){
if (typeof mLine.ssrcs[i] === 'object'
&& typeof mLine.ssrcs[i].id !== 'undefined'
&& $.inArray(mLine.ssrcs[i].id, firstSsrcs) == 0) {
&& !$.inArray(mLine.ssrcs[i].id, firstSsrcs)) {
newSsrcLines.push(mLine.ssrcs[i]);
delete mLine.ssrcs[i];
}