Removes unused code.

This commit is contained in:
damencho 2016-01-19 13:31:37 -06:00
parent 2dba1d9d17
commit 09d08b034c
2 changed files with 1 additions and 87 deletions

View File

@ -146,7 +146,6 @@ function StatsCollector(peerconnection, audioLevelsInterval, statsInterval, even
{
this.peerconnection = peerconnection;
this.baselineAudioLevelsReport = null;
this.currentAudioLevelsReport = null;
this.currentStatsReport = null;
this.baselineStatsReport = null;
this.audioLevelsIntervalId = null;
@ -252,10 +251,7 @@ StatsCollector.prototype.start = function ()
results = report.result();
}
//console.error("Got interval report", results);
self.currentAudioLevelsReport = results;
self.processAudioLevelReport();
self.baselineAudioLevelsReport =
self.currentAudioLevelsReport;
self.baselineAudioLevelsReport = results;
},
self.errorCallback
);
@ -666,65 +662,3 @@ StatsCollector.prototype.processStatsReport = function () {
PeerStats.transport = [];
};
/**
* Stats processing logic.
*/
StatsCollector.prototype.processAudioLevelReport = function () {
if (!this.baselineAudioLevelsReport) {
return;
}
for (var idx in this.currentAudioLevelsReport) {
var now = this.currentAudioLevelsReport[idx];
if (now.type != 'ssrc') {
continue;
}
var before = this.baselineAudioLevelsReport[idx];
if (!before) {
console.warn(getStatValue(now, 'ssrc') + ' not enough data');
continue;
}
var ssrc = getStatValue(now, 'ssrc');
var jid = APP.conference._room.room.getJidBySSRC(ssrc);
if (!jid) {
if((Date.now() - now.timestamp) < 3000)
console.warn("No jid for ssrc: " + ssrc);
continue;
}
var jidStats = this.jid2stats[jid];
if (!jidStats) {
jidStats = new PeerStats();
this.jid2stats[jid] = jidStats;
}
// Audio level
var audioLevel = null;
try {
audioLevel = getStatValue(now, 'audioInputLevel');
if (!audioLevel)
audioLevel = getStatValue(now, 'audioOutputLevel');
}
catch(e) {/*not supported*/
console.warn("Audio Levels are not available in the statistics.");
clearInterval(this.audioLevelsIntervalId);
return;
}
if (audioLevel) {
// TODO: can't find specs about what this value really is,
// but it seems to vary between 0 and around 32k.
audioLevel = audioLevel / 32767;
jidStats.setSsrcAudioLevel(ssrc, audioLevel);
if (jid != APP.conference._room.room.myroomjid) {
this.eventEmitter.emit(
StatisticsEvents.AUDIO_LEVEL, jid, audioLevel);
}
}
}
};

View File

@ -113,25 +113,5 @@ export default {
CallStats.sendAddIceCandidateFailed(e, pc);
}
);
},
/**
* FIXME:
* Currently used by torture. If we are removing this, torture needs to
* be fixed also.
*
* Obtains audio level reported in the stats for specified peer.
* @param peerJid full MUC jid of the user for whom we want to obtain last
* audio level.
* @param ssrc the SSRC of audio stream for which we want to obtain audio
* level.
* @returns {*} a float form 0 to 1 that represents current audio level or
* <tt>null</tt> if for any reason the value is not available
* at this time.
*/
getPeerSSRCAudioLevel: function (peerJid, ssrc) {
var peerStats = rtpStats.jid2stats[peerJid];
return peerStats ? peerStats.ssrc2AudioLevel[ssrc] : null;
}
};