From 831943e0bf5fb534ce8cd86e4d68518ce468c3c7 Mon Sep 17 00:00:00 2001 From: Robert Smallwood Date: Tue, 15 Dec 2015 20:00:02 -0700 Subject: [PATCH] Repairing callstats, fix scoping on this for screen obtainer callback, stopping new stream in RTC --- modules/RTC/RTC.js | 10 +++++++--- modules/desktopsharing/ScreenObtainer.js | 3 ++- modules/statistics/CallStats.js | 2 ++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/RTC/RTC.js b/modules/RTC/RTC.js index e217578e2..84581dc9b 100644 --- a/modules/RTC/RTC.js +++ b/modules/RTC/RTC.js @@ -159,10 +159,14 @@ var RTC = { this.rtcUtils = null; } // Remove all local streams on cleanup - while (this.localStreams.length > 0) { - var stream = this.localStreams[0]; - this.stopMediaStream(stream.getOriginalStream()); + while (this.localAudio.length > 0) { + this.stopMediaStream(this.localAudio[0] + .getOriginalStream()); } + while (this.localVideo.length > 0) { + this.stopMediaStream(this.localVideo[0] + .getOriginalStream()); + } if (eventEmitter) { eventEmitter.removeAllListeners(); } diff --git a/modules/desktopsharing/ScreenObtainer.js b/modules/desktopsharing/ScreenObtainer.js index bb8e1afba..562657730 100644 --- a/modules/desktopsharing/ScreenObtainer.js +++ b/modules/desktopsharing/ScreenObtainer.js @@ -270,6 +270,7 @@ function obtainScreenFromExtension(streamCallback, failCallback) { 'Changes will take effect after next Chrome restart.'); } + var _this = this; chrome.webstore.install( getWebStoreInstallUrl(), function (arg) { @@ -281,7 +282,7 @@ function obtainScreenFromExtension(streamCallback, failCallback) { }, 500); }, function (arg) { - this.eventEmitter + _this.eventEmitter .emit(DesktopSharingEventTypes.EXTENSION_INSTALLATION_ERROR); console.log("Failed to install the extension", arg); failCallback(arg); diff --git a/modules/statistics/CallStats.js b/modules/statistics/CallStats.js index 99d4918a4..9a9d93bed 100644 --- a/modules/statistics/CallStats.js +++ b/modules/statistics/CallStats.js @@ -31,6 +31,8 @@ var callStatsIntegrationEnabled = config.callStatsID && config.callStatsSecret; var CallStats = { init: function (jingleSession) { + callStatsIntegrationEnabled = config.callStatsID + && config.callStatsSecret; if(!callStatsIntegrationEnabled || callStats !== null) { return; }