raw JSON format without intermediate steps

This commit is contained in:
Philipp Hancke 2014-01-16 19:25:57 +01:00
parent c1d9917e00
commit ad37075074
2 changed files with 10 additions and 2 deletions

4
app.js
View File

@ -513,13 +513,15 @@ function dump(elem, filename){
var session = connection.jingle.sessions[sid];
if (session.peerconnection && session.peerconnection.updateLog) {
// FIXME: should probably be a .dump call
/* well, if I need to modify the output format anyway...
var stats = JSON.parse(JSON.stringify(session.peerconnection.stats));
Object.keys(stats).forEach(function (name) {
stats[name].values = JSON.stringify(stats[name].values);
});
*/
data["jingle_" + session.sid] = {
updateLog: session.peerconnection.updateLog,
stats: stats,
stats: session.peerconnection.stats),
url: window.location.href}
;
}

View File

@ -64,6 +64,9 @@ function TraceablePeerConnection(ice_config, constraints) {
self.ondatachannel(event);
}
}
// FIXME: is it a good idea to automatically start it here?
this.statsinterval = null;
this.maxstats = 600; // limit to 600 values, i.e. 10 minutes
this.statsinterval = window.setInterval(function() {
self.peerconnection.getStats(function(stats) {
@ -148,6 +151,10 @@ TraceablePeerConnection.prototype.setRemoteDescription = function (description,
TraceablePeerConnection.prototype.close = function () {
this.trace('stop');
if (this.statsinterval !== null) {
window.clearInterval(this.statsinterval);
this.statsinterval = null;
}
this.peerconnection.close();
};
@ -205,7 +212,6 @@ TraceablePeerConnection.prototype.getStats = function(callback) {
this.peerconnection.getStats(callback);
};
// mozilla chrome compat layer -- very similar to adapter.js
function setupRTC() {
var RTC = null;