Bläddra i källkod

Merge branch 'cs-and-updates'

dev1
Lyubomir Marinov 9 år sedan
förälder
incheckning
55582a24b0
3 ändrade filer med 36 tillägg och 44 borttagningar
  1. 29
    37
      modules/statistics/CallStats.js
  2. 6
    6
      modules/xmpp/strophe.jingle.js
  3. 1
    1
      package.json

+ 29
- 37
modules/statistics/CallStats.js Visa fil

@@ -68,7 +68,7 @@ function initCallback (err, msg) {
68 68
 
69 69
     if(!fabricInitialized) {
70 70
         CallStats.initializeFailed = true;
71
-        console.log("callstats fabric not initilized", ret.message);
71
+        logger.log("callstats fabric not initilized", ret.message);
72 72
         return;
73 73
     }
74 74
 
@@ -144,9 +144,12 @@ var CallStats = _try_catch(function(jingleSession, Settings, options) {
144 144
         this.session = jingleSession;
145 145
         this.peerconnection = jingleSession.peerconnection.peerconnection;
146 146
 
147
-        this.userID = Settings.getCallStatsUserName();
147
+        this.userID = {
148
+            aliasName: Strophe.getResourceFromJid(jingleSession.room.myroomjid),
149
+            userName: Settings.getCallStatsUserName()
150
+        };
148 151
 
149
-        var location = window.location;
152
+        const location = window.location;
150 153
         // The confID is case sensitive!!!
151 154
         this.confID = location.hostname + "/" + options.roomName;
152 155
 
@@ -161,9 +164,9 @@ var CallStats = _try_catch(function(jingleSession, Settings, options) {
161 164
             initCallback.bind(this));
162 165
 
163 166
     } catch (e) {
164
-        // The callstats.io API failed to initialize (e.g. because its
165
-        // download failed to succeed in general or on time). Further
166
-        // attempts to utilize it cannot possibly succeed.
167
+        // The callstats.io API failed to initialize (e.g. because its download
168
+        // did not succeed in general or on time). Further attempts to utilize
169
+        // it cannot possibly succeed.
167 170
         GlobalOnErrorHandler.callErrorHandler(e);
168 171
         callStats = null;
169 172
         logger.error(e);
@@ -230,10 +233,8 @@ var reportType = {
230 233
 };
231 234
 
232 235
 CallStats.prototype.pcCallback = _try_catch(function (err, msg) {
233
-    if (!callStats) {
234
-        return;
235
-    }
236
-    logger.log("Monitoring status: "+ err + " msg: " + msg);
236
+    if (callStats && err !== 'success')
237
+        logger.error("Monitoring status: "+ err + " msg: " + msg);
237 238
 });
238 239
 
239 240
 /**
@@ -253,11 +254,9 @@ function (ssrc, isLocal, usageLabel, containerId) {
253 254
     if(!callStats) {
254 255
         return;
255 256
     }
257
+
256 258
     // 'focus' is default remote user ID for now
257
-    var callStatsId = 'focus';
258
-    if (isLocal) {
259
-        callStatsId = this.userID;
260
-    }
259
+    const callStatsId = isLocal ? this.userID : 'focus';
261 260
 
262 261
     _try_catch(function() {
263 262
         logger.debug(
@@ -267,8 +266,7 @@ function (ssrc, isLocal, usageLabel, containerId) {
267 266
             this.confID,
268 267
             ssrc,
269 268
             usageLabel,
270
-            containerId
271
-        );
269
+            containerId);
272 270
         if(CallStats.initialized) {
273 271
             callStats.associateMstWithUserID(
274 272
                 this.peerconnection,
@@ -276,17 +274,16 @@ function (ssrc, isLocal, usageLabel, containerId) {
276 274
                 this.confID,
277 275
                 ssrc,
278 276
                 usageLabel,
279
-                containerId
280
-            );
277
+                containerId);
281 278
         }
282 279
         else {
283 280
             CallStats.reportsQueue.push({
284 281
                 type: reportType.MST_WITH_USERID,
285 282
                 data: {
286
-                    callStatsId: callStatsId,
287
-                    ssrc: ssrc,
288
-                    usageLabel: usageLabel,
289
-                    containerId: containerId
283
+                    callStatsId,
284
+                    containerId,
285
+                    ssrc,
286
+                    usageLabel
290 287
                 }
291 288
             });
292 289
             CallStats._checkInitialize();
@@ -301,13 +298,12 @@ function (ssrc, isLocal, usageLabel, containerId) {
301 298
  * @param {CallStats} cs callstats instance related to the event
302 299
  */
303 300
 CallStats.sendMuteEvent = _try_catch(function (mute, type, cs) {
301
+    let event;
304 302
 
305
-    var event = null;
306 303
     if (type === "video") {
307
-        event = (mute? fabricEvent.videoPause : fabricEvent.videoResume);
308
-    }
309
-    else {
310
-        event = (mute? fabricEvent.audioMute : fabricEvent.audioUnmute);
304
+        event = mute ? fabricEvent.videoPause : fabricEvent.videoResume;
305
+    } else {
306
+        event = mute ? fabricEvent.audioMute : fabricEvent.audioUnmute;
311 307
     }
312 308
 
313 309
     CallStats._reportEvent.call(cs, event);
@@ -320,9 +316,9 @@ CallStats.sendMuteEvent = _try_catch(function (mute, type, cs) {
320 316
  * @param {CallStats} cs callstats instance related to the event
321 317
  */
322 318
 CallStats.sendScreenSharingEvent = _try_catch(function (start, cs) {
323
-
324
-    CallStats._reportEvent.call(cs,
325
-        start? fabricEvent.screenShareStart : fabricEvent.screenShareStop);
319
+    CallStats._reportEvent.call(
320
+        cs,
321
+        start ? fabricEvent.screenShareStart : fabricEvent.screenShareStop);
326 322
 });
327 323
 
328 324
 /**
@@ -330,9 +326,7 @@ CallStats.sendScreenSharingEvent = _try_catch(function (start, cs) {
330 326
  * @param {CallStats} cs callstats instance related to the event
331 327
  */
332 328
 CallStats.sendDominantSpeakerEvent = _try_catch(function (cs) {
333
-
334
-    CallStats._reportEvent.call(cs,
335
-        fabricEvent.dominantSpeaker);
329
+    CallStats._reportEvent.call(cs, fabricEvent.dominantSpeaker);
336 330
 });
337 331
 
338 332
 /**
@@ -341,7 +335,6 @@ CallStats.sendDominantSpeakerEvent = _try_catch(function (cs) {
341 335
  * @param {CallStats} cs callstats instance related to the event
342 336
  */
343 337
 CallStats.sendActiveDeviceListEvent = _try_catch(function (devicesData, cs) {
344
-
345 338
     CallStats._reportEvent.call(cs, fabricEvent.activeDeviceList, devicesData);
346 339
 });
347 340
 
@@ -412,10 +405,10 @@ function(overallFeedback, detailedFeedback) {
412 405
     if(!CallStats.feedbackEnabled) {
413 406
         return;
414 407
     }
408
+
415 409
     var feedbackString =    '{"userID":"' + this.userID + '"' +
416 410
                             ', "overall":' + overallFeedback +
417 411
                             ', "comment": "' + detailedFeedback + '"}';
418
-
419 412
     var feedbackJSON = JSON.parse(feedbackString);
420 413
 
421 414
     callStats.sendUserFeedback(this.confID, feedbackJSON);
@@ -518,8 +511,7 @@ CallStats.sendAddIceCandidateFailed = _try_catch(function (e, pc, cs) {
518 511
  * @param {CallStats} cs callstats instance related to the error (optional)
519 512
  */
520 513
 CallStats.sendApplicationLog = _try_catch(function (e, cs) {
521
-    CallStats._reportError
522
-        .call(cs, wrtcFuncNames.applicationLog, e, null);
514
+    CallStats._reportError.call(cs, wrtcFuncNames.applicationLog, e, null);
523 515
 });
524 516
 
525 517
 /**

+ 6
- 6
modules/xmpp/strophe.jingle.js Visa fil

@@ -139,7 +139,7 @@ class JingleConnectionPlugin extends ConnectionPlugin {
139 139
                     Statistics.analytics.sendEvent(
140 140
                         'xmpp.transport-replace.success',
141 141
                         {value: successTime});
142
-                }, (error) => {
142
+                }, error => {
143 143
                     GlobalOnErrorHandler.callErrorHandler(error);
144 144
                     logger.error('Transport replace failed', error);
145 145
                     sess.sendTransportReject();
@@ -191,7 +191,7 @@ class JingleConnectionPlugin extends ConnectionPlugin {
191 191
             $iq({type: 'get', to: this.connection.domain})
192 192
                 .c('services', {xmlns: 'urn:xmpp:extdisco:1'})
193 193
                 .c('service', {host: 'turn.' + this.connection.domain}),
194
-            (res) => {
194
+            res => {
195 195
                 let iceservers = [];
196 196
                 $(res).find('>services>service').each((idx, el) => {
197 197
                     el = $(el);
@@ -240,8 +240,8 @@ class JingleConnectionPlugin extends ConnectionPlugin {
240 240
                         }
241 241
                     }
242 242
                 });
243
-                self.ice_config.iceServers = iceservers;
244
-            }, (err) => {
243
+                this.ice_config.iceServers = iceservers;
244
+            }, err => {
245 245
                 logger.warn('getting turn credentials failed', err);
246 246
                 logger.warn('is mod_turncredentials or similar installed?');
247 247
             });
@@ -253,8 +253,8 @@ class JingleConnectionPlugin extends ConnectionPlugin {
253 253
      */
254 254
     getLog () {
255 255
         const data = {};
256
-        Object.keys(this.sessions).forEach((sid) => {
257
-            const session = self.sessions[sid];
256
+        Object.keys(this.sessions).forEach(sid => {
257
+            const session = this.sessions[sid];
258 258
             const pc = session.peerconnection;
259 259
             if (pc && pc.updateLog) {
260 260
                 // FIXME: should probably be a .dump call

+ 1
- 1
package.json Visa fil

@@ -25,7 +25,7 @@
25 25
     "sdp-interop": "0.1.11",
26 26
     "sdp-simulcast": "0.1.7",
27 27
     "sdp-transform": "1.5.*",
28
-    "socket.io-client": "1.3.6",
28
+    "socket.io-client": "1.4.5",
29 29
     "strophe": "^1.2.2",
30 30
     "strophejs-plugins": "^0.0.6"
31 31
   },

Laddar…
Avbryt
Spara