瀏覽代碼

eslint 4.8.0

ESLint 4.8.0 discovers a lot of error related to formatting. While I
tried to fix as many of them as possible, a portion of them actually go
against our coding style. In such a case, I've disabled the indent rule
which effectively leaves it as it was before ESLint 4.8.0.
dev1
Lyubo Marinov 7 年之前
父節點
當前提交
ff8468d931

+ 17
- 1
.eslintrc.js 查看文件

@@ -175,7 +175,23 @@ module.exports = {
175 175
         'id-blacklist': 0,
176 176
         'id-length': 0,
177 177
         'id-match': 0,
178
-        'indent': [ 'error', 4, { 'SwitchCase': 0 } ],
178
+        'indent': [
179
+            'error',
180
+            4,
181
+            {
182
+                'CallExpression': {
183
+                    arguments: 'off'
184
+                },
185
+                'FunctionDeclaration': {
186
+                    parameters: 2
187
+                },
188
+                'FunctionExpression': {
189
+                    parameters: 2
190
+                },
191
+                'MemberExpression': 'off',
192
+                'SwitchCase': 0
193
+            }
194
+        ],
179 195
         'key-spacing': 2,
180 196
         'keyword-spacing': 2,
181 197
         'linebreak-style': [ 'error', 'unix' ],

+ 52
- 41
JitsiConference.js 查看文件

@@ -235,7 +235,8 @@ JitsiConference.prototype._init = function(options = {}) {
235 235
         = new ParticipantConnectionStatusHandler(
236 236
             this.rtc,
237 237
             this,
238
-            {   // Both these options are not public API, leaving it here only
238
+            {
239
+                // Both these options are not public API, leaving it here only
239 240
                 // as an entry point through config for tuning up purposes.
240 241
                 // Default values should be adjusted as soon as optimal values
241 242
                 // are discovered.
@@ -672,7 +673,7 @@ JitsiConference.prototype.addTrack = function(track) {
672 673
             }
673 674
 
674 675
             return Promise.reject(new Error(
675
-                    'cannot add second video track to the conference'));
676
+                'cannot add second video track to the conference'));
676 677
 
677 678
         }
678 679
     }
@@ -685,8 +686,9 @@ JitsiConference.prototype.addTrack = function(track) {
685 686
  * @param {number} audioLevel the audio level
686 687
  * @param {TraceablePeerConnection} [tpc]
687 688
  */
688
-JitsiConference.prototype._fireAudioLevelChangeEvent
689
-= function(audioLevel, tpc) {
689
+JitsiConference.prototype._fireAudioLevelChangeEvent = function(
690
+        audioLevel,
691
+        tpc) {
690 692
     const activeTpc = this.getActivePeerConnection();
691 693
 
692 694
     // There will be no TraceablePeerConnection if audio levels do not come from
@@ -860,10 +862,12 @@ JitsiConference.prototype._setupNewTrack = function(newTrack) {
860 862
 
861 863
     newTrack.muteHandler = this._fireMuteChangeEvent.bind(this, newTrack);
862 864
     newTrack.audioLevelHandler = this._fireAudioLevelChangeEvent.bind(this);
863
-    newTrack.addEventListener(JitsiTrackEvents.TRACK_MUTE_CHANGED,
864
-                           newTrack.muteHandler);
865
-    newTrack.addEventListener(JitsiTrackEvents.TRACK_AUDIO_LEVEL_CHANGED,
866
-                           newTrack.audioLevelHandler);
865
+    newTrack.addEventListener(
866
+        JitsiTrackEvents.TRACK_MUTE_CHANGED,
867
+        newTrack.muteHandler);
868
+    newTrack.addEventListener(
869
+        JitsiTrackEvents.TRACK_AUDIO_LEVEL_CHANGED,
870
+        newTrack.audioLevelHandler);
867 871
 
868 872
     newTrack._setConference(this);
869 873
 
@@ -1348,8 +1352,10 @@ JitsiConference.prototype.onRemoteTrackRemoved = function(removedTrack) {
1348 1352
 /**
1349 1353
  * Handles incoming call event.
1350 1354
  */
1351
-JitsiConference.prototype.onIncomingCall
1352
-= function(jingleSession, jingleOffer, now) {
1355
+JitsiConference.prototype.onIncomingCall = function(
1356
+        jingleSession,
1357
+        jingleOffer,
1358
+        now) {
1353 1359
     // Handle incoming P2P call
1354 1360
     if (jingleSession.isP2P) {
1355 1361
         const role = this.room.getMemberRole(jingleSession.peerjid);
@@ -1509,8 +1515,8 @@ JitsiConference.prototype._setBridgeChannel = function(offerIq, pc) {
1509 1515
  * @param {JingleSessionPC} jingleSession the session instance to be rejected.
1510 1516
  * @private
1511 1517
  */
1512
-JitsiConference.prototype._rejectIncomingCallNonModerator
1513
-= function(jingleSession) {
1518
+JitsiConference.prototype._rejectIncomingCallNonModerator = function(
1519
+        jingleSession) {
1514 1520
     this._rejectIncomingCall(
1515 1521
         jingleSession,
1516 1522
         {
@@ -1533,8 +1539,9 @@ JitsiConference.prototype._rejectIncomingCallNonModerator
1533 1539
  * error handler
1534 1540
  * @private
1535 1541
  */
1536
-JitsiConference.prototype._rejectIncomingCall
1537
-= function(jingleSession, options) {
1542
+JitsiConference.prototype._rejectIncomingCall = function(
1543
+        jingleSession,
1544
+        options) {
1538 1545
     if (options && options.errorMsg) {
1539 1546
         GlobalOnErrorHandler.callErrorHandler(new Error(options.errorMsg));
1540 1547
     }
@@ -1561,11 +1568,13 @@ JitsiConference.prototype._rejectIncomingCall
1561 1568
  * @param {String|null} reasonText human readable reason text which may provide
1562 1569
  * more details about why the call has been terminated.
1563 1570
  */
1564
-JitsiConference.prototype.onCallEnded
1565
-= function(jingleSession, reasonCondition, reasonText) {
1571
+JitsiConference.prototype.onCallEnded = function(
1572
+        jingleSession,
1573
+        reasonCondition,
1574
+        reasonText) {
1566 1575
     logger.info(
1567
-        `Call ended: ${reasonCondition} - ${reasonText
1568
-            } P2P ?${jingleSession.isP2P}`);
1576
+        `Call ended: ${reasonCondition} - ${reasonText} P2P ?${
1577
+            jingleSession.isP2P}`);
1569 1578
     if (jingleSession === this.jvbJingleSession) {
1570 1579
         this.wasStopped = true;
1571 1580
 
@@ -1655,10 +1664,9 @@ JitsiConference.prototype.isDTMFSupported = function() {
1655 1664
  */
1656 1665
 JitsiConference.prototype.myUserId = function() {
1657 1666
     return (
1658
-        this.room
1659
-            && this.room.myroomjid
1660
-                ? Strophe.getResourceFromJid(this.room.myroomjid)
1661
-                : null);
1667
+        this.room && this.room.myroomjid
1668
+            ? Strophe.getResourceFromJid(this.room.myroomjid)
1669
+            : null);
1662 1670
 };
1663 1671
 
1664 1672
 JitsiConference.prototype.sendTones = function(tones, duration, pause) {
@@ -1916,8 +1924,9 @@ JitsiConference.prototype.setLocalParticipantProperty = function(name, value) {
1916 1924
  * user feedback
1917 1925
  * @param detailedFeedback detailed feedback from the user. Not yet used
1918 1926
  */
1919
-JitsiConference.prototype.sendFeedback
1920
-= function(overallFeedback, detailedFeedback) {
1927
+JitsiConference.prototype.sendFeedback = function(
1928
+        overallFeedback,
1929
+        detailedFeedback) {
1921 1930
     this.statistics.sendFeedback(overallFeedback, detailedFeedback);
1922 1931
 };
1923 1932
 
@@ -2086,8 +2095,9 @@ JitsiConference.prototype._onIceConnectionRestored = function(session) {
2086 2095
  * @param {jQuery} jingleOffer a jQuery selector pointing to 'jingle' IQ element
2087 2096
  * @private
2088 2097
  */
2089
-JitsiConference.prototype._acceptP2PIncomingCall
2090
-= function(jingleSession, jingleOffer) {
2098
+JitsiConference.prototype._acceptP2PIncomingCall = function(
2099
+        jingleSession,
2100
+        jingleOffer) {
2091 2101
     this.isP2PConnectionInterrupted = false;
2092 2102
 
2093 2103
     // Accept the offer
@@ -2154,9 +2164,8 @@ JitsiConference.prototype._addRemoteTracks = function(logName, remoteTracks) {
2154 2164
  * @param {JingleSessionPC} jingleSession the session instance.
2155 2165
  * @private
2156 2166
  */
2157
-JitsiConference.prototype._onIceConnectionEstablished
2158
-= function(jingleSession) {
2159
-
2167
+JitsiConference.prototype._onIceConnectionEstablished = function(
2168
+        jingleSession) {
2160 2169
     if (this.p2pJingleSession !== null) {
2161 2170
         // store the establishment time of the p2p session as a field of the
2162 2171
         // JitsiConference because the p2pJingleSession might get disposed (thus
@@ -2273,8 +2282,9 @@ JitsiConference.prototype._removeRemoteP2PTracks = function() {
2273 2282
  * @param {Array<JitsiRemoteTrack>} remoteTracks the tracks that will be removed
2274 2283
  * @private
2275 2284
  */
2276
-JitsiConference.prototype._removeRemoteTracks
2277
-= function(sessionNickname, remoteTracks) {
2285
+JitsiConference.prototype._removeRemoteTracks = function(
2286
+        sessionNickname,
2287
+        remoteTracks) {
2278 2288
     for (const track of remoteTracks) {
2279 2289
         logger.info(`Removing remote ${sessionNickname} track: ${track}`);
2280 2290
         this.rtc.eventEmitter.emit(RTCEvents.REMOTE_TRACK_REMOVED, track);
@@ -2375,8 +2385,8 @@ JitsiConference.prototype._startP2PSession = function(peerJid) {
2375 2385
     this.isP2PConnectionInterrupted = false;
2376 2386
     this.p2pJingleSession
2377 2387
         = this.xmpp.connection.jingle.newP2PJingleSession(
2378
-                this.room.myroomjid,
2379
-                peerJid);
2388
+            this.room.myroomjid,
2389
+            peerJid);
2380 2390
     logger.info('Created new P2P JingleSession', this.room.myroomjid, peerJid);
2381 2391
 
2382 2392
     this.p2pJingleSession.initialize(true /* initiator */, this.room, this.rtc);
@@ -2434,8 +2444,8 @@ JitsiConference.prototype._maybeStartOrStopP2P = function(userLeftEvent) {
2434 2444
     const shouldBeInP2P = peerCount === 1;
2435 2445
 
2436 2446
     logger.debug(
2437
-        `P2P? isModerator: ${isModerator
2438
-            }, peerCount: ${peerCount} => ${shouldBeInP2P}`);
2447
+        `P2P? isModerator: ${isModerator}, peerCount: ${peerCount} => ${
2448
+            shouldBeInP2P}`);
2439 2449
 
2440 2450
     // Clear deferred "start P2P" task
2441 2451
     if (!shouldBeInP2P && this.deferredStartP2PTask) {
@@ -2472,8 +2482,8 @@ JitsiConference.prototype._maybeStartOrStopP2P = function(userLeftEvent) {
2472 2482
                 return;
2473 2483
             }
2474 2484
             logger.info(
2475
-                `Will start P2P with: ${jid
2476
-                    } after ${this.backToP2PDelay} seconds...`);
2485
+                `Will start P2P with: ${jid} after ${
2486
+                    this.backToP2PDelay} seconds...`);
2477 2487
             this.deferredStartP2PTask = setTimeout(
2478 2488
                 this._startP2PSession.bind(this, jid),
2479 2489
                 this.backToP2PDelay * 1000);
@@ -2500,8 +2510,9 @@ JitsiConference.prototype._maybeStartOrStopP2P = function(userLeftEvent) {
2500 2510
  * description that will be included in the session terminate message
2501 2511
  * @private
2502 2512
  */
2503
-JitsiConference.prototype._stopP2PSession
2504
-= function(reason, reasonDescription) {
2513
+JitsiConference.prototype._stopP2PSession = function(
2514
+        reason,
2515
+        reasonDescription) {
2505 2516
     if (!this.p2pJingleSession) {
2506 2517
         logger.error('No P2P session to be stopped!');
2507 2518
 
@@ -2638,8 +2649,8 @@ JitsiConference.prototype.getSpeakerStats = function() {
2638 2649
  * this receiver is willing to receive.
2639 2650
  * @returns {void}
2640 2651
  */
2641
-JitsiConference.prototype.setReceiverVideoConstraint
2642
-= function(maxFrameHeight) {
2652
+JitsiConference.prototype.setReceiverVideoConstraint = function(
2653
+        maxFrameHeight) {
2643 2654
     this.rtc.setReceiverVideoConstraint(maxFrameHeight);
2644 2655
 };
2645 2656
 

+ 1
- 1
JitsiMeetJS.js 查看文件

@@ -355,7 +355,7 @@ export default {
355 355
                     Statistics.sendLog(JSON.stringify(logObject));
356 356
                     Statistics.analytics.sendEvent(
357 357
                         `getUserMedia.deviceNotFound.${
358
-                             error.gum.devices.join('.')}`);
358
+                            error.gum.devices.join('.')}`);
359 359
                 } else {
360 360
                     // Report gUM failed to the stats
361 361
                     Statistics.sendGetUserMediaFailed(error);

+ 2
- 2
JitsiTrackError.js 查看文件

@@ -105,8 +105,8 @@ function JitsiTrackError(error, options, devices) {
105 105
                 this.message
106 106
                     = TRACK_ERROR_TO_MESSAGE_MAP[this.name]
107 107
                         + getResolutionFromFailedConstraint(
108
-                                constraintName,
109
-                                options);
108
+                            constraintName,
109
+                            options);
110 110
             } else {
111 111
                 this.name = JitsiTrackErrors.CONSTRAINT_FAILED;
112 112
                 this.message

+ 16
- 16
doc/example/example.js 查看文件

@@ -147,20 +147,19 @@ function onConnectionSuccess() {
147 147
     room.on(
148 148
         JitsiMeetJS.events.conference.DISPLAY_NAME_CHANGED,
149 149
         (userID, displayName) => console.log(`${userID} - ${displayName}`));
150
-    room.on(JitsiMeetJS.events.conference.TRACK_AUDIO_LEVEL_CHANGED,
151
-      (userID, audioLevel) => {
152
-          console.log(`${userID} - ${audioLevel}`);
153
-      });
154
-    room.on(JitsiMeetJS.events.conference.RECORDER_STATE_CHANGED, () => {
155
-        console.log(`${room.isRecordingSupported()} - ${
156
-             room.getRecordingState()} - ${
157
-             room.getRecordingURL()}`);
158
-    });
159
-    room.on(JitsiMeetJS.events.conference.PHONE_NUMBER_CHANGED, () => {
160
-        console.log(
161
-            `${room.getPhoneNumber()} - ${
162
-             room.getPhonePin()}`);
163
-    });
150
+    room.on(
151
+        JitsiMeetJS.events.conference.TRACK_AUDIO_LEVEL_CHANGED,
152
+        (userID, audioLevel) => console.log(`${userID} - ${audioLevel}`));
153
+    room.on(
154
+        JitsiMeetJS.events.conference.RECORDER_STATE_CHANGED,
155
+        () =>
156
+            console.log(
157
+                `${room.isRecordingSupported()} - ${
158
+                    room.getRecordingState()} - ${
159
+                    room.getRecordingURL()}`));
160
+    room.on(
161
+        JitsiMeetJS.events.conference.PHONE_NUMBER_CHANGED,
162
+        () => console.log(`${room.getPhoneNumber()} - ${room.getPhonePin()}`));
164 163
     room.join();
165 164
 }
166 165
 
@@ -216,8 +215,9 @@ function switchVideo() { // eslint-disable-line no-unused-vars
216 215
         localTracks[1].dispose();
217 216
         localTracks.pop();
218 217
     }
219
-    JitsiMeetJS.createLocalTracks(
220
-            { devices: isVideo ? [ 'video' ] : [ 'desktop' ] })
218
+    JitsiMeetJS.createLocalTracks({
219
+        devices: [ isVideo ? 'video' : 'desktop' ]
220
+    })
221 221
         .then(tracks => {
222 222
             localTracks.push(tracks[0]);
223 223
             localTracks[1].addEventListener(

+ 24
- 34
karma.conf.js 查看文件

@@ -4,69 +4,59 @@
4 4
 module.exports = function(config) {
5 5
     config.set({
6 6
 
7
-    // base path that will be used to resolve all patterns (eg. files, exclude)
7
+        // base path that will be used to resolve all patterns (eg. files,
8
+        // exclude)
8 9
         basePath: '',
9 10
 
10
-
11
-    // frameworks to use
12
-    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
11
+        // frameworks to use
12
+        // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
13 13
         frameworks: [ 'jasmine' ],
14 14
 
15
-
16
-    // list of files / patterns to load in the browser
15
+        // list of files / patterns to load in the browser
17 16
         files: [
18 17
             './index.js',
19 18
             './modules/**/*.spec.js'
20 19
         ],
21 20
 
22
-
23
-    // list of files to exclude
21
+        // list of files to exclude
24 22
         exclude: [
25 23
         ],
26 24
 
27
-
28
-    // preprocess matching files before serving them to the browser
29
-    // available preprocessors:
30
-    //  https://npmjs.org/browse/keyword/karma-preprocessor
25
+        // preprocess matching files before serving them to the browser
26
+        // available preprocessors:
27
+        //  https://npmjs.org/browse/keyword/karma-preprocessor
31 28
         preprocessors: {
32 29
             './index.js': [ 'webpack' ],
33 30
             './**/*.spec.js': [ 'webpack' ]
34 31
         },
35 32
 
36
-
37
-    // test results reporter to use
38
-    // possible values: 'dots', 'progress'
39
-    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
33
+        // test results reporter to use
34
+        // possible values: 'dots', 'progress'
35
+        // available reporters: https://npmjs.org/browse/keyword/karma-reporter
40 36
         reporters: [ 'progress' ],
41 37
 
42
-
43
-    // web server port
38
+        // web server port
44 39
         port: 9876,
45 40
 
46
-
47
-    // enable / disable colors in the output (reporters and logs)
41
+        // enable / disable colors in the output (reporters and logs)
48 42
         colors: true,
49 43
 
50
-
51
-    // level of logging
52
-    // possible values: config.LOG_DISABLE || config.LOG_ERROR ||
53
-    //  config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
44
+        // level of logging
45
+        // possible values: config.LOG_DISABLE || config.LOG_ERROR ||
46
+        //  config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
54 47
         logLevel: config.LOG_INFO,
55 48
 
56
-
57
-    // enable / disable watching file and executing tests whenever
58
-    // any file changes
49
+        // enable / disable watching file and executing tests whenever
50
+        // any file changes
59 51
         autoWatch: false,
60 52
 
61
-
62
-    // start these browsers
63
-    // available browser launchers:
64
-    // https://npmjs.org/browse/keyword/karma-launcher
53
+        // start these browsers
54
+        // available browser launchers:
55
+        // https://npmjs.org/browse/keyword/karma-launcher
65 56
         browsers: [ 'Chrome' ],
66 57
 
67
-
68
-    // Continuous Integration mode
69
-    // if true, Karma captures browsers, runs the tests and exits
58
+        // Continuous Integration mode
59
+        // if true, Karma captures browsers, runs the tests and exits
70 60
         singleRun: false,
71 61
 
72 62
         webpack: require('./webpack.config.js')

+ 2
- 1
modules/RTC/JitsiLocalTrack.js 查看文件

@@ -363,7 +363,8 @@ export default class JitsiLocalTrack extends JitsiTrack {
363 363
             promise = RTCUtils.obtainAudioAndVideoPermissions(streamOptions)
364 364
                 .then(streamsInfo => {
365 365
                     const mediaType = this.getType();
366
-                    const streamInfo = streamsInfo.find(
366
+                    const streamInfo
367
+                        = streamsInfo.find(
367 368
                             info => info.mediaType === mediaType);
368 369
 
369 370
                     if (streamInfo) {

+ 14
- 12
modules/RTC/JitsiRemoteTrack.js 查看文件

@@ -34,16 +34,16 @@ export default class JitsiRemoteTrack extends JitsiTrack {
34 34
      * @constructor
35 35
      */
36 36
     constructor(
37
-        rtc,
38
-        conference,
39
-        ownerEndpointId,
40
-        stream,
41
-        track,
42
-        mediaType,
43
-        videoType,
44
-        ssrc,
45
-        muted,
46
-        isP2P) {
37
+            rtc,
38
+            conference,
39
+            ownerEndpointId,
40
+            stream,
41
+            track,
42
+            mediaType,
43
+            videoType,
44
+            ssrc,
45
+            muted,
46
+            isP2P) {
47 47
         super(
48 48
             conference,
49 49
             stream,
@@ -280,7 +280,9 @@ export default class JitsiRemoteTrack extends JitsiTrack {
280 280
      * @return {string}
281 281
      */
282 282
     toString() {
283
-        return `RemoteTrack[${this.ownerEndpointId}, ${this.getType()
284
-                }, p2p: ${this.isP2P}]`;
283
+        return `RemoteTrack[${
284
+            this.ownerEndpointId}, ${
285
+            this.getType()}, p2p: ${
286
+            this.isP2P}]`;
285 287
     }
286 288
 }

+ 13
- 13
modules/RTC/JitsiTrack.js 查看文件

@@ -471,19 +471,19 @@ export default class JitsiTrack extends EventEmitter {
471 471
 
472 472
         return (
473 473
             Promise.all(
474
-                    this.containers.map(
475
-                        element =>
476
-                            element.setSinkId(audioOutputDeviceId)
477
-                                .catch(error => {
478
-                                    logger.warn(
479
-                                        'Failed to change audio output device'
480
-                                            + ' on element. Default or'
481
-                                            + ' previously set audio output'
482
-                                            + ' device will be used.',
483
-                                        element,
484
-                                        error);
485
-                                    throw error;
486
-                                })))
474
+                this.containers.map(
475
+                    element =>
476
+                        element.setSinkId(audioOutputDeviceId)
477
+                            .catch(error => {
478
+                                logger.warn(
479
+                                    'Failed to change audio output device on'
480
+                                        + ' element. Default or previously set'
481
+                                        + ' audio output device will be used.',
482
+                                    element,
483
+                                    error);
484
+                                throw error;
485
+                            }))
486
+            )
487 487
                 .then(() => {
488 488
                     this.emit(
489 489
                         JitsiTrackEvents.TRACK_AUDIO_OUTPUT_CHANGED,

+ 4
- 3
modules/RTC/LocalSdpMunger.js 查看文件

@@ -76,9 +76,10 @@ export default class LocalSdpMunger {
76 76
             const shouldFakeSdp = muted || !isInPeerConnection;
77 77
 
78 78
             logger.debug(
79
-                `${this.tpc} ${videoTrack} muted: ${muted
80
-                    }, is in PeerConnection: ${isInPeerConnection
81
-                    } => should fake sdp ? : ${shouldFakeSdp}`);
79
+                `${this.tpc} ${videoTrack} muted: ${
80
+                    muted}, is in PeerConnection: ${
81
+                    isInPeerConnection} => should fake sdp ? : ${
82
+                    shouldFakeSdp}`);
82 83
 
83 84
             if (!shouldFakeSdp) {
84 85
                 continue; // eslint-disable-line no-continue

+ 4
- 3
modules/RTC/RTCUIHelper.js 查看文件

@@ -28,14 +28,15 @@ const RTCUIHelper = {
28 28
         if (!RTCBrowserType.isTemasysPluginUsed()) {
29 29
             return $(containerElement).find(videoElemName)[0];
30 30
         }
31
-        const matching = $(containerElement).find(
31
+        const matching
32
+            = $(containerElement).find(
32 33
                 ` ${videoElemName}>param[value="video"]`);
33 34
 
34 35
         if (matching.length) {
35 36
             if (matching.length > 1) {
36 37
                 logger.warn(
37
-                        'Container with more than one video elements: ',
38
-                        containerElement);
38
+                    'Container with more than one video elements: ',
39
+                    containerElement);
39 40
             }
40 41
 
41 42
             return matching.parent()[0];

+ 41
- 36
modules/RTC/RTCUtils.js 查看文件

@@ -83,25 +83,26 @@ let rawEnumerateDevicesWithCallback;
83 83
  *
84 84
  */
85 85
 function initRawEnumerateDevicesWithCallback() {
86
-    rawEnumerateDevicesWithCallback = navigator.mediaDevices
87
-        && navigator.mediaDevices.enumerateDevices
88
-        ? function(callback) {
89
-            navigator.mediaDevices.enumerateDevices().then(
90
-                callback,
91
-                () => callback([]));
92
-        }
86
+    rawEnumerateDevicesWithCallback
87
+        = navigator.mediaDevices && navigator.mediaDevices.enumerateDevices
88
+            ? function(callback) {
89
+                navigator.mediaDevices.enumerateDevices().then(
90
+                    callback,
91
+                    () => callback([]));
92
+            }
93 93
 
94
-        // Safari:
95
-        // "ReferenceError: Can't find variable: MediaStreamTrack"
96
-        // when Temasys plugin is not installed yet, have to delay this call
97
-        // until WebRTC is ready.
98
-        : MediaStreamTrack && MediaStreamTrack.getSources
99
-        ? function(callback) {
100
-            MediaStreamTrack.getSources(
101
-                sources =>
102
-                    callback(sources.map(convertMediaStreamTrackSource)));
103
-        }
104
-        : undefined;
94
+            // Safari:
95
+            // "ReferenceError: Can't find variable: MediaStreamTrack" when
96
+            // Temasys plugin is not installed yet, have to delay this call
97
+            // until WebRTC is ready.
98
+            : MediaStreamTrack && MediaStreamTrack.getSources
99
+                ? function(callback) {
100
+                    MediaStreamTrack.getSources(
101
+                        sources =>
102
+                            callback(
103
+                                sources.map(convertMediaStreamTrackSource)));
104
+                }
105
+                : undefined;
105 106
 }
106 107
 
107 108
 // TODO: currently no browser supports 'devicechange' event even in nightly
@@ -120,10 +121,13 @@ let rtcReady = false;
120 121
 /**
121 122
  *
122 123
  * @param constraints
124
+ * @param isNewStyleConstraintsSupported
123 125
  * @param resolution
124 126
  */
125 127
 function setResolutionConstraints(
126
-    constraints, isNewStyleConstraintsSupported, resolution) {
128
+        constraints,
129
+        isNewStyleConstraintsSupported,
130
+        resolution) {
127 131
     if (Resolutions[resolution]) {
128 132
         if (isNewStyleConstraintsSupported) {
129 133
             constraints.video.width = {
@@ -371,15 +375,14 @@ function compareAvailableMediaDevices(newDevices) {
371 375
         return true;
372 376
     }
373 377
 
378
+    /* eslint-disable newline-per-chained-call */
379
+
374 380
     return (
375
-        newDevices
376
-                .map(mediaDeviceInfoToJSON)
377
-                .sort()
378
-                .join('')
381
+        newDevices.map(mediaDeviceInfoToJSON).sort().join('')
379 382
             !== currentlyAvailableMediaDevices
380
-                .map(mediaDeviceInfoToJSON)
381
-                .sort()
382
-                .join(''));
383
+                .map(mediaDeviceInfoToJSON).sort().join(''));
384
+
385
+    /* eslint-enable newline-per-chained-call */
383 386
 
384 387
     /**
385 388
      *
@@ -581,9 +584,9 @@ function handleLocalStream(streams, resolution) {
581 584
                 }
582 585
             }
583 586
         } else {
584
-          // On other types of browser (e.g. Firefox) we choose (namely,
585
-          // obtainAudioAndVideoPermissions) to call getUserMedia per device
586
-          // (type).
587
+            // On other types of browser (e.g. Firefox) we choose (namely,
588
+            // obtainAudioAndVideoPermissions) to call getUserMedia per device
589
+            // (type).
587 590
             audioStream = streams.audio;
588 591
             videoStream = streams.video;
589 592
         }
@@ -854,7 +857,7 @@ class RTCUtils extends Listenable {
854 857
                     = wrapGetUserMedia(
855 858
                         navigator.mediaDevices.getUserMedia.bind(
856 859
                             navigator.mediaDevices),
857
-                            true);
860
+                        true);
858 861
                 this.enumerateDevices = rawEnumerateDevicesWithCallback;
859 862
                 this.attachMediaStream
860 863
                     = wrapAttachMediaStream((element, stream) => {
@@ -1245,8 +1248,8 @@ class RTCUtils extends Listenable {
1245 1248
 
1246 1249
             eventEmitter.addListener(RTCEvents.RTC_READY, listener);
1247 1250
 
1248
-                // We have no failed event, so... it either resolves or nothing
1249
-                // happens
1251
+            // We have no failed event, so... it either resolves or nothing
1252
+            // happens.
1250 1253
         });
1251 1254
 
1252 1255
     }
@@ -1499,10 +1502,12 @@ function wrapAttachMediaStream(origAttachMediaStream) {
1499 1502
                         reason: err
1500 1503
                     });
1501 1504
 
1502
-                    logger.warn('Failed to set audio output device for the '
1503
-                        + 'element. Default audio output device will be used '
1504
-                        + 'instead',
1505
-                        element, err);
1505
+                    logger.warn(
1506
+                        'Failed to set audio output device for the element.'
1507
+                            + ' Default audio output device will be used'
1508
+                            + ' instead',
1509
+                        element,
1510
+                        err);
1506 1511
                 });
1507 1512
         }
1508 1513
 

+ 6
- 5
modules/RTC/ScreenObtainer.js 查看文件

@@ -650,8 +650,9 @@ function initChromeExtension(options) {
650 650
             chromeExtInstalled = installed;
651 651
             chromeExtUpdateRequired = updateRequired;
652 652
             logger.info(
653
-                `Chrome extension installed: ${chromeExtInstalled
654
-                    } updateRequired: ${chromeExtUpdateRequired}`);
653
+                `Chrome extension installed: ${
654
+                    chromeExtInstalled} updateRequired: ${
655
+                    chromeExtUpdateRequired}`);
655 656
             resolve();
656 657
         }, options);
657 658
     });
@@ -763,9 +764,9 @@ function initFirefoxExtensionDetection(options) {
763 764
     // "chrome://EXT_ID/content/DOMAIN.png"
764 765
     // Where EXT_ID is the ID of the extension with "@" replaced by ".", and
765 766
     // DOMAIN is a domain whitelisted by the extension.
766
-    const src
767
-        = `chrome://${options.desktopSharingFirefoxExtId.replace('@', '.')
768
-            }/content/${document.location.hostname}.png`;
767
+    const extId = options.desktopSharingFirefoxExtId.replace('@', '.');
768
+    const domain = document.location.hostname;
769
+    const src = `chrome://${extId}/content/${domain}.png`;
769 770
 
770 771
     img.setAttribute('src', src);
771 772
 }

+ 84
- 57
modules/RTC/TraceablePeerConnection.js 查看文件

@@ -350,8 +350,8 @@ TraceablePeerConnection.prototype.getConnectionState = function() {
350 350
  * connection.
351 351
  * @private
352 352
  */
353
-TraceablePeerConnection.prototype._getDesiredMediaDirection
354
-= function(mediaType) {
353
+TraceablePeerConnection.prototype._getDesiredMediaDirection = function(
354
+        mediaType) {
355 355
     let mediaTransferActive = true;
356 356
 
357 357
     if (mediaType === MediaType.AUDIO) {
@@ -390,8 +390,9 @@ TraceablePeerConnection.prototype.isSimulcastOn = function() {
390 390
  * @param {VideoType} videoType the new value
391 391
  * @private
392 392
  */
393
-TraceablePeerConnection.prototype._peerVideoTypeChanged
394
-= function(endpointId, videoType) {
393
+TraceablePeerConnection.prototype._peerVideoTypeChanged = function(
394
+        endpointId,
395
+        videoType) {
395 396
     // Check if endpointId has a value to avoid action on random track
396 397
     if (!endpointId) {
397 398
         logger.error(`No endpointID on peerVideoTypeChanged ${this}`);
@@ -413,8 +414,10 @@ TraceablePeerConnection.prototype._peerVideoTypeChanged
413 414
  * @param {boolean} isMuted the new mute state
414 415
  * @private
415 416
  */
416
-TraceablePeerConnection.prototype._peerMutedChanged
417
-= function(endpointId, mediaType, isMuted) {
417
+TraceablePeerConnection.prototype._peerMutedChanged = function(
418
+        endpointId,
419
+        mediaType,
420
+        isMuted) {
418 421
     // Check if endpointId is a value to avoid doing action on all remote tracks
419 422
     if (!endpointId) {
420 423
         logger.error('On peerMuteChanged - no endpoint ID');
@@ -466,8 +469,9 @@ TraceablePeerConnection.prototype.hasAnyTracksOfType = function(mediaType) {
466 469
  * by their media type if this argument is specified.
467 470
  * @return {Array<JitsiRemoteTrack>}
468 471
  */
469
-TraceablePeerConnection.prototype.getRemoteTracks
470
-= function(endpointId, mediaType) {
472
+TraceablePeerConnection.prototype.getRemoteTracks = function(
473
+        endpointId,
474
+        mediaType) {
471 475
     const remoteTracks = [];
472 476
     const endpoints
473 477
         = endpointId ? [ endpointId ] : this.remoteTracks.keys();
@@ -594,8 +598,9 @@ TraceablePeerConnection.prototype._remoteTrackAdded = function(stream, track) {
594 598
     if (!mediaLines.length) {
595 599
         GlobalOnErrorHandler.callErrorHandler(
596 600
             new Error(
597
-                `No media lines for type ${mediaType
598
-                     } found in remote SDP for remote track: ${streamId}`));
601
+                `No media lines for type ${
602
+                    mediaType} found in remote SDP for remote track: ${
603
+                    streamId}`));
599 604
 
600 605
         // Abort
601 606
         return;
@@ -614,8 +619,8 @@ TraceablePeerConnection.prototype._remoteTrackAdded = function(stream, track) {
614 619
     if (!ssrcLines.length) {
615 620
         GlobalOnErrorHandler.callErrorHandler(
616 621
             new Error(
617
-                `No SSRC lines for streamId ${streamId
618
-                     } for remote track, media type: ${mediaType}`));
622
+                `No SSRC lines for streamId ${
623
+                    streamId} for remote track, media type: ${mediaType}`));
619 624
 
620 625
         // Abort
621 626
         return;
@@ -630,18 +635,17 @@ TraceablePeerConnection.prototype._remoteTrackAdded = function(stream, track) {
630 635
     if (isNaN(trackSsrc) || trackSsrc < 0) {
631 636
         GlobalOnErrorHandler.callErrorHandler(
632 637
             new Error(
633
-                `Invalid SSRC: ${ssrcStr
634
-                    } for remote track, msid: ${streamId
635
-                    } media type: ${mediaType}`));
638
+                `Invalid SSRC: ${ssrcStr} for remote track, msid: ${
639
+                    streamId} media type: ${mediaType}`));
636 640
 
637 641
         // Abort
638 642
         return;
639 643
     } else if (!ownerEndpointId) {
640 644
         GlobalOnErrorHandler.callErrorHandler(
641 645
             new Error(
642
-                `No SSRC owner known for: ${trackSsrc
643
-                     } for remote track, msid: ${streamId
644
-                     } media type: ${mediaType}`));
646
+                `No SSRC owner known for: ${
647
+                    trackSsrc} for remote track, msid: ${
648
+                    streamId} media type: ${mediaType}`));
645 649
 
646 650
         // Abort
647 651
         return;
@@ -683,8 +687,14 @@ TraceablePeerConnection.prototype._remoteTrackAdded = function(stream, track) {
683 687
  * @param {number} ssrc the track's main SSRC number
684 688
  * @param {boolean} muted the initial muted status
685 689
  */
686
-TraceablePeerConnection.prototype._createRemoteTrack
687
-= function(ownerEndpointId, stream, track, mediaType, videoType, ssrc, muted) {
690
+TraceablePeerConnection.prototype._createRemoteTrack = function(
691
+        ownerEndpointId,
692
+        stream,
693
+        track,
694
+        mediaType,
695
+        videoType,
696
+        ssrc,
697
+        muted) {
688 698
     const remoteTrack
689 699
         = new JitsiRemoteTrack(
690 700
             this.rtc, this.rtc.conference,
@@ -744,8 +754,9 @@ TraceablePeerConnection.prototype._remoteStreamRemoved = function(stream) {
744 754
  * @param {MediaStreamTrack} track the WebRTC MediaStreamTrack which has been
745 755
  * removed from the PeerConnection.
746 756
  */
747
-TraceablePeerConnection.prototype._remoteTrackRemoved
748
-= function(stream, track) {
757
+TraceablePeerConnection.prototype._remoteTrackRemoved = function(
758
+        stream,
759
+        track) {
749 760
     const streamId = RTC.getStreamID(stream);
750 761
     const trackId = track && RTC.getTrackID(track);
751 762
 
@@ -790,8 +801,9 @@ TraceablePeerConnection.prototype._remoteTrackRemoved
790 801
  * <tt>undefined</tt> if not found.
791 802
  * @private
792 803
  */
793
-TraceablePeerConnection.prototype._getRemoteTrackById
794
-= function(streamId, trackId) {
804
+TraceablePeerConnection.prototype._getRemoteTrackById = function(
805
+        streamId,
806
+        trackId) {
795 807
     // .find will break the loop once the first match is found
796 808
     for (const endpointTrackMap of this.remoteTracks.values()) {
797 809
         for (const mediaTrack of endpointTrackMap.values()) {
@@ -831,8 +843,8 @@ TraceablePeerConnection.prototype.removeRemoteTracks = function(owner) {
831 843
     }
832 844
 
833 845
     logger.debug(
834
-        `${this} removed remote tracks for ${owner
835
-            } count: ${removedTracks.length}`);
846
+        `${this} removed remote tracks for ${owner} count: ${
847
+            removedTracks.length}`);
836 848
 
837 849
     return removedTracks;
838 850
 };
@@ -867,8 +879,9 @@ TraceablePeerConnection.prototype._removeRemoteTrack = function(toBeRemoved) {
867 879
  * <tt>undefined</tt> if no track matching given stream and track ids was
868 880
  * found.
869 881
  */
870
-TraceablePeerConnection.prototype._removeRemoteTrackById
871
-= function(streamId, trackId) {
882
+TraceablePeerConnection.prototype._removeRemoteTrackById = function(
883
+        streamId,
884
+        trackId) {
872 885
     const toBeRemoved = this._getRemoteTrackById(streamId, trackId);
873 886
 
874 887
     if (toBeRemoved) {
@@ -930,8 +943,8 @@ function extractSSRCMap(desc) {
930 943
                     && typeof group.ssrcs !== 'undefined') {
931 944
                     // Parse SSRCs and store as numbers
932 945
                     const groupSSRCs
933
-                        = group.ssrcs.split(' ')
934
-                                     .map(ssrcStr => parseInt(ssrcStr, 10));
946
+                        = group.ssrcs.split(' ').map(
947
+                            ssrcStr => parseInt(ssrcStr, 10));
935 948
                     const primarySSRC = groupSSRCs[0];
936 949
 
937 950
                     // Note that group.semantics is already present
@@ -1326,8 +1339,9 @@ TraceablePeerConnection.prototype._removeStream = function(mediaStream) {
1326 1339
  * <tt>false</tt> otherwise.
1327 1340
  * @private
1328 1341
  */
1329
-TraceablePeerConnection.prototype._assertTrackBelongs
1330
-= function(methodName, localTrack) {
1342
+TraceablePeerConnection.prototype._assertTrackBelongs = function(
1343
+        methodName,
1344
+        localTrack) {
1331 1345
     const doesBelong = this.localTracks.has(localTrack.rtcId);
1332 1346
 
1333 1347
     if (!doesBelong) {
@@ -1414,8 +1428,8 @@ TraceablePeerConnection.prototype.removeTrackMute = function(localTrack) {
1414 1428
  * Remove stream handling for firefox
1415 1429
  * @param stream: webrtc media stream
1416 1430
  */
1417
-TraceablePeerConnection.prototype._handleFirefoxRemoveStream
1418
-= function(stream) {
1431
+TraceablePeerConnection.prototype._handleFirefoxRemoveStream = function(
1432
+        stream) {
1419 1433
     if (!stream) {
1420 1434
         // There is nothing to be changed
1421 1435
         return;
@@ -1472,8 +1486,8 @@ TraceablePeerConnection.prototype.createDataChannel = function(label, opts) {
1472 1486
  * the local description.
1473 1487
  * @private
1474 1488
  */
1475
-TraceablePeerConnection.prototype._ensureSimulcastGroupIsLast
1476
-= function(localSdp) {
1489
+TraceablePeerConnection.prototype._ensureSimulcastGroupIsLast = function(
1490
+        localSdp) {
1477 1491
     let sdpStr = localSdp.sdp;
1478 1492
 
1479 1493
     const videoStartIndex = sdpStr.indexOf('m=video');
@@ -1509,8 +1523,8 @@ TraceablePeerConnection.prototype._ensureSimulcastGroupIsLast
1509 1523
  * the local description.
1510 1524
  * @private
1511 1525
  */
1512
-TraceablePeerConnection.prototype._adjustLocalMediaDirection
1513
-= function(localDescription) {
1526
+TraceablePeerConnection.prototype._adjustLocalMediaDirection = function(
1527
+        localDescription) {
1514 1528
     const transformer = new SdpTransformWrap(localDescription.sdp);
1515 1529
     let modifiedDirection = false;
1516 1530
     const audioMedia = transformer.selectMedia('audio');
@@ -1550,8 +1564,10 @@ TraceablePeerConnection.prototype._adjustLocalMediaDirection
1550 1564
     }
1551 1565
 };
1552 1566
 
1553
-TraceablePeerConnection.prototype.setLocalDescription
1554
-= function(description, successCallback, failureCallback) {
1567
+TraceablePeerConnection.prototype.setLocalDescription = function(
1568
+        description,
1569
+        successCallback,
1570
+        failureCallback) {
1555 1571
     let localSdp = description;
1556 1572
 
1557 1573
     this.trace('setLocalDescription::preTransform', dumpSDP(localSdp));
@@ -1662,8 +1678,10 @@ TraceablePeerConnection.prototype._insertUnifiedPlanSimulcastReceive
1662 1678
         return desc;
1663 1679
     };
1664 1680
 
1665
-TraceablePeerConnection.prototype.setRemoteDescription
1666
-= function(description, successCallback, failureCallback) {
1681
+TraceablePeerConnection.prototype.setRemoteDescription = function(
1682
+        description,
1683
+        successCallback,
1684
+        failureCallback) {
1667 1685
     this.trace('setRemoteDescription::preTransform', dumpSDP(description));
1668 1686
 
1669 1687
     // TODO the focus should squeze or explode the remote simulcast
@@ -1685,19 +1703,20 @@ TraceablePeerConnection.prototype.setRemoteDescription
1685 1703
     if (RTCBrowserType.usesUnifiedPlan()) {
1686 1704
         description.sdp = this.rtxModifier.stripRtx(description.sdp);
1687 1705
         this.trace(
1688
-                'setRemoteDescription::postTransform (stripRtx)',
1689
-                dumpSDP(description));
1706
+            'setRemoteDescription::postTransform (stripRtx)',
1707
+            dumpSDP(description));
1690 1708
 
1691 1709
         // eslint-disable-next-line no-param-reassign
1692 1710
         description = this.interop.toUnifiedPlan(description);
1693 1711
         this.trace(
1694
-                'setRemoteDescription::postTransform (Plan A)',
1695
-                dumpSDP(description));
1712
+            'setRemoteDescription::postTransform (Plan A)',
1713
+            dumpSDP(description));
1696 1714
 
1697 1715
         if (this.isSimulcastOn()) {
1698 1716
             // eslint-disable-next-line no-param-reassign
1699 1717
             description = this._insertUnifiedPlanSimulcastReceive(description);
1700
-            this.trace('setRemoteDescription::postTransform (sim receive)',
1718
+            this.trace(
1719
+                'setRemoteDescription::postTransform (sim receive)',
1701 1720
                 dumpSDP(description));
1702 1721
         }
1703 1722
     } else {
@@ -1864,10 +1883,11 @@ const _fixAnswerRFC4145Setup = function(offer, answer) {
1864 1883
     }
1865 1884
 };
1866 1885
 
1867
-TraceablePeerConnection.prototype.createAnswer
1868
-= function(successCallback, failureCallback, constraints) {
1869
-    if (RTCBrowserType.supportsRtpSender()
1870
-            && this.isSimulcastOn()) {
1886
+TraceablePeerConnection.prototype.createAnswer = function(
1887
+        successCallback,
1888
+        failureCallback,
1889
+        constraints) {
1890
+    if (RTCBrowserType.supportsRtpSender() && this.isSimulcastOn()) {
1871 1891
         const videoSender
1872 1892
             = this.peerconnection.getSenders().find(sender =>
1873 1893
                 sender.track.kind === 'video');
@@ -1893,16 +1913,21 @@ TraceablePeerConnection.prototype.createAnswer
1893 1913
         false /* answer */, successCallback, failureCallback, constraints);
1894 1914
 };
1895 1915
 
1896
-TraceablePeerConnection.prototype.createOffer
1897
-= function(successCallback, failureCallback, constraints) {
1916
+TraceablePeerConnection.prototype.createOffer = function(
1917
+        successCallback,
1918
+        failureCallback,
1919
+        constraints) {
1898 1920
     this._createOfferOrAnswer(
1899 1921
         true /* offer */, successCallback, failureCallback, constraints);
1900 1922
 };
1901 1923
 
1902 1924
 /* eslint-disable max-params */
1903 1925
 
1904
-TraceablePeerConnection.prototype._createOfferOrAnswer
1905
-= function(isOffer, successCallback, failureCallback, constraints) {
1926
+TraceablePeerConnection.prototype._createOfferOrAnswer = function(
1927
+        isOffer,
1928
+        successCallback,
1929
+        failureCallback,
1930
+        constraints) {
1906 1931
     const logName = isOffer ? 'Offer' : 'Answer';
1907 1932
 
1908 1933
     this.trace(`create${logName}`, JSON.stringify(constraints, null, ' '));
@@ -2082,8 +2107,10 @@ TraceablePeerConnection.prototype._processLocalSSRCsMap = function(ssrcMap) {
2082 2107
     }
2083 2108
 };
2084 2109
 
2085
-TraceablePeerConnection.prototype.addIceCandidate
2086
-= function(candidate, successCallback, failureCallback) {
2110
+TraceablePeerConnection.prototype.addIceCandidate = function(
2111
+        candidate,
2112
+        successCallback,
2113
+        failureCallback) {
2087 2114
     // var self = this;
2088 2115
     this.trace('addIceCandidate', JSON.stringify(candidate, null, ' '));
2089 2116
     this.peerconnection.addIceCandidate(

+ 4
- 4
modules/connectivity/ConnectionQuality.js 查看文件

@@ -490,7 +490,7 @@ export default class ConnectionQuality {
490 490
      * @param data the statistics received
491 491
      */
492 492
     _updateRemoteStats(id, data) {
493
-            // Use only the fields we need
493
+        // Use only the fields we need
494 494
         this._remoteStats[id] = {
495 495
             bitrate: data.bitrate,
496 496
             packetLoss: data.packetLoss,
@@ -499,9 +499,9 @@ export default class ConnectionQuality {
499 499
         };
500 500
 
501 501
         this.eventEmitter.emit(
502
-                ConnectionQualityEvents.REMOTE_STATS_UPDATED,
503
-                id,
504
-                this._remoteStats[id]);
502
+            ConnectionQualityEvents.REMOTE_STATS_UPDATED,
503
+            id,
504
+            this._remoteStats[id]);
505 505
     }
506 506
 
507 507
     /**

+ 12
- 13
modules/connectivity/ParticipantConnectionStatus.js 查看文件

@@ -99,12 +99,11 @@ export default class ParticipantConnectionStatusHandler {
99 99
      * @private
100 100
      */
101 101
     static _getNewStateForJvbMode(
102
-        isConnectionActiveByJvb,
103
-        isInLastN,
104
-        isRestoringTimedout,
105
-        isVideoMuted,
106
-        isVideoTrackFrozen) {
107
-
102
+            isConnectionActiveByJvb,
103
+            isInLastN,
104
+            isRestoringTimedout,
105
+            isVideoMuted,
106
+            isVideoTrackFrozen) {
108 107
         if (!isConnectionActiveByJvb) {
109 108
             // when there is a connection problem signaled from jvb
110 109
             // it means no media was flowing for at least 15secs, so both audio
@@ -607,13 +606,13 @@ export default class ParticipantConnectionStatusHandler {
607 606
         }
608 607
 
609 608
         logger.debug(
610
-            `Figure out conn status for ${id}, is video muted: ${isVideoMuted
611
-                 } is active(jvb): ${isConnActiveByJvb
612
-                 } video track frozen: ${isVideoTrackFrozen
613
-                 } p2p mode: ${inP2PMode
614
-                 } is in last N: ${isInLastN
615
-                 } currentStatus => newStatus: 
616
-                    ${participant.getConnectionStatus()} => ${newState}`);
609
+            `Figure out conn status for ${id}, is video muted: ${
610
+                isVideoMuted} is active(jvb): ${
611
+                isConnActiveByJvb} video track frozen: ${
612
+                isVideoTrackFrozen} p2p mode: ${
613
+                inP2PMode} is in last N: ${
614
+                isInLastN} currentStatus => newStatus: ${
615
+                participant.getConnectionStatus()} => ${newState}`);
617 616
 
618 617
         this._changeConnectionStatus(participant, newState);
619 618
     }

+ 12
- 9
modules/statistics/AvgRTPStatsReporter.js 查看文件

@@ -781,7 +781,8 @@ export default class AvgRTPStatsReporter {
781 781
             if (isLocal ? peerID === myID : peerID !== myID) {
782 782
                 const participant
783 783
                     = isLocal
784
-                    ? null : this._conference.getParticipantById(peerID);
784
+                        ? null
785
+                        : this._conference.getParticipantById(peerID);
785 786
                 const videosResolution = peerResolutions[peerID];
786 787
 
787 788
                 // Do not continue without participant for non local peerID
@@ -824,19 +825,21 @@ export default class AvgRTPStatsReporter {
824 825
             if (videoTracks) {
825 826
                 ssrcs
826 827
                     = ssrcs.filter(
827
-                    ssrc => videoTracks.find(
828
-                        track => !track.isMuted()
829
-                            && track.getSSRC() === ssrc
830
-                            && track.videoType === videoType));
828
+                        ssrc => videoTracks.find(
829
+                            track =>
830
+                                !track.isMuted()
831
+                                    && track.getSSRC() === ssrc
832
+                                    && track.videoType === videoType));
831 833
             }
832 834
         } else {
833 835
             videoTracks = this._conference.getLocalTracks(MediaType.VIDEO);
834 836
             ssrcs
835 837
                 = ssrcs.filter(
836
-                ssrc => videoTracks.find(
837
-                    track => !track.isMuted()
838
-                        && tpc.getLocalSSRC(track) === ssrc
839
-                        && track.videoType === videoType));
838
+                    ssrc => videoTracks.find(
839
+                        track =>
840
+                            !track.isMuted()
841
+                                && tpc.getLocalSSRC(track) === ssrc
842
+                                && track.videoType === videoType));
840 843
         }
841 844
 
842 845
         let peerPixelsSum = 0;

+ 1
- 2
modules/statistics/CallStats.js 查看文件

@@ -278,8 +278,7 @@ export default class CallStats {
278 278
         const originalReportError = theBackend.reportError;
279 279
 
280 280
         /* eslint-disable max-params */
281
-        theBackend.reportError
282
-        = function(pc, cs, type, ...args) {
281
+        theBackend.reportError = function(pc, cs, type, ...args) {
283 282
             // Logs from the logger are submitted on the applicationLog event
284 283
             // "type". Logging the arguments on the logger will create endless
285 284
             // loop, because it will put all the logs to the logger queue again.

+ 6
- 5
modules/statistics/RTPStatsCollector.js 查看文件

@@ -517,9 +517,9 @@ StatsCollector.prototype.processStatsReport = function() {
517 517
 
518 518
             if (!conferenceStatsTransport.some(
519 519
                     t =>
520
-                       t.ip === ip
521
-                       && t.type === type
522
-                       && t.localip === localip)) {
520
+                        t.ip === ip
521
+                            && t.type === type
522
+                            && t.localip === localip)) {
523 523
                 conferenceStatsTransport.push({
524 524
                     ip,
525 525
                     type,
@@ -822,8 +822,9 @@ StatsCollector.prototype.processStatsReport = function() {
822 822
 
823 823
     this.conferenceStats.packetLoss = {
824 824
         total:
825
-            calculatePacketLoss(lostPackets.download + lostPackets.upload,
826
-                    totalPackets.download + totalPackets.upload),
825
+            calculatePacketLoss(
826
+                lostPackets.download + lostPackets.upload,
827
+                totalPackets.download + totalPackets.upload),
827 828
         download:
828 829
             calculatePacketLoss(lostPackets.download, totalPackets.download),
829 830
         upload:

+ 1
- 1
modules/statistics/SpeakerStats.spec.js 查看文件

@@ -54,7 +54,7 @@ describe('SpeakerStats', () => {
54 54
             }
55 55
 
56 56
             expect(speakerStats.getTotalDominantSpeakerTime())
57
-              .toBe(domaintSpeakerTime * domaintSpeakerEvents);
57
+                .toBe(domaintSpeakerTime * domaintSpeakerEvents);
58 58
         });
59 59
     });
60 60
 });

+ 9
- 6
modules/statistics/statistics.js 查看文件

@@ -38,10 +38,10 @@ let isCallstatsLoaded = false;
38 38
 function loadCallStatsAPI(customScriptUrl) {
39 39
     if (!isCallstatsLoaded) {
40 40
         ScriptUtil.loadScript(
41
-                customScriptUrl ? customScriptUrl
42
-                    : 'https://api.callstats.io/static/callstats-ws.min.js',
43
-                /* async */ true,
44
-                /* prepend */ true);
41
+            customScriptUrl
42
+                || 'https://api.callstats.io/static/callstats-ws.min.js',
43
+            /* async */ true,
44
+            /* prepend */ true);
45 45
         isCallstatsLoaded = true;
46 46
     }
47 47
 
@@ -164,8 +164,11 @@ Statistics.prototype.startRemoteStats = function(peerconnection) {
164 164
 
165 165
     try {
166 166
         const rtpStats
167
-            = new RTPStats(peerconnection,
168
-                    Statistics.audioLevelsInterval, 2000, this.eventEmitter);
167
+            = new RTPStats(
168
+                peerconnection,
169
+                Statistics.audioLevelsInterval,
170
+                2000,
171
+                this.eventEmitter);
169 172
 
170 173
         rtpStats.start(Statistics.audioLevelsEnabled);
171 174
         this.rtpStatsMap.set(peerconnection.id, rtpStats);

+ 8
- 8
modules/transcription/audioRecorder.js 查看文件

@@ -5,8 +5,8 @@ const RecordingResult = require('./recordingResult');
5 5
 /**
6 6
  * Possible audio formats MIME types
7 7
  */
8
-const AUDIO_WEBM = 'audio/webm';    // Supported in chrome
9
-const AUDIO_OGG = 'audio/ogg';     // Supported in firefox
8
+const AUDIO_WEBM = 'audio/webm'; // Supported in chrome
9
+const AUDIO_OGG = 'audio/ogg'; // Supported in firefox
10 10
 
11 11
 /**
12 12
  * A TrackRecorder object holds all the information needed for recording a
@@ -282,12 +282,12 @@ AudioRecorder.prototype.getRecordingResults = function() {
282 282
     const array = [];
283 283
 
284 284
     this.recorders.forEach(
285
-          recorder =>
286
-              array.push(
287
-                  new RecordingResult(
288
-                      new Blob(recorder.data, { type: this.fileType }),
289
-                      recorder.name,
290
-                      recorder.startTime)));
285
+        recorder =>
286
+            array.push(
287
+                new RecordingResult(
288
+                    new Blob(recorder.data, { type: this.fileType }),
289
+                    recorder.name,
290
+                    recorder.startTime)));
291 291
 
292 292
     return array;
293 293
 };

+ 7
- 7
modules/transcription/transcriber.js 查看文件

@@ -59,8 +59,8 @@ Transcriber.prototype.start = function start() {
59 59
     if (this.state !== BEFORE_STATE) {
60 60
         throw new Error(
61 61
             `The transcription can only start when it's in the "${
62
-                 BEFORE_STATE}" state. It's currently in the "${
63
-                 this.state}" state`);
62
+                BEFORE_STATE}" state. It's currently in the "${
63
+                this.state}" state`);
64 64
     }
65 65
     this.state = RECORDING_STATE;
66 66
     this.audioRecorder.start();
@@ -77,8 +77,8 @@ Transcriber.prototype.stop = function stop(callback) {
77 77
     if (this.state !== RECORDING_STATE) {
78 78
         throw new Error(
79 79
             `The transcription can only stop when it's in the "${
80
-                 RECORDING_STATE}" state. It's currently in the "${
81
-                 this.state}" state`);
80
+                RECORDING_STATE}" state. It's currently in the "${
81
+                this.state}" state`);
82 82
     }
83 83
 
84 84
     // stop the recording
@@ -171,7 +171,7 @@ Transcriber.prototype.maybeMerge = function() {
171 171
 Transcriber.prototype.merge = function() {
172 172
     console.log(
173 173
         `starting merge process!\n The length of the array: ${
174
-             this.results.length}`);
174
+            this.results.length}`);
175 175
     this.transcription = '';
176 176
 
177 177
     // the merging algorithm will look over all Word objects who are at pos 0 in
@@ -329,8 +329,8 @@ Transcriber.prototype.getTranscription = function() {
329 329
     if (this.state !== FINISHED_STATE) {
330 330
         throw new Error(
331 331
             `The transcription can only be retrieved when it's in the "${
332
-                 FINISHED_STATE}" state. It's currently in the "${
333
-                 this.state}" state`);
332
+                FINISHED_STATE}" state. It's currently in the "${
333
+                this.state}" state`);
334 334
     }
335 335
 
336 336
     return this.transcription;

+ 19
- 19
modules/xmpp/Caps.js 查看文件

@@ -126,10 +126,8 @@ export default class Caps extends Listenable {
126 126
                         .each(
127 127
                             (idx, el) => features.add(el.getAttribute('var')));
128 128
                     if (user) {
129
-                            // TODO: Maybe use the version + node + hash
130
-                            // as keys?
131
-                        this.versionToCapabilities[user.version]
132
-                                = features;
129
+                        // TODO: Maybe use the version + node + hash as keys?
130
+                        this.versionToCapabilities[user.version] = features;
133 131
                     }
134 132
                     resolve(features);
135 133
                 }, reject, timeout)
@@ -188,21 +186,23 @@ export default class Caps extends Listenable {
188 186
      * Generates the value for the "ver" attribute.
189 187
      */
190 188
     _generateVersion() {
191
-        const identities = this.disco._identities.sort(compareIdentities);
192
-        const features = this.disco._features.sort();
193
-
194
-        this.version = b64_sha1(
195
-            identities.reduce(
196
-                    (accumulatedValue, identity) =>
197
-                        `${IDENTITY_PROPERTIES.reduce(
198
-                                (tmp, key, idx) =>
199
-                                    tmp
200
-                                        + (idx === 0 ? '' : '/')
201
-                                        + identity[key],
202
-                                '')
203
-                             }<`,
204
-                    '')
205
-                + features.reduce((tmp, feature) => `${tmp + feature}<`, ''));
189
+        const identities
190
+          = this.disco._identities.sort(compareIdentities).reduce(
191
+              (accumulatedValue, identity) =>
192
+                  `${
193
+                      IDENTITY_PROPERTIES.reduce(
194
+                          (tmp, key, idx) =>
195
+                              tmp
196
+                                  + (idx === 0 ? '' : '/')
197
+                                  + identity[key],
198
+                          '')
199
+                  }<`,
200
+              '');
201
+        const features
202
+            = this.disco._features.sort().reduce(
203
+                (tmp, feature) => `${tmp + feature}<`, '');
204
+
205
+        this.version = b64_sha1(identities + features);
206 206
         this._notifyVersionChanged();
207 207
     }
208 208
 

+ 36
- 27
modules/xmpp/ChatRoom.js 查看文件

@@ -1,4 +1,5 @@
1 1
 /* global $, $pres, $iq, $msg, __filename, Strophe */
2
+
2 3
 import { getLogger } from 'jitsi-meet-logger';
3 4
 import GlobalOnErrorHandler from '../util/GlobalOnErrorHandler';
4 5
 import * as JitsiTranscriptionStatus from '../../JitsiTranscriptionStatus';
@@ -310,16 +311,19 @@ export default class ChatRoom extends Listenable {
310 311
      *
311 312
      */
312 313
     discoRoomInfo() {
313
-      // https://xmpp.org/extensions/xep-0045.html#disco-roominfo
314
+        // https://xmpp.org/extensions/xep-0045.html#disco-roominfo
314 315
 
315
-        const getInfo = $iq({ type: 'get',
316
-            to: this.roomjid })
317
-        .c('query', { xmlns: Strophe.NS.DISCO_INFO });
316
+        const getInfo
317
+            = $iq({
318
+                type: 'get',
319
+                to: this.roomjid
320
+            })
321
+                .c('query', { xmlns: Strophe.NS.DISCO_INFO });
318 322
 
319 323
         this.connection.sendIQ(getInfo, result => {
320 324
             const locked
321 325
                 = $(result).find('>query>feature[var="muc_passwordprotected"]')
322
-                        .length
326
+                    .length
323 327
                     === 1;
324 328
 
325 329
             if (locked !== this.locked) {
@@ -522,8 +526,10 @@ export default class ChatRoom extends Listenable {
522 526
             switch (node.tagName) {
523 527
             case 'nick':
524 528
                 if (!member.isFocus) {
525
-                    const displayName = this.xmpp.options.displayJids
526
-                            ? Strophe.getResourceFromJid(from) : member.nick;
529
+                    const displayName
530
+                        = this.xmpp.options.displayJids
531
+                            ? Strophe.getResourceFromJid(from)
532
+                            : member.nick;
527 533
 
528 534
                     if (displayName && displayName.length > 0) {
529 535
                         this.eventEmitter.emit(
@@ -712,9 +718,10 @@ export default class ChatRoom extends Listenable {
712 718
         if ($(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]'
713 719
             + '>destroy').length) {
714 720
             let reason;
715
-            const reasonSelect = $(pres).find(
721
+            const reasonSelect
722
+                = $(pres).find(
716 723
                     '>x[xmlns="http://jabber.org/protocol/muc#user"]'
717
-                    + '>destroy>reason');
724
+                        + '>destroy>reason');
718 725
 
719 726
             if (reasonSelect.length) {
720 727
                 reason = reasonSelect.text();
@@ -729,18 +736,16 @@ export default class ChatRoom extends Listenable {
729 736
         // Status code 110 indicates that this notification is "self-presence".
730 737
         const isSelfPresence
731 738
             = $(pres)
732
-                    .find(
733
-                        '>x[xmlns="http://jabber.org/protocol/muc#user"]>'
734
-                            + 'status[code="110"]')
735
-                    .length
736
-                !== 0;
739
+                .find(
740
+                    '>x[xmlns="http://jabber.org/protocol/muc#user"]>'
741
+                        + 'status[code="110"]')
742
+                .length;
737 743
         const isKick
738 744
             = $(pres)
739
-                    .find(
740
-                        '>x[xmlns="http://jabber.org/protocol/muc#user"]'
741
-                            + '>status[code="307"]')
742
-                    .length
743
-                !== 0;
745
+                .find(
746
+                    '>x[xmlns="http://jabber.org/protocol/muc#user"]'
747
+                        + '>status[code="307"]')
748
+                .length;
744 749
         const membersKeys = Object.keys(this.members);
745 750
 
746 751
         if (!isSelfPresence) {
@@ -1098,10 +1103,12 @@ export default class ChatRoom extends Listenable {
1098 1103
      */
1099 1104
     addAudioInfoToPresence(mute) {
1100 1105
         this.removeFromPresence('audiomuted');
1101
-        this.addToPresence('audiomuted',
1102
-            { attributes:
1103
-            { 'xmlns': 'http://jitsi.org/jitmeet/audio' },
1104
-                value: mute.toString() });
1106
+        this.addToPresence(
1107
+            'audiomuted',
1108
+            {
1109
+                attributes: { 'xmlns': 'http://jitsi.org/jitmeet/audio' },
1110
+                value: mute.toString()
1111
+            });
1105 1112
     }
1106 1113
 
1107 1114
     /**
@@ -1125,10 +1132,12 @@ export default class ChatRoom extends Listenable {
1125 1132
      */
1126 1133
     addVideoInfoToPresence(mute) {
1127 1134
         this.removeFromPresence('videomuted');
1128
-        this.addToPresence('videomuted',
1129
-            { attributes:
1130
-            { 'xmlns': 'http://jitsi.org/jitmeet/video' },
1131
-                value: mute.toString() });
1135
+        this.addToPresence(
1136
+            'videomuted',
1137
+            {
1138
+                attributes: { 'xmlns': 'http://jitsi.org/jitmeet/video' },
1139
+                value: mute.toString()
1140
+            });
1132 1141
     }
1133 1142
 
1134 1143
     /**

+ 30
- 29
modules/xmpp/JingleSessionPC.js 查看文件

@@ -407,7 +407,7 @@ export default class JingleSessionPC extends JingleSession {
407 407
                         });
408 408
                     this.wasConnected = true;
409 409
                     this.room.eventEmitter.emit(
410
-                            XMPPEvents.CONNECTION_ESTABLISHED, this);
410
+                        XMPPEvents.CONNECTION_ESTABLISHED, this);
411 411
                 }
412 412
                 this.isreconnect = false;
413 413
                 break;
@@ -417,8 +417,8 @@ export default class JingleSessionPC extends JingleSession {
417 417
                 }
418 418
                 this.isreconnect = true;
419 419
 
420
-                    // Informs interested parties that the connection has been
421
-                    // interrupted.
420
+                // Informs interested parties that the connection has been
421
+                // interrupted.
422 422
                 if (this.wasstable) {
423 423
                     this.room.eventEmitter.emit(
424 424
                         XMPPEvents.CONNECTION_INTERRUPTED, this);
@@ -523,7 +523,7 @@ export default class JingleSessionPC extends JingleSession {
523 523
                 ice.xmlns = 'urn:xmpp:jingle:transports:ice-udp:1';
524 524
                 cand.c('content', {
525 525
                     creator: this.initiator === this.localJid
526
-                                    ? 'initiator' : 'responder',
526
+                        ? 'initiator' : 'responder',
527 527
                     name: cands[0].sdpMid ? cands[0].sdpMid : mline.media
528 528
                 }).c('transport', ice);
529 529
                 for (let i = 0; i < cands.length; i++) {
@@ -664,7 +664,8 @@ export default class JingleSessionPC extends JingleSession {
664 664
                                         + ` for ${owner}`);
665 665
                             } else {
666 666
                                 this.signalingLayer.setSSRCOwner(
667
-                                ssrc, Strophe.getResourceFromJid(owner));
667
+                                    ssrc,
668
+                                    Strophe.getResourceFromJid(owner));
668 669
                             }
669 670
                         }
670 671
                     });
@@ -894,8 +895,8 @@ export default class JingleSessionPC extends JingleSession {
894 895
                 }, error => {
895 896
                     logger.error(
896 897
                         `Error renegotiating after setting new remote ${
897
-                            (this.isInitiator ? 'answer: ' : 'offer: ')
898
-                            }${error}`, newRemoteSdp);
898
+                            this.isInitiator ? 'answer: ' : 'offer: '}${error}`,
899
+                        newRemoteSdp);
899 900
                     JingleSessionPC.onJingleFatalError(this, error);
900 901
                     finishedCallback(error);
901 902
                 });
@@ -1034,16 +1035,16 @@ export default class JingleSessionPC extends JingleSession {
1034 1035
                 to: this.peerjid,
1035 1036
                 type: 'set'
1036 1037
             })
1037
-            .c('jingle', {
1038
-                xmlns: 'urn:xmpp:jingle:1',
1039
-                action: 'content-modify',
1040
-                initiator: this.initiator,
1041
-                sid: this.sid
1042
-            })
1043
-            .c('content', {
1044
-                name: 'video',
1045
-                senders: newSendersValue
1046
-            });
1038
+                .c('jingle', {
1039
+                    xmlns: 'urn:xmpp:jingle:1',
1040
+                    action: 'content-modify',
1041
+                    initiator: this.initiator,
1042
+                    sid: this.sid
1043
+                })
1044
+                .c('content', {
1045
+                    name: 'video',
1046
+                    senders: newSendersValue
1047
+                });
1047 1048
 
1048 1049
         logger.info(
1049 1050
             `Sending content-modify, video senders: ${newSendersValue}`);
@@ -1147,14 +1148,14 @@ export default class JingleSessionPC extends JingleSession {
1147 1148
                     to: this.peerjid,
1148 1149
                     type: 'set'
1149 1150
                 })
1150
-                .c('jingle', {
1151
-                    xmlns: 'urn:xmpp:jingle:1',
1152
-                    action: 'session-terminate',
1153
-                    initiator: this.initiator,
1154
-                    sid: this.sid
1155
-                })
1156
-                .c('reason')
1157
-                .c((options && options.reason) || 'success');
1151
+                    .c('jingle', {
1152
+                        xmlns: 'urn:xmpp:jingle:1',
1153
+                        action: 'session-terminate',
1154
+                        initiator: this.initiator,
1155
+                        sid: this.sid
1156
+                    })
1157
+                    .c('reason')
1158
+                    .c((options && options.reason) || 'success');
1158 1159
 
1159 1160
             if (options && options.reasonDescription) {
1160 1161
                 sessionTerminate.up()
@@ -1228,8 +1229,8 @@ export default class JingleSessionPC extends JingleSession {
1228 1229
 
1229 1230
                     if (ssrcs.length) {
1230 1231
                         lines
1231
-                            += `a=ssrc-group:${semantics} ${ssrcs.join(' ')
1232
-                                }\r\n`;
1232
+                            += `a=ssrc-group:${semantics} ${
1233
+                                ssrcs.join(' ')}\r\n`;
1233 1234
                     }
1234 1235
                 });
1235 1236
 
@@ -1685,8 +1686,8 @@ export default class JingleSessionPC extends JingleSession {
1685 1686
 
1686 1687
                     if (ssrcs.length) {
1687 1688
                         lines
1688
-                            += `a=ssrc-group:${semantics} ${ssrcs.join(' ')
1689
-                                }\r\n`;
1689
+                            += `a=ssrc-group:${semantics} ${
1690
+                                ssrcs.join(' ')}\r\n`;
1690 1691
                     }
1691 1692
 
1692 1693
                     /* eslint-enable no-invalid-this */

+ 38
- 39
modules/xmpp/RtxModifier.spec.js 查看文件

@@ -13,11 +13,10 @@ import SDPUtil from './SDPUtil';
13 13
 function numVideoSsrcs(parsedSdp) {
14 14
     const videoMLine = parsedSdp.media.find(m => m.type === 'video');
15 15
 
16
-
17 16
     return videoMLine.ssrcs
18
-    .map(ssrcInfo => ssrcInfo.id)
19
-    .filter((ssrc, index, array) => array.indexOf(ssrc) === index)
20
-    .length;
17
+        .map(ssrcInfo => ssrcInfo.id)
18
+        .filter((ssrc, index, array) => array.indexOf(ssrc) === index)
19
+        .length;
21 20
 }
22 21
 
23 22
 /**
@@ -73,7 +72,7 @@ function getVideoGroups(parsedSdp, groupSemantics) {
73 72
     videoMLine.ssrcGroups = videoMLine.ssrcGroups || [];
74 73
 
75 74
     return videoMLine.ssrcGroups
76
-    .filter(g => g.semantics === groupSemantics);
75
+        .filter(g => g.semantics === groupSemantics);
77 76
 }
78 77
 
79 78
 describe('RtxModifier', () => {
@@ -90,18 +89,18 @@ describe('RtxModifier', () => {
90 89
                 this.primaryVideoSsrc = getPrimaryVideoSsrc(this.singleVideoSdp);
91 90
             });
92 91
             it('should add a single rtx ssrc', function() {
93
-          // Call rtxModifier.modifyRtxSsrcs with an sdp that contains a single video
94
-          //  ssrc.  The returned sdp should have an rtx ssrc and an fid group.
92
+                // Call rtxModifier.modifyRtxSsrcs with an sdp that contains a single video
93
+                //  ssrc.  The returned sdp should have an rtx ssrc and an fid group.
95 94
                 const newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.singleVideoSdp));
96 95
                 const newSdp = transform.parse(newSdpStr);
97 96
                 const newPrimaryVideoSsrc = getPrimaryVideoSsrc(newSdp);
98 97
 
99 98
                 expect(newPrimaryVideoSsrc).toEqual(this.primaryVideoSsrc);
100 99
 
101
-          // Should now have an rtx ssrc as well
100
+                // Should now have an rtx ssrc as well
102 101
                 expect(numVideoSsrcs(newSdp)).toEqual(2);
103 102
 
104
-          // Should now have an FID group
103
+                // Should now have an FID group
105 104
                 const fidGroups = getVideoGroups(newSdp, 'FID');
106 105
 
107 106
                 expect(fidGroups.length).toEqual(1);
@@ -113,16 +112,16 @@ describe('RtxModifier', () => {
113 112
             });
114 113
 
115 114
             it('should re-use the same rtx ssrc for a primary ssrc it\'s seen before', function() {
116
-          // Have rtxModifier generate an rtx ssrc via modifyRtxSsrcs.  Then call it again
117
-          //  with the same primary ssrc in the sdp (but no rtx ssrc).  It should use
118
-          //  the same rtx ssrc as before.
115
+                // Have rtxModifier generate an rtx ssrc via modifyRtxSsrcs.  Then call it again
116
+                //  with the same primary ssrc in the sdp (but no rtx ssrc).  It should use
117
+                //  the same rtx ssrc as before.
119 118
                 let newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.singleVideoSdp));
120 119
                 let newSdp = transform.parse(newSdpStr);
121 120
 
122 121
                 let fidGroup = getVideoGroups(newSdp, 'FID')[0];
123 122
                 const fidGroupRtxSsrc = SDPUtil.parseGroupSsrcs(fidGroup)[1];
124 123
 
125
-          // Now pass the original sdp through again
124
+                // Now pass the original sdp through again
126 125
                 newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.singleVideoSdp));
127 126
                 newSdp = transform.parse(newSdpStr);
128 127
                 fidGroup = getVideoGroups(newSdp, 'FID')[0];
@@ -132,10 +131,10 @@ describe('RtxModifier', () => {
132 131
             });
133 132
 
134 133
             it('should NOT re-use the same rtx ssrc for a primary ssrc it\'s seen before if the cache has been cleared', function() {
135
-          // Call modifyRtxSsrcs to generate an rtx ssrc
136
-          // Clear the rtxModifier cache
137
-          // Call modifyRtxSsrcs to generate an rtx ssrc again with the same primary ssrc
138
-          // --> We should get a different rtx ssrc
134
+                // Call modifyRtxSsrcs to generate an rtx ssrc
135
+                // Clear the rtxModifier cache
136
+                // Call modifyRtxSsrcs to generate an rtx ssrc again with the same primary ssrc
137
+                // --> We should get a different rtx ssrc
139 138
                 let newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.singleVideoSdp));
140 139
                 let newSdp = transform.parse(newSdpStr);
141 140
 
@@ -144,7 +143,7 @@ describe('RtxModifier', () => {
144 143
 
145 144
                 this.rtxModifier.clearSsrcCache();
146 145
 
147
-          // Now pass the original sdp through again
146
+                // Now pass the original sdp through again
148 147
                 newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.singleVideoSdp));
149 148
                 newSdp = transform.parse(newSdpStr);
150 149
                 fidGroup = getVideoGroups(newSdp, 'FID')[0];
@@ -154,9 +153,9 @@ describe('RtxModifier', () => {
154 153
             });
155 154
 
156 155
             it('should use the rtx ssrc from the cache when the cache has been manually set', function() {
157
-          // Manually set an rtx ssrc mapping in the cache
158
-          // Call modifyRtxSsrcs
159
-          // -->The rtx ssrc used should be the one we set
156
+                // Manually set an rtx ssrc mapping in the cache
157
+                // Call modifyRtxSsrcs
158
+                // -->The rtx ssrc used should be the one we set
160 159
                 const forcedRtxSsrc = 123456;
161 160
                 const ssrcCache = new Map();
162 161
 
@@ -179,18 +178,18 @@ describe('RtxModifier', () => {
179 178
             });
180 179
 
181 180
             it('should add rtx ssrcs for all of them', function() {
182
-          // Call rtxModifier.modifyRtxSsrcs with an sdp that contains multiple video
183
-          //  ssrcs.  The returned sdp should have an rtx ssrc and an fid group for all of them.
181
+                // Call rtxModifier.modifyRtxSsrcs with an sdp that contains multiple video
182
+                //  ssrcs.  The returned sdp should have an rtx ssrc and an fid group for all of them.
184 183
                 const newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.multipleVideoSdp));
185 184
                 const newSdp = transform.parse(newSdpStr);
186 185
                 const newPrimaryVideoSsrcs = getPrimaryVideoSsrcs(newSdp);
187 186
 
188 187
                 expect(newPrimaryVideoSsrcs).toEqual(this.primaryVideoSsrcs);
189 188
 
190
-          // Should now have rtx ssrcs as well
189
+                // Should now have rtx ssrcs as well
191 190
                 expect(numVideoSsrcs(newSdp)).toEqual(this.primaryVideoSsrcs.length * 2);
192 191
 
193
-          // Should now have FID groups
192
+                // Should now have FID groups
194 193
                 const fidGroups = getVideoGroups(newSdp, 'FID');
195 194
 
196 195
                 expect(fidGroups.length).toEqual(this.primaryVideoSsrcs.length);
@@ -202,16 +201,16 @@ describe('RtxModifier', () => {
202 201
             });
203 202
 
204 203
             it('should re-use the same rtx ssrcs for any primary ssrc it\'s seen before', function() {
205
-          // Have rtxModifier generate an rtx ssrc via modifyRtxSsrcs.  Then call it again
206
-          //  with the same primary ssrc in the sdp (but no rtx ssrc).  It should use
207
-          //  the same rtx ssrc as before.
204
+                // Have rtxModifier generate an rtx ssrc via modifyRtxSsrcs.  Then call it again
205
+                //  with the same primary ssrc in the sdp (but no rtx ssrc).  It should use
206
+                //  the same rtx ssrc as before.
208 207
                 let newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.multipleVideoSdp));
209 208
                 let newSdp = transform.parse(newSdpStr);
210 209
 
211 210
                 const rtxMapping = new Map();
212 211
                 let fidGroups = getVideoGroups(newSdp, 'FID');
213 212
 
214
-          // Save the first mapping that is made
213
+                // Save the first mapping that is made
215 214
 
216 215
                 fidGroups.forEach(fidGroup => {
217 216
                     const fidSsrcs = SDPUtil.parseGroupSsrcs(fidGroup);
@@ -221,7 +220,7 @@ describe('RtxModifier', () => {
221 220
                     rtxMapping.set(fidGroupPrimarySsrc, fidGroupRtxSsrc);
222 221
                 });
223 222
 
224
-          // Now pass the original sdp through again and make sure we get the same mapping
223
+                // Now pass the original sdp through again and make sure we get the same mapping
225 224
                 newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.multipleVideoSdp));
226 225
                 newSdp = transform.parse(newSdpStr);
227 226
                 fidGroups = getVideoGroups(newSdp, 'FID');
@@ -236,17 +235,17 @@ describe('RtxModifier', () => {
236 235
             });
237 236
 
238 237
             it('should NOT re-use the same rtx ssrcs for any primary ssrc it\'s seen before if the cache has been cleared', function() {
239
-          // Call modifyRtxSsrcs to generate an rtx ssrc
240
-          // Clear the rtxModifier cache
241
-          // Call modifyRtxSsrcs to generate rtx ssrcs again with the same primary ssrcs
242
-          // --> We should get different rtx ssrcs
238
+                // Call modifyRtxSsrcs to generate an rtx ssrc
239
+                // Clear the rtxModifier cache
240
+                // Call modifyRtxSsrcs to generate rtx ssrcs again with the same primary ssrcs
241
+                // --> We should get different rtx ssrcs
243 242
                 let newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.multipleVideoSdp));
244 243
                 let newSdp = transform.parse(newSdpStr);
245 244
 
246 245
                 const rtxMapping = new Map();
247 246
                 let fidGroups = getVideoGroups(newSdp, 'FID');
248 247
 
249
-          // Save the first mapping that is made
248
+                // Save the first mapping that is made
250 249
 
251 250
                 fidGroups.forEach(fidGroup => {
252 251
                     const fidSsrcs = SDPUtil.parseGroupSsrcs(fidGroup);
@@ -258,7 +257,7 @@ describe('RtxModifier', () => {
258 257
 
259 258
                 this.rtxModifier.clearSsrcCache();
260 259
 
261
-          // Now pass the original sdp through again and make sure we get the same mapping
260
+                // Now pass the original sdp through again and make sure we get the same mapping
262 261
                 newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.multipleVideoSdp));
263 262
                 newSdp = transform.parse(newSdpStr);
264 263
                 fidGroups = getVideoGroups(newSdp, 'FID');
@@ -273,9 +272,9 @@ describe('RtxModifier', () => {
273 272
             });
274 273
 
275 274
             it('should use the rtx ssrcs from the cache when the cache has been manually set', function() {
276
-          // Manually set an rtx ssrc mapping in the cache
277
-          // Call modifyRtxSsrcs
278
-          // -->The rtx ssrc used should be the one we set
275
+                // Manually set an rtx ssrc mapping in the cache
276
+                // Call modifyRtxSsrcs
277
+                // -->The rtx ssrc used should be the one we set
279 278
                 const rtxMapping = new Map();
280 279
 
281 280
                 this.primaryVideoSsrcs.forEach(ssrc => {

+ 6
- 5
modules/xmpp/SDP.js 查看文件

@@ -56,8 +56,7 @@ SDP.prototype.getMediaSsrcMap = function() {
56 56
         tmp = SDPUtil.findLines(self.media[mediaindex], 'a=ssrc:');
57 57
         const mid
58 58
             = SDPUtil.parseMID(
59
-                SDPUtil.findLine(self.media[mediaindex],
60
-                'a=mid:'));
59
+                SDPUtil.findLine(self.media[mediaindex], 'a=mid:'));
61 60
         const media = {
62 61
             mediaindex,
63 62
             mid,
@@ -782,9 +781,11 @@ SDP.prototype.jingle2media = function(content) {
782 781
                 += $(this)
783 782
                     .find('parameter')
784 783
                     .map(function() {
785
-                        return (this.getAttribute('name')
786
-                                ? `${this.getAttribute('name')}=` : '')
787
-                            + this.getAttribute('value');
784
+                        const name = this.getAttribute('name');
785
+
786
+                        return (
787
+                            (name ? `${name}=` : '')
788
+                                + this.getAttribute('value'));
788 789
                     })
789 790
                     .get()
790 791
                     .join('; ');

+ 1
- 2
modules/xmpp/SDPUtil.js 查看文件

@@ -552,8 +552,7 @@ const SDPUtil = {
552 552
      */
553 553
     getUfrag(sdp) {
554 554
         const ufragLines
555
-            = sdp.split('\n').filter(
556
-                    line => line.startsWith('a=ice-ufrag:'));
555
+            = sdp.split('\n').filter(line => line.startsWith('a=ice-ufrag:'));
557 556
 
558 557
         if (ufragLines.length > 0) {
559 558
             return ufragLines[0].substr('a=ice-ufrag:'.length);

+ 5
- 5
modules/xmpp/SdpTransformUtil.js 查看文件

@@ -29,9 +29,9 @@ function _getSSRCCount(mLine) {
29 29
     }
30 30
 
31 31
     return mLine.ssrcs
32
-            .map(ssrcInfo => ssrcInfo.id)
33
-            .filter((ssrc, index, array) => array.indexOf(ssrc) === index)
34
-            .length;
32
+        .map(ssrcInfo => ssrcInfo.id)
33
+        .filter((ssrc, index, array) => array.indexOf(ssrc) === index)
34
+        .length;
35 35
 }
36 36
 
37 37
 /**
@@ -242,7 +242,7 @@ class MLineWrap {
242 242
             return this.mLine.ssrcs[0].id;
243 243
         }
244 244
 
245
-            // Look for a SIM or FID group
245
+        // Look for a SIM or FID group
246 246
         if (this.mLine.ssrcGroups) {
247 247
             const simGroup = this.findGroup('SIM');
248 248
 
@@ -346,7 +346,7 @@ class MLineWrap {
346 346
 
347 347
         this.mLine.ssrcGroups
348 348
             = this.mLine.ssrcGroups
349
-                  .filter(groupInfo => groupInfo.semantics !== semantics);
349
+                .filter(groupInfo => groupInfo.semantics !== semantics);
350 350
     }
351 351
 
352 352
     /**

+ 9
- 5
modules/xmpp/moderator.js 查看文件

@@ -292,7 +292,7 @@ Moderator.prototype.parseConfigOptions = function(resultIq) {
292 292
     logger.info(`Authentication enabled: ${authenticationEnabled}`);
293 293
 
294 294
     this.externalAuthEnabled = $(resultIq).find(
295
-            '>conference>property'
295
+        '>conference>property'
296 296
             + '[name=\'externalAuth\'][value=\'true\']').length > 0;
297 297
 
298 298
     logger.info(
@@ -384,7 +384,9 @@ Moderator.prototype._allocateConferenceFocusError = function(error, callback) {
384 384
             errorMsg = errorTextNode.text();
385 385
         }
386 386
         this.eventEmitter.emit(
387
-                XMPPEvents.RESERVATION_ERROR, errorCode, errorMsg);
387
+            XMPPEvents.RESERVATION_ERROR,
388
+            errorCode,
389
+            errorMsg);
388 390
 
389 391
         return;
390 392
     }
@@ -418,7 +420,9 @@ Moderator.prototype._allocateConferenceFocusError = function(error, callback) {
418 420
 
419 421
     if (!invalidSession) {
420 422
         this.eventEmitter.emit(
421
-                XMPPEvents.FOCUS_DISCONNECTED, focusComponent, retrySec);
423
+            XMPPEvents.FOCUS_DISCONNECTED,
424
+            focusComponent,
425
+            retrySec);
422 426
     }
423 427
 
424 428
     // Reset response timeout
@@ -470,9 +474,9 @@ Moderator.prototype.authenticate = function() {
470 474
             },
471 475
             errorIq => reject({
472 476
                 error: $(errorIq).find('iq>error :first')
473
-                                 .prop('tagName'),
477
+                    .prop('tagName'),
474 478
                 message: $(errorIq).find('iq>error>text')
475
-                                   .text()
479
+                    .text()
476 480
             })
477 481
         );
478 482
     });

+ 76
- 62
modules/xmpp/recording.js 查看文件

@@ -1,4 +1,4 @@
1
-  /* global $, $iq */
1
+/* global $, $iq */
2 2
 
3 3
 import { getLogger } from 'jitsi-meet-logger';
4 4
 const logger = getLogger(__filename);
@@ -12,9 +12,9 @@ const GlobalOnErrorHandler = require('../util/GlobalOnErrorHandler');
12 12
  * @param {Element|Object} errorIqNode - Either DOM element or the structure
13 13
  * from ChatRoom packet2JSON.
14 14
  * @return {{
15
- *      code: string,
16
- *      type: string,
17
- *      message: string
15
+ *     code: string,
16
+ *     type: string,
17
+ *     message: string
18 18
  * }}
19 19
  */
20 20
 function getJibriErrorDetails(errorIqNode) {
@@ -177,13 +177,16 @@ Recording.prototype.setRecordingJibri = function(
177 177
         })
178 178
             .c('jibri', {
179 179
                 'xmlns': 'http://jitsi.org/protocol/jibri',
180
-                'action': state === Recording.status.ON
180
+                'action':
181
+                    state === Recording.status.ON
181 182
                         ? Recording.action.START
182 183
                         : Recording.action.STOP,
183
-                'recording_mode': this.type === Recording.types.JIBRI_FILE
184
+                'recording_mode':
185
+                    this.type === Recording.types.JIBRI_FILE
184 186
                         ? 'file'
185 187
                         : 'stream',
186
-                'streamid': this.type === Recording.types.JIBRI
188
+                'streamid':
189
+                    this.type === Recording.types.JIBRI
187 190
                         ? options.streamId
188 191
                         : undefined
189 192
             })
@@ -192,19 +195,20 @@ Recording.prototype.setRecordingJibri = function(
192 195
     logger.log(`Set jibri recording: ${state}`, iq.nodeTree);
193 196
     logger.log(iq.nodeTree);
194 197
     this.connection.sendIQ(
195
-    iq,
196
-    result => {
197
-        logger.log('Result', result);
198
-
199
-        const jibri = $(result).find('jibri');
200
-
201
-        callback(jibri.attr('state'), jibri.attr('url'));
202
-    },
203
-    error => {
204
-        logger.log(
205
-            'Failed to start recording, error: ', getJibriErrorDetails(error));
206
-        errCallback(error);
207
-    });
198
+        iq,
199
+        result => {
200
+            logger.log('Result', result);
201
+
202
+            const jibri = $(result).find('jibri');
203
+
204
+            callback(jibri.attr('state'), jibri.attr('url'));
205
+        },
206
+        error => {
207
+            logger.log(
208
+                'Failed to start recording, error: ',
209
+                getJibriErrorDetails(error));
210
+            errCallback(error);
211
+        });
208 212
 };
209 213
 
210 214
 /* eslint-enable max-params */
@@ -215,13 +219,16 @@ Recording.prototype.setRecordingJirecon
215 219
             errCallback(new Error('Invalid state!'));
216 220
         }
217 221
 
218
-        const iq = $iq({ to: this.jirecon,
219
-            type: 'set' })
220
-        .c('recording', { xmlns: 'http://jitsi.org/protocol/jirecon',
221
-            action: state === Recording.status.ON
222
-                ? Recording.action.START
223
-                : Recording.action.STOP,
224
-            mucjid: this.roomjid });
222
+        const iq
223
+            = $iq({
224
+                to: this.jirecon,
225
+                type: 'set'
226
+            })
227
+                .c('recording', { xmlns: 'http://jitsi.org/protocol/jirecon',
228
+                    action: state === Recording.status.ON
229
+                        ? Recording.action.START
230
+                        : Recording.action.STOP,
231
+                    mucjid: this.roomjid });
225 232
 
226 233
         if (state === Recording.status.OFF) {
227 234
             iq.attrs({ rid: this.jireconRid });
@@ -231,27 +238,29 @@ Recording.prototype.setRecordingJirecon
231 238
         const self = this;
232 239
 
233 240
         this.connection.sendIQ(
234
-        iq,
235
-        result => {
236
-            // TODO wait for an IQ with the real status, since this is
237
-            // provisional?
238
-            // eslint-disable-next-line newline-per-chained-call
239
-            self.jireconRid = $(result).find('recording').attr('rid');
240
-            logger.log(
241
-                `Recording ${
242
-                    state === Recording.status.ON ? 'started' : 'stopped'
243
-                    }(jirecon)${result}`);
244
-            self.state = state;
245
-            if (state === Recording.status.OFF) {
246
-                self.jireconRid = null;
247
-            }
241
+            iq,
242
+            result => {
243
+                // TODO wait for an IQ with the real status, since this is
244
+                // provisional?
245
+                // eslint-disable-next-line newline-per-chained-call
246
+                self.jireconRid = $(result).find('recording').attr('rid');
248 247
 
249
-            callback(state);
250
-        },
251
-        error => {
252
-            logger.log('Failed to start recording, error: ', error);
253
-            errCallback(error);
254
-        });
248
+                const stateStr
249
+                    = state === Recording.status.ON ? 'started' : 'stopped';
250
+
251
+                logger.log(`Recording ${stateStr}(jirecon)${result}`);
252
+
253
+                self.state = state;
254
+                if (state === Recording.status.OFF) {
255
+                    self.jireconRid = null;
256
+                }
257
+
258
+                callback(state);
259
+            },
260
+            error => {
261
+                logger.log('Failed to start recording, error: ', error);
262
+                errCallback(error);
263
+            });
255 264
     };
256 265
 
257 266
 /* eslint-disable max-params */
@@ -341,38 +350,43 @@ Recording.prototype.setRecording = function(...args) {
341 350
  * @param statusChangeHandler {function} receives the new status as argument.
342 351
  */
343 352
 Recording.prototype.toggleRecording = function(
344
-    options = { },
345
-    statusChangeHandler) {
353
+        options = { },
354
+        statusChangeHandler) {
346 355
     const oldState = this.state;
347 356
 
348 357
     // If the recorder is currently unavailable we throw an error.
349 358
     if (oldState === Recording.status.UNAVAILABLE
350 359
         || oldState === Recording.status.FAILED) {
351
-        statusChangeHandler(Recording.status.FAILED,
352
-                            JitsiRecorderErrors.RECORDER_UNAVAILABLE);
360
+        statusChangeHandler(
361
+            Recording.status.FAILED,
362
+            JitsiRecorderErrors.RECORDER_UNAVAILABLE);
353 363
     } else if (oldState === Recording.status.BUSY) {
354
-        statusChangeHandler(Recording.status.BUSY,
355
-                            JitsiRecorderErrors.RECORDER_BUSY);
364
+        statusChangeHandler(
365
+            Recording.status.BUSY,
366
+            JitsiRecorderErrors.RECORDER_BUSY);
356 367
     }
357 368
 
358 369
     // If we're about to turn ON the recording we need either a streamId or
359 370
     // an authentication token depending on the recording type. If we don't
360 371
     // have any of those we throw an error.
361 372
     if ((oldState === Recording.status.OFF
362
-        || oldState === Recording.status.AVAILABLE)
363
-        && ((!options.token && this.type === Recording.types.COLIBRI)
364
-        || (!options.streamId && this.type === Recording.types.JIBRI))) {
365
-        statusChangeHandler(Recording.status.FAILED,
366
-                            JitsiRecorderErrors.NO_TOKEN);
373
+                || oldState === Recording.status.AVAILABLE)
374
+            && ((!options.token && this.type === Recording.types.COLIBRI)
375
+                || (!options.streamId
376
+                    && this.type === Recording.types.JIBRI))) {
377
+        statusChangeHandler(
378
+            Recording.status.FAILED,
379
+            JitsiRecorderErrors.NO_TOKEN);
367 380
         logger.error('No token passed!');
368 381
 
369 382
         return;
370 383
     }
371 384
 
372
-    const newState = oldState === Recording.status.AVAILABLE
373
-                    || oldState === Recording.status.OFF
374
-                    ? Recording.status.ON
375
-                    : Recording.status.OFF;
385
+    const newState
386
+        = oldState === Recording.status.AVAILABLE
387
+                || oldState === Recording.status.OFF
388
+            ? Recording.status.ON
389
+            : Recording.status.OFF;
376 390
 
377 391
     const self = this;
378 392
 

+ 40
- 38
modules/xmpp/strophe.jingle.js 查看文件

@@ -136,8 +136,10 @@ class JingleConnectionPlugin extends ConnectionPlugin {
136 136
                 const audioMuted = startMuted.attr('audio');
137 137
                 const videoMuted = startMuted.attr('video');
138 138
 
139
-                this.eventEmitter.emit(XMPPEvents.START_MUTED_FROM_FOCUS,
140
-                        audioMuted === 'true', videoMuted === 'true');
139
+                this.eventEmitter.emit(
140
+                    XMPPEvents.START_MUTED_FROM_FOCUS,
141
+                    audioMuted === 'true',
142
+                    videoMuted === 'true');
141 143
             }
142 144
 
143 145
             // FIXME that should work most of the time, but we'd have to
@@ -148,23 +150,24 @@ class JingleConnectionPlugin extends ConnectionPlugin {
148 150
             logger.info(
149 151
                 `Marking session from ${fromJid
150 152
                 } as ${isP2P ? '' : '*not*'} P2P`);
151
-            sess = new JingleSessionPC(
152
-                        $(iq).find('jingle').attr('sid'),
153
-                        $(iq).attr('to'),
154
-                        fromJid,
155
-                        this.connection,
156
-                        this.mediaConstraints,
157
-                        isP2P ? this.p2pIceConfig : this.jvbIceConfig,
158
-                        isP2P /* P2P */,
159
-                        false /* initiator */,
160
-                        this.xmpp.options);
153
+            sess
154
+                = new JingleSessionPC(
155
+                    $(iq).find('jingle').attr('sid'),
156
+                    $(iq).attr('to'),
157
+                    fromJid,
158
+                    this.connection,
159
+                    this.mediaConstraints,
160
+                    isP2P ? this.p2pIceConfig : this.jvbIceConfig,
161
+                    isP2P,
162
+                    /* initiator */ false,
163
+                    this.xmpp.options);
161 164
 
162 165
             this.sessions[sess.sid] = sess;
163 166
 
164 167
             this.eventEmitter.emit(XMPPEvents.CALL_INCOMING,
165
-                    sess, $(iq).find('>jingle'), now);
168
+                sess, $(iq).find('>jingle'), now);
166 169
             Statistics.analytics.sendEvent(
167
-                    'xmpp.session-initiate', { value: now });
170
+                'xmpp.session-initiate', { value: now });
168 171
             break;
169 172
         }
170 173
         case 'session-accept': {
@@ -199,16 +202,16 @@ class JingleConnectionPlugin extends ConnectionPlugin {
199 202
         case 'transport-replace':
200 203
             logger.info('(TIME) Start transport replace', now);
201 204
             Statistics.analytics.sendEvent(
202
-                    'xmpp.transport-replace.start', { value: now });
205
+                'xmpp.transport-replace.start',
206
+                { value: now });
203 207
 
204 208
             sess.replaceTransport($(iq).find('>jingle'), () => {
205 209
                 const successTime = window.performance.now();
206 210
 
207
-                logger.info(
208
-                        '(TIME) Transport replace success!', successTime);
211
+                logger.info('(TIME) Transport replace success!', successTime);
209 212
                 Statistics.analytics.sendEvent(
210
-                        'xmpp.transport-replace.success',
211
-                        { value: successTime });
213
+                    'xmpp.transport-replace.success',
214
+                    { value: successTime });
212 215
             }, error => {
213 216
                 GlobalOnErrorHandler.callErrorHandler(error);
214 217
                 logger.error('Transport replace failed', error);
@@ -227,9 +230,9 @@ class JingleConnectionPlugin extends ConnectionPlugin {
227 230
             logger.warn('jingle action not implemented', action);
228 231
             ack.attrs({ type: 'error' });
229 232
             ack.c('error', { type: 'cancel' })
230
-                    .c('bad-request',
231
-                        { xmlns: 'urn:ietf:params:xml:ns:xmpp-stanzas' })
232
-                    .up();
233
+                .c('bad-request',
234
+                    { xmlns: 'urn:ietf:params:xml:ns:xmpp-stanzas' })
235
+                .up();
233 236
             break;
234 237
         }
235 238
         this.connection.send(ack);
@@ -247,15 +250,15 @@ class JingleConnectionPlugin extends ConnectionPlugin {
247 250
     newP2PJingleSession(me, peer) {
248 251
         const sess
249 252
             = new JingleSessionPC(
250
-                    RandomUtil.randomHexString(12),
251
-                    me,
252
-                    peer,
253
-                    this.connection,
254
-                    this.mediaConstraints,
255
-                    this.p2pIceConfig,
256
-                    true /* P2P */,
257
-                    true /* initiator */,
258
-                    this.xmpp.options);
253
+                RandomUtil.randomHexString(12),
254
+                me,
255
+                peer,
256
+                this.connection,
257
+                this.mediaConstraints,
258
+                this.p2pIceConfig,
259
+                /* P2P */ true,
260
+                /* initiator */ true,
261
+                this.xmpp.options);
259 262
 
260 263
         this.sessions[sess.sid] = sess;
261 264
 
@@ -325,15 +328,14 @@ class JingleConnectionPlugin extends ConnectionPlugin {
325 328
                         // ?id=1508
326 329
 
327 330
                         if (username) {
328
-                            if (navigator.userAgent.match(
329
-                                    /Chrom(e|ium)\/([0-9]+)\./)
330
-                                    && parseInt(
331
-                                        navigator.userAgent.match(
332
-                                            /Chrom(e|ium)\/([0-9]+)\./)[2],
333
-                                            10) < 28) {
331
+                            const match
332
+                                = navigator.userAgent.match(
333
+                                    /Chrom(e|ium)\/([0-9]+)\./);
334
+
335
+                            if (match && parseInt(match[2], 10) < 28) {
334 336
                                 dict.url += `${username}@`;
335 337
                             } else {
336
-                                    // only works in M28
338
+                                // only works in M28
337 339
                                 dict.username = username;
338 340
                             }
339 341
                         }

+ 3
- 3
modules/xmpp/strophe.util.js 查看文件

@@ -63,10 +63,10 @@ export default function() {
63 63
         /* eslint-disable no-case-declarations */
64 64
         switch (level) {
65 65
         case Strophe.LogLevel.DEBUG:
66
-                // The log message which reports successful status is logged
67
-                // on Strophe's DEBUG level
66
+            // The log message which reports successful status is logged on
67
+            // Strophe's DEBUG level.
68 68
             if (lastErrorStatus !== -1
69
-                        && resetLastErrorStatusRegExpr.test(msg)) {
69
+                    && resetLastErrorStatusRegExpr.test(msg)) {
70 70
                 logger.debug('Reset lastErrorStatus');
71 71
                 lastErrorStatus = -1;
72 72
             }

+ 4
- 4
modules/xmpp/xmpp.js 查看文件

@@ -162,12 +162,12 @@ export default class XMPP extends Listenable {
162 162
                 this.authenticatedUser = true;
163 163
             }
164 164
             if (this.connection && this.connection.connected
165
-                && Strophe.getResourceFromJid(this.connection.jid)) {
165
+                    && Strophe.getResourceFromJid(this.connection.jid)) {
166 166
                 // .connected is true while connecting?
167
-    //                this.connection.send($pres());
167
+                // this.connection.send($pres());
168 168
                 this.eventEmitter.emit(
169
-                        JitsiConnectionEvents.CONNECTION_ESTABLISHED,
170
-                        Strophe.getResourceFromJid(this.connection.jid));
169
+                    JitsiConnectionEvents.CONNECTION_ESTABLISHED,
170
+                    Strophe.getResourceFromJid(this.connection.jid));
171 171
             }
172 172
         } else if (status === Strophe.Status.CONNFAIL) {
173 173
             if (msg === 'x-strophe-bad-non-anon-jid') {

+ 3
- 3
package.json 查看文件

@@ -30,12 +30,12 @@
30 30
   },
31 31
   "devDependencies": {
32 32
     "babel-core": "6.26.0",
33
-    "babel-eslint": "7.2.3",
33
+    "babel-eslint": "8.0.1",
34 34
     "babel-loader": "7.1.2",
35 35
     "babel-preset-es2015": "6.24.1",
36 36
     "babel-preset-stage-1": "6.24.1",
37
-    "eslint": "3.19.0",
38
-    "eslint-plugin-flowtype": "2.30.4",
37
+    "eslint": "4.8.0",
38
+    "eslint-plugin-flowtype": "2.37.0",
39 39
     "eslint-plugin-import": "2.7.0",
40 40
     "flow-bin": "0.38.0",
41 41
     "jasmine-core": "2.5.2",

+ 4
- 4
webpack.config.js 查看文件

@@ -39,15 +39,15 @@ module.exports = {
39 39
                 flags: 'g',
40 40
                 replace:
41 41
                     child_process.execSync( // eslint-disable-line camelcase
42
-                            `${__dirname}/get-version.sh`)
42
+                        `${__dirname}/get-version.sh`)
43 43
 
44 44
                         // The type of the return value of
45 45
                         // child_process.execSync is either Buffer or String.
46 46
                         .toString()
47 47
 
48
-                            // Shells may automatically append CR and/or LF
49
-                            // characters to the output.
50
-                            .trim(),
48
+                        // Shells may automatically append CR and/or LF
49
+                        // characters to the output.
50
+                        .trim(),
51 51
                 search: '{#COMMIT_HASH#}'
52 52
             },
53 53
             test: `${__dirname}/JitsiMeetJS.js`

Loading…
取消
儲存