Bladeren bron

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 jaren geleden
bovenliggende
commit
ff8468d931

+ 17
- 1
.eslintrc.js Bestand weergeven

175
         'id-blacklist': 0,
175
         'id-blacklist': 0,
176
         'id-length': 0,
176
         'id-length': 0,
177
         'id-match': 0,
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
         'key-spacing': 2,
195
         'key-spacing': 2,
180
         'keyword-spacing': 2,
196
         'keyword-spacing': 2,
181
         'linebreak-style': [ 'error', 'unix' ],
197
         'linebreak-style': [ 'error', 'unix' ],

+ 52
- 41
JitsiConference.js Bestand weergeven

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

+ 1
- 1
JitsiMeetJS.js Bestand weergeven

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

+ 2
- 2
JitsiTrackError.js Bestand weergeven

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

+ 16
- 16
doc/example/example.js Bestand weergeven

147
     room.on(
147
     room.on(
148
         JitsiMeetJS.events.conference.DISPLAY_NAME_CHANGED,
148
         JitsiMeetJS.events.conference.DISPLAY_NAME_CHANGED,
149
         (userID, displayName) => console.log(`${userID} - ${displayName}`));
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
     room.join();
163
     room.join();
165
 }
164
 }
166
 
165
 
216
         localTracks[1].dispose();
215
         localTracks[1].dispose();
217
         localTracks.pop();
216
         localTracks.pop();
218
     }
217
     }
219
-    JitsiMeetJS.createLocalTracks(
220
-            { devices: isVideo ? [ 'video' ] : [ 'desktop' ] })
218
+    JitsiMeetJS.createLocalTracks({
219
+        devices: [ isVideo ? 'video' : 'desktop' ]
220
+    })
221
         .then(tracks => {
221
         .then(tracks => {
222
             localTracks.push(tracks[0]);
222
             localTracks.push(tracks[0]);
223
             localTracks[1].addEventListener(
223
             localTracks[1].addEventListener(

+ 24
- 34
karma.conf.js Bestand weergeven

4
 module.exports = function(config) {
4
 module.exports = function(config) {
5
     config.set({
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
         basePath: '',
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
         frameworks: [ 'jasmine' ],
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
         files: [
16
         files: [
18
             './index.js',
17
             './index.js',
19
             './modules/**/*.spec.js'
18
             './modules/**/*.spec.js'
20
         ],
19
         ],
21
 
20
 
22
-
23
-    // list of files to exclude
21
+        // list of files to exclude
24
         exclude: [
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
         preprocessors: {
28
         preprocessors: {
32
             './index.js': [ 'webpack' ],
29
             './index.js': [ 'webpack' ],
33
             './**/*.spec.js': [ 'webpack' ]
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
         reporters: [ 'progress' ],
36
         reporters: [ 'progress' ],
41
 
37
 
42
-
43
-    // web server port
38
+        // web server port
44
         port: 9876,
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
         colors: true,
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
         logLevel: config.LOG_INFO,
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
         autoWatch: false,
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
         browsers: [ 'Chrome' ],
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
         singleRun: false,
60
         singleRun: false,
71
 
61
 
72
         webpack: require('./webpack.config.js')
62
         webpack: require('./webpack.config.js')

+ 2
- 1
modules/RTC/JitsiLocalTrack.js Bestand weergeven

363
             promise = RTCUtils.obtainAudioAndVideoPermissions(streamOptions)
363
             promise = RTCUtils.obtainAudioAndVideoPermissions(streamOptions)
364
                 .then(streamsInfo => {
364
                 .then(streamsInfo => {
365
                     const mediaType = this.getType();
365
                     const mediaType = this.getType();
366
-                    const streamInfo = streamsInfo.find(
366
+                    const streamInfo
367
+                        = streamsInfo.find(
367
                             info => info.mediaType === mediaType);
368
                             info => info.mediaType === mediaType);
368
 
369
 
369
                     if (streamInfo) {
370
                     if (streamInfo) {

+ 14
- 12
modules/RTC/JitsiRemoteTrack.js Bestand weergeven

34
      * @constructor
34
      * @constructor
35
      */
35
      */
36
     constructor(
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
         super(
47
         super(
48
             conference,
48
             conference,
49
             stream,
49
             stream,
280
      * @return {string}
280
      * @return {string}
281
      */
281
      */
282
     toString() {
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 Bestand weergeven

471
 
471
 
472
         return (
472
         return (
473
             Promise.all(
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
                 .then(() => {
487
                 .then(() => {
488
                     this.emit(
488
                     this.emit(
489
                         JitsiTrackEvents.TRACK_AUDIO_OUTPUT_CHANGED,
489
                         JitsiTrackEvents.TRACK_AUDIO_OUTPUT_CHANGED,

+ 4
- 3
modules/RTC/LocalSdpMunger.js Bestand weergeven

76
             const shouldFakeSdp = muted || !isInPeerConnection;
76
             const shouldFakeSdp = muted || !isInPeerConnection;
77
 
77
 
78
             logger.debug(
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
             if (!shouldFakeSdp) {
84
             if (!shouldFakeSdp) {
84
                 continue; // eslint-disable-line no-continue
85
                 continue; // eslint-disable-line no-continue

+ 4
- 3
modules/RTC/RTCUIHelper.js Bestand weergeven

28
         if (!RTCBrowserType.isTemasysPluginUsed()) {
28
         if (!RTCBrowserType.isTemasysPluginUsed()) {
29
             return $(containerElement).find(videoElemName)[0];
29
             return $(containerElement).find(videoElemName)[0];
30
         }
30
         }
31
-        const matching = $(containerElement).find(
31
+        const matching
32
+            = $(containerElement).find(
32
                 ` ${videoElemName}>param[value="video"]`);
33
                 ` ${videoElemName}>param[value="video"]`);
33
 
34
 
34
         if (matching.length) {
35
         if (matching.length) {
35
             if (matching.length > 1) {
36
             if (matching.length > 1) {
36
                 logger.warn(
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
             return matching.parent()[0];
42
             return matching.parent()[0];

+ 41
- 36
modules/RTC/RTCUtils.js Bestand weergeven

83
  *
83
  *
84
  */
84
  */
85
 function initRawEnumerateDevicesWithCallback() {
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
 // TODO: currently no browser supports 'devicechange' event even in nightly
108
 // TODO: currently no browser supports 'devicechange' event even in nightly
120
 /**
121
 /**
121
  *
122
  *
122
  * @param constraints
123
  * @param constraints
124
+ * @param isNewStyleConstraintsSupported
123
  * @param resolution
125
  * @param resolution
124
  */
126
  */
125
 function setResolutionConstraints(
127
 function setResolutionConstraints(
126
-    constraints, isNewStyleConstraintsSupported, resolution) {
128
+        constraints,
129
+        isNewStyleConstraintsSupported,
130
+        resolution) {
127
     if (Resolutions[resolution]) {
131
     if (Resolutions[resolution]) {
128
         if (isNewStyleConstraintsSupported) {
132
         if (isNewStyleConstraintsSupported) {
129
             constraints.video.width = {
133
             constraints.video.width = {
371
         return true;
375
         return true;
372
     }
376
     }
373
 
377
 
378
+    /* eslint-disable newline-per-chained-call */
379
+
374
     return (
380
     return (
375
-        newDevices
376
-                .map(mediaDeviceInfoToJSON)
377
-                .sort()
378
-                .join('')
381
+        newDevices.map(mediaDeviceInfoToJSON).sort().join('')
379
             !== currentlyAvailableMediaDevices
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
                 }
584
                 }
582
             }
585
             }
583
         } else {
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
             audioStream = streams.audio;
590
             audioStream = streams.audio;
588
             videoStream = streams.video;
591
             videoStream = streams.video;
589
         }
592
         }
854
                     = wrapGetUserMedia(
857
                     = wrapGetUserMedia(
855
                         navigator.mediaDevices.getUserMedia.bind(
858
                         navigator.mediaDevices.getUserMedia.bind(
856
                             navigator.mediaDevices),
859
                             navigator.mediaDevices),
857
-                            true);
860
+                        true);
858
                 this.enumerateDevices = rawEnumerateDevicesWithCallback;
861
                 this.enumerateDevices = rawEnumerateDevicesWithCallback;
859
                 this.attachMediaStream
862
                 this.attachMediaStream
860
                     = wrapAttachMediaStream((element, stream) => {
863
                     = wrapAttachMediaStream((element, stream) => {
1245
 
1248
 
1246
             eventEmitter.addListener(RTCEvents.RTC_READY, listener);
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
                         reason: err
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 Bestand weergeven

650
             chromeExtInstalled = installed;
650
             chromeExtInstalled = installed;
651
             chromeExtUpdateRequired = updateRequired;
651
             chromeExtUpdateRequired = updateRequired;
652
             logger.info(
652
             logger.info(
653
-                `Chrome extension installed: ${chromeExtInstalled
654
-                    } updateRequired: ${chromeExtUpdateRequired}`);
653
+                `Chrome extension installed: ${
654
+                    chromeExtInstalled} updateRequired: ${
655
+                    chromeExtUpdateRequired}`);
655
             resolve();
656
             resolve();
656
         }, options);
657
         }, options);
657
     });
658
     });
763
     // "chrome://EXT_ID/content/DOMAIN.png"
764
     // "chrome://EXT_ID/content/DOMAIN.png"
764
     // Where EXT_ID is the ID of the extension with "@" replaced by ".", and
765
     // Where EXT_ID is the ID of the extension with "@" replaced by ".", and
765
     // DOMAIN is a domain whitelisted by the extension.
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
     img.setAttribute('src', src);
771
     img.setAttribute('src', src);
771
 }
772
 }

+ 84
- 57
modules/RTC/TraceablePeerConnection.js Bestand weergeven

350
  * connection.
350
  * connection.
351
  * @private
351
  * @private
352
  */
352
  */
353
-TraceablePeerConnection.prototype._getDesiredMediaDirection
354
-= function(mediaType) {
353
+TraceablePeerConnection.prototype._getDesiredMediaDirection = function(
354
+        mediaType) {
355
     let mediaTransferActive = true;
355
     let mediaTransferActive = true;
356
 
356
 
357
     if (mediaType === MediaType.AUDIO) {
357
     if (mediaType === MediaType.AUDIO) {
390
  * @param {VideoType} videoType the new value
390
  * @param {VideoType} videoType the new value
391
  * @private
391
  * @private
392
  */
392
  */
393
-TraceablePeerConnection.prototype._peerVideoTypeChanged
394
-= function(endpointId, videoType) {
393
+TraceablePeerConnection.prototype._peerVideoTypeChanged = function(
394
+        endpointId,
395
+        videoType) {
395
     // Check if endpointId has a value to avoid action on random track
396
     // Check if endpointId has a value to avoid action on random track
396
     if (!endpointId) {
397
     if (!endpointId) {
397
         logger.error(`No endpointID on peerVideoTypeChanged ${this}`);
398
         logger.error(`No endpointID on peerVideoTypeChanged ${this}`);
413
  * @param {boolean} isMuted the new mute state
414
  * @param {boolean} isMuted the new mute state
414
  * @private
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
     // Check if endpointId is a value to avoid doing action on all remote tracks
421
     // Check if endpointId is a value to avoid doing action on all remote tracks
419
     if (!endpointId) {
422
     if (!endpointId) {
420
         logger.error('On peerMuteChanged - no endpoint ID');
423
         logger.error('On peerMuteChanged - no endpoint ID');
466
  * by their media type if this argument is specified.
469
  * by their media type if this argument is specified.
467
  * @return {Array<JitsiRemoteTrack>}
470
  * @return {Array<JitsiRemoteTrack>}
468
  */
471
  */
469
-TraceablePeerConnection.prototype.getRemoteTracks
470
-= function(endpointId, mediaType) {
472
+TraceablePeerConnection.prototype.getRemoteTracks = function(
473
+        endpointId,
474
+        mediaType) {
471
     const remoteTracks = [];
475
     const remoteTracks = [];
472
     const endpoints
476
     const endpoints
473
         = endpointId ? [ endpointId ] : this.remoteTracks.keys();
477
         = endpointId ? [ endpointId ] : this.remoteTracks.keys();
594
     if (!mediaLines.length) {
598
     if (!mediaLines.length) {
595
         GlobalOnErrorHandler.callErrorHandler(
599
         GlobalOnErrorHandler.callErrorHandler(
596
             new Error(
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
         // Abort
605
         // Abort
601
         return;
606
         return;
614
     if (!ssrcLines.length) {
619
     if (!ssrcLines.length) {
615
         GlobalOnErrorHandler.callErrorHandler(
620
         GlobalOnErrorHandler.callErrorHandler(
616
             new Error(
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
         // Abort
625
         // Abort
621
         return;
626
         return;
630
     if (isNaN(trackSsrc) || trackSsrc < 0) {
635
     if (isNaN(trackSsrc) || trackSsrc < 0) {
631
         GlobalOnErrorHandler.callErrorHandler(
636
         GlobalOnErrorHandler.callErrorHandler(
632
             new Error(
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
         // Abort
641
         // Abort
638
         return;
642
         return;
639
     } else if (!ownerEndpointId) {
643
     } else if (!ownerEndpointId) {
640
         GlobalOnErrorHandler.callErrorHandler(
644
         GlobalOnErrorHandler.callErrorHandler(
641
             new Error(
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
         // Abort
650
         // Abort
647
         return;
651
         return;
683
  * @param {number} ssrc the track's main SSRC number
687
  * @param {number} ssrc the track's main SSRC number
684
  * @param {boolean} muted the initial muted status
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
     const remoteTrack
698
     const remoteTrack
689
         = new JitsiRemoteTrack(
699
         = new JitsiRemoteTrack(
690
             this.rtc, this.rtc.conference,
700
             this.rtc, this.rtc.conference,
744
  * @param {MediaStreamTrack} track the WebRTC MediaStreamTrack which has been
754
  * @param {MediaStreamTrack} track the WebRTC MediaStreamTrack which has been
745
  * removed from the PeerConnection.
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
     const streamId = RTC.getStreamID(stream);
760
     const streamId = RTC.getStreamID(stream);
750
     const trackId = track && RTC.getTrackID(track);
761
     const trackId = track && RTC.getTrackID(track);
751
 
762
 
790
  * <tt>undefined</tt> if not found.
801
  * <tt>undefined</tt> if not found.
791
  * @private
802
  * @private
792
  */
803
  */
793
-TraceablePeerConnection.prototype._getRemoteTrackById
794
-= function(streamId, trackId) {
804
+TraceablePeerConnection.prototype._getRemoteTrackById = function(
805
+        streamId,
806
+        trackId) {
795
     // .find will break the loop once the first match is found
807
     // .find will break the loop once the first match is found
796
     for (const endpointTrackMap of this.remoteTracks.values()) {
808
     for (const endpointTrackMap of this.remoteTracks.values()) {
797
         for (const mediaTrack of endpointTrackMap.values()) {
809
         for (const mediaTrack of endpointTrackMap.values()) {
831
     }
843
     }
832
 
844
 
833
     logger.debug(
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
     return removedTracks;
849
     return removedTracks;
838
 };
850
 };
867
  * <tt>undefined</tt> if no track matching given stream and track ids was
879
  * <tt>undefined</tt> if no track matching given stream and track ids was
868
  * found.
880
  * found.
869
  */
881
  */
870
-TraceablePeerConnection.prototype._removeRemoteTrackById
871
-= function(streamId, trackId) {
882
+TraceablePeerConnection.prototype._removeRemoteTrackById = function(
883
+        streamId,
884
+        trackId) {
872
     const toBeRemoved = this._getRemoteTrackById(streamId, trackId);
885
     const toBeRemoved = this._getRemoteTrackById(streamId, trackId);
873
 
886
 
874
     if (toBeRemoved) {
887
     if (toBeRemoved) {
930
                     && typeof group.ssrcs !== 'undefined') {
943
                     && typeof group.ssrcs !== 'undefined') {
931
                     // Parse SSRCs and store as numbers
944
                     // Parse SSRCs and store as numbers
932
                     const groupSSRCs
945
                     const groupSSRCs
933
-                        = group.ssrcs.split(' ')
934
-                                     .map(ssrcStr => parseInt(ssrcStr, 10));
946
+                        = group.ssrcs.split(' ').map(
947
+                            ssrcStr => parseInt(ssrcStr, 10));
935
                     const primarySSRC = groupSSRCs[0];
948
                     const primarySSRC = groupSSRCs[0];
936
 
949
 
937
                     // Note that group.semantics is already present
950
                     // Note that group.semantics is already present
1326
  * <tt>false</tt> otherwise.
1339
  * <tt>false</tt> otherwise.
1327
  * @private
1340
  * @private
1328
  */
1341
  */
1329
-TraceablePeerConnection.prototype._assertTrackBelongs
1330
-= function(methodName, localTrack) {
1342
+TraceablePeerConnection.prototype._assertTrackBelongs = function(
1343
+        methodName,
1344
+        localTrack) {
1331
     const doesBelong = this.localTracks.has(localTrack.rtcId);
1345
     const doesBelong = this.localTracks.has(localTrack.rtcId);
1332
 
1346
 
1333
     if (!doesBelong) {
1347
     if (!doesBelong) {
1414
  * Remove stream handling for firefox
1428
  * Remove stream handling for firefox
1415
  * @param stream: webrtc media stream
1429
  * @param stream: webrtc media stream
1416
  */
1430
  */
1417
-TraceablePeerConnection.prototype._handleFirefoxRemoveStream
1418
-= function(stream) {
1431
+TraceablePeerConnection.prototype._handleFirefoxRemoveStream = function(
1432
+        stream) {
1419
     if (!stream) {
1433
     if (!stream) {
1420
         // There is nothing to be changed
1434
         // There is nothing to be changed
1421
         return;
1435
         return;
1472
  * the local description.
1486
  * the local description.
1473
  * @private
1487
  * @private
1474
  */
1488
  */
1475
-TraceablePeerConnection.prototype._ensureSimulcastGroupIsLast
1476
-= function(localSdp) {
1489
+TraceablePeerConnection.prototype._ensureSimulcastGroupIsLast = function(
1490
+        localSdp) {
1477
     let sdpStr = localSdp.sdp;
1491
     let sdpStr = localSdp.sdp;
1478
 
1492
 
1479
     const videoStartIndex = sdpStr.indexOf('m=video');
1493
     const videoStartIndex = sdpStr.indexOf('m=video');
1509
  * the local description.
1523
  * the local description.
1510
  * @private
1524
  * @private
1511
  */
1525
  */
1512
-TraceablePeerConnection.prototype._adjustLocalMediaDirection
1513
-= function(localDescription) {
1526
+TraceablePeerConnection.prototype._adjustLocalMediaDirection = function(
1527
+        localDescription) {
1514
     const transformer = new SdpTransformWrap(localDescription.sdp);
1528
     const transformer = new SdpTransformWrap(localDescription.sdp);
1515
     let modifiedDirection = false;
1529
     let modifiedDirection = false;
1516
     const audioMedia = transformer.selectMedia('audio');
1530
     const audioMedia = transformer.selectMedia('audio');
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
     let localSdp = description;
1571
     let localSdp = description;
1556
 
1572
 
1557
     this.trace('setLocalDescription::preTransform', dumpSDP(localSdp));
1573
     this.trace('setLocalDescription::preTransform', dumpSDP(localSdp));
1662
         return desc;
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
     this.trace('setRemoteDescription::preTransform', dumpSDP(description));
1685
     this.trace('setRemoteDescription::preTransform', dumpSDP(description));
1668
 
1686
 
1669
     // TODO the focus should squeze or explode the remote simulcast
1687
     // TODO the focus should squeze or explode the remote simulcast
1685
     if (RTCBrowserType.usesUnifiedPlan()) {
1703
     if (RTCBrowserType.usesUnifiedPlan()) {
1686
         description.sdp = this.rtxModifier.stripRtx(description.sdp);
1704
         description.sdp = this.rtxModifier.stripRtx(description.sdp);
1687
         this.trace(
1705
         this.trace(
1688
-                'setRemoteDescription::postTransform (stripRtx)',
1689
-                dumpSDP(description));
1706
+            'setRemoteDescription::postTransform (stripRtx)',
1707
+            dumpSDP(description));
1690
 
1708
 
1691
         // eslint-disable-next-line no-param-reassign
1709
         // eslint-disable-next-line no-param-reassign
1692
         description = this.interop.toUnifiedPlan(description);
1710
         description = this.interop.toUnifiedPlan(description);
1693
         this.trace(
1711
         this.trace(
1694
-                'setRemoteDescription::postTransform (Plan A)',
1695
-                dumpSDP(description));
1712
+            'setRemoteDescription::postTransform (Plan A)',
1713
+            dumpSDP(description));
1696
 
1714
 
1697
         if (this.isSimulcastOn()) {
1715
         if (this.isSimulcastOn()) {
1698
             // eslint-disable-next-line no-param-reassign
1716
             // eslint-disable-next-line no-param-reassign
1699
             description = this._insertUnifiedPlanSimulcastReceive(description);
1717
             description = this._insertUnifiedPlanSimulcastReceive(description);
1700
-            this.trace('setRemoteDescription::postTransform (sim receive)',
1718
+            this.trace(
1719
+                'setRemoteDescription::postTransform (sim receive)',
1701
                 dumpSDP(description));
1720
                 dumpSDP(description));
1702
         }
1721
         }
1703
     } else {
1722
     } else {
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
         const videoSender
1891
         const videoSender
1872
             = this.peerconnection.getSenders().find(sender =>
1892
             = this.peerconnection.getSenders().find(sender =>
1873
                 sender.track.kind === 'video');
1893
                 sender.track.kind === 'video');
1893
         false /* answer */, successCallback, failureCallback, constraints);
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
     this._createOfferOrAnswer(
1920
     this._createOfferOrAnswer(
1899
         true /* offer */, successCallback, failureCallback, constraints);
1921
         true /* offer */, successCallback, failureCallback, constraints);
1900
 };
1922
 };
1901
 
1923
 
1902
 /* eslint-disable max-params */
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
     const logName = isOffer ? 'Offer' : 'Answer';
1931
     const logName = isOffer ? 'Offer' : 'Answer';
1907
 
1932
 
1908
     this.trace(`create${logName}`, JSON.stringify(constraints, null, ' '));
1933
     this.trace(`create${logName}`, JSON.stringify(constraints, null, ' '));
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
     // var self = this;
2114
     // var self = this;
2088
     this.trace('addIceCandidate', JSON.stringify(candidate, null, ' '));
2115
     this.trace('addIceCandidate', JSON.stringify(candidate, null, ' '));
2089
     this.peerconnection.addIceCandidate(
2116
     this.peerconnection.addIceCandidate(

+ 4
- 4
modules/connectivity/ConnectionQuality.js Bestand weergeven

490
      * @param data the statistics received
490
      * @param data the statistics received
491
      */
491
      */
492
     _updateRemoteStats(id, data) {
492
     _updateRemoteStats(id, data) {
493
-            // Use only the fields we need
493
+        // Use only the fields we need
494
         this._remoteStats[id] = {
494
         this._remoteStats[id] = {
495
             bitrate: data.bitrate,
495
             bitrate: data.bitrate,
496
             packetLoss: data.packetLoss,
496
             packetLoss: data.packetLoss,
499
         };
499
         };
500
 
500
 
501
         this.eventEmitter.emit(
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 Bestand weergeven

99
      * @private
99
      * @private
100
      */
100
      */
101
     static _getNewStateForJvbMode(
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
         if (!isConnectionActiveByJvb) {
107
         if (!isConnectionActiveByJvb) {
109
             // when there is a connection problem signaled from jvb
108
             // when there is a connection problem signaled from jvb
110
             // it means no media was flowing for at least 15secs, so both audio
109
             // it means no media was flowing for at least 15secs, so both audio
607
         }
606
         }
608
 
607
 
609
         logger.debug(
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
         this._changeConnectionStatus(participant, newState);
617
         this._changeConnectionStatus(participant, newState);
619
     }
618
     }

+ 12
- 9
modules/statistics/AvgRTPStatsReporter.js Bestand weergeven

781
             if (isLocal ? peerID === myID : peerID !== myID) {
781
             if (isLocal ? peerID === myID : peerID !== myID) {
782
                 const participant
782
                 const participant
783
                     = isLocal
783
                     = isLocal
784
-                    ? null : this._conference.getParticipantById(peerID);
784
+                        ? null
785
+                        : this._conference.getParticipantById(peerID);
785
                 const videosResolution = peerResolutions[peerID];
786
                 const videosResolution = peerResolutions[peerID];
786
 
787
 
787
                 // Do not continue without participant for non local peerID
788
                 // Do not continue without participant for non local peerID
824
             if (videoTracks) {
825
             if (videoTracks) {
825
                 ssrcs
826
                 ssrcs
826
                     = ssrcs.filter(
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
         } else {
834
         } else {
833
             videoTracks = this._conference.getLocalTracks(MediaType.VIDEO);
835
             videoTracks = this._conference.getLocalTracks(MediaType.VIDEO);
834
             ssrcs
836
             ssrcs
835
                 = ssrcs.filter(
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
         let peerPixelsSum = 0;
845
         let peerPixelsSum = 0;

+ 1
- 2
modules/statistics/CallStats.js Bestand weergeven

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

+ 6
- 5
modules/statistics/RTPStatsCollector.js Bestand weergeven

517
 
517
 
518
             if (!conferenceStatsTransport.some(
518
             if (!conferenceStatsTransport.some(
519
                     t =>
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
                 conferenceStatsTransport.push({
523
                 conferenceStatsTransport.push({
524
                     ip,
524
                     ip,
525
                     type,
525
                     type,
822
 
822
 
823
     this.conferenceStats.packetLoss = {
823
     this.conferenceStats.packetLoss = {
824
         total:
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
         download:
828
         download:
828
             calculatePacketLoss(lostPackets.download, totalPackets.download),
829
             calculatePacketLoss(lostPackets.download, totalPackets.download),
829
         upload:
830
         upload:

+ 1
- 1
modules/statistics/SpeakerStats.spec.js Bestand weergeven

54
             }
54
             }
55
 
55
 
56
             expect(speakerStats.getTotalDominantSpeakerTime())
56
             expect(speakerStats.getTotalDominantSpeakerTime())
57
-              .toBe(domaintSpeakerTime * domaintSpeakerEvents);
57
+                .toBe(domaintSpeakerTime * domaintSpeakerEvents);
58
         });
58
         });
59
     });
59
     });
60
 });
60
 });

+ 9
- 6
modules/statistics/statistics.js Bestand weergeven

38
 function loadCallStatsAPI(customScriptUrl) {
38
 function loadCallStatsAPI(customScriptUrl) {
39
     if (!isCallstatsLoaded) {
39
     if (!isCallstatsLoaded) {
40
         ScriptUtil.loadScript(
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
         isCallstatsLoaded = true;
45
         isCallstatsLoaded = true;
46
     }
46
     }
47
 
47
 
164
 
164
 
165
     try {
165
     try {
166
         const rtpStats
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
         rtpStats.start(Statistics.audioLevelsEnabled);
173
         rtpStats.start(Statistics.audioLevelsEnabled);
171
         this.rtpStatsMap.set(peerconnection.id, rtpStats);
174
         this.rtpStatsMap.set(peerconnection.id, rtpStats);

+ 8
- 8
modules/transcription/audioRecorder.js Bestand weergeven

5
 /**
5
 /**
6
  * Possible audio formats MIME types
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
  * A TrackRecorder object holds all the information needed for recording a
12
  * A TrackRecorder object holds all the information needed for recording a
282
     const array = [];
282
     const array = [];
283
 
283
 
284
     this.recorders.forEach(
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
     return array;
292
     return array;
293
 };
293
 };

+ 7
- 7
modules/transcription/transcriber.js Bestand weergeven

59
     if (this.state !== BEFORE_STATE) {
59
     if (this.state !== BEFORE_STATE) {
60
         throw new Error(
60
         throw new Error(
61
             `The transcription can only start when it's in the "${
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
     this.state = RECORDING_STATE;
65
     this.state = RECORDING_STATE;
66
     this.audioRecorder.start();
66
     this.audioRecorder.start();
77
     if (this.state !== RECORDING_STATE) {
77
     if (this.state !== RECORDING_STATE) {
78
         throw new Error(
78
         throw new Error(
79
             `The transcription can only stop when it's in the "${
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
     // stop the recording
84
     // stop the recording
171
 Transcriber.prototype.merge = function() {
171
 Transcriber.prototype.merge = function() {
172
     console.log(
172
     console.log(
173
         `starting merge process!\n The length of the array: ${
173
         `starting merge process!\n The length of the array: ${
174
-             this.results.length}`);
174
+            this.results.length}`);
175
     this.transcription = '';
175
     this.transcription = '';
176
 
176
 
177
     // the merging algorithm will look over all Word objects who are at pos 0 in
177
     // the merging algorithm will look over all Word objects who are at pos 0 in
329
     if (this.state !== FINISHED_STATE) {
329
     if (this.state !== FINISHED_STATE) {
330
         throw new Error(
330
         throw new Error(
331
             `The transcription can only be retrieved when it's in the "${
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
     return this.transcription;
336
     return this.transcription;

+ 19
- 19
modules/xmpp/Caps.js Bestand weergeven

126
                         .each(
126
                         .each(
127
                             (idx, el) => features.add(el.getAttribute('var')));
127
                             (idx, el) => features.add(el.getAttribute('var')));
128
                     if (user) {
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
                     resolve(features);
132
                     resolve(features);
135
                 }, reject, timeout)
133
                 }, reject, timeout)
188
      * Generates the value for the "ver" attribute.
186
      * Generates the value for the "ver" attribute.
189
      */
187
      */
190
     _generateVersion() {
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
         this._notifyVersionChanged();
206
         this._notifyVersionChanged();
207
     }
207
     }
208
 
208
 

+ 36
- 27
modules/xmpp/ChatRoom.js Bestand weergeven

1
 /* global $, $pres, $iq, $msg, __filename, Strophe */
1
 /* global $, $pres, $iq, $msg, __filename, Strophe */
2
+
2
 import { getLogger } from 'jitsi-meet-logger';
3
 import { getLogger } from 'jitsi-meet-logger';
3
 import GlobalOnErrorHandler from '../util/GlobalOnErrorHandler';
4
 import GlobalOnErrorHandler from '../util/GlobalOnErrorHandler';
4
 import * as JitsiTranscriptionStatus from '../../JitsiTranscriptionStatus';
5
 import * as JitsiTranscriptionStatus from '../../JitsiTranscriptionStatus';
310
      *
311
      *
311
      */
312
      */
312
     discoRoomInfo() {
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
         this.connection.sendIQ(getInfo, result => {
323
         this.connection.sendIQ(getInfo, result => {
320
             const locked
324
             const locked
321
                 = $(result).find('>query>feature[var="muc_passwordprotected"]')
325
                 = $(result).find('>query>feature[var="muc_passwordprotected"]')
322
-                        .length
326
+                    .length
323
                     === 1;
327
                     === 1;
324
 
328
 
325
             if (locked !== this.locked) {
329
             if (locked !== this.locked) {
522
             switch (node.tagName) {
526
             switch (node.tagName) {
523
             case 'nick':
527
             case 'nick':
524
                 if (!member.isFocus) {
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
                     if (displayName && displayName.length > 0) {
534
                     if (displayName && displayName.length > 0) {
529
                         this.eventEmitter.emit(
535
                         this.eventEmitter.emit(
712
         if ($(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]'
718
         if ($(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]'
713
             + '>destroy').length) {
719
             + '>destroy').length) {
714
             let reason;
720
             let reason;
715
-            const reasonSelect = $(pres).find(
721
+            const reasonSelect
722
+                = $(pres).find(
716
                     '>x[xmlns="http://jabber.org/protocol/muc#user"]'
723
                     '>x[xmlns="http://jabber.org/protocol/muc#user"]'
717
-                    + '>destroy>reason');
724
+                        + '>destroy>reason');
718
 
725
 
719
             if (reasonSelect.length) {
726
             if (reasonSelect.length) {
720
                 reason = reasonSelect.text();
727
                 reason = reasonSelect.text();
729
         // Status code 110 indicates that this notification is "self-presence".
736
         // Status code 110 indicates that this notification is "self-presence".
730
         const isSelfPresence
737
         const isSelfPresence
731
             = $(pres)
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
         const isKick
743
         const isKick
738
             = $(pres)
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
         const membersKeys = Object.keys(this.members);
749
         const membersKeys = Object.keys(this.members);
745
 
750
 
746
         if (!isSelfPresence) {
751
         if (!isSelfPresence) {
1098
      */
1103
      */
1099
     addAudioInfoToPresence(mute) {
1104
     addAudioInfoToPresence(mute) {
1100
         this.removeFromPresence('audiomuted');
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
      */
1132
      */
1126
     addVideoInfoToPresence(mute) {
1133
     addVideoInfoToPresence(mute) {
1127
         this.removeFromPresence('videomuted');
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 Bestand weergeven

407
                         });
407
                         });
408
                     this.wasConnected = true;
408
                     this.wasConnected = true;
409
                     this.room.eventEmitter.emit(
409
                     this.room.eventEmitter.emit(
410
-                            XMPPEvents.CONNECTION_ESTABLISHED, this);
410
+                        XMPPEvents.CONNECTION_ESTABLISHED, this);
411
                 }
411
                 }
412
                 this.isreconnect = false;
412
                 this.isreconnect = false;
413
                 break;
413
                 break;
417
                 }
417
                 }
418
                 this.isreconnect = true;
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
                 if (this.wasstable) {
422
                 if (this.wasstable) {
423
                     this.room.eventEmitter.emit(
423
                     this.room.eventEmitter.emit(
424
                         XMPPEvents.CONNECTION_INTERRUPTED, this);
424
                         XMPPEvents.CONNECTION_INTERRUPTED, this);
523
                 ice.xmlns = 'urn:xmpp:jingle:transports:ice-udp:1';
523
                 ice.xmlns = 'urn:xmpp:jingle:transports:ice-udp:1';
524
                 cand.c('content', {
524
                 cand.c('content', {
525
                     creator: this.initiator === this.localJid
525
                     creator: this.initiator === this.localJid
526
-                                    ? 'initiator' : 'responder',
526
+                        ? 'initiator' : 'responder',
527
                     name: cands[0].sdpMid ? cands[0].sdpMid : mline.media
527
                     name: cands[0].sdpMid ? cands[0].sdpMid : mline.media
528
                 }).c('transport', ice);
528
                 }).c('transport', ice);
529
                 for (let i = 0; i < cands.length; i++) {
529
                 for (let i = 0; i < cands.length; i++) {
664
                                         + ` for ${owner}`);
664
                                         + ` for ${owner}`);
665
                             } else {
665
                             } else {
666
                                 this.signalingLayer.setSSRCOwner(
666
                                 this.signalingLayer.setSSRCOwner(
667
-                                ssrc, Strophe.getResourceFromJid(owner));
667
+                                    ssrc,
668
+                                    Strophe.getResourceFromJid(owner));
668
                             }
669
                             }
669
                         }
670
                         }
670
                     });
671
                     });
894
                 }, error => {
895
                 }, error => {
895
                     logger.error(
896
                     logger.error(
896
                         `Error renegotiating after setting new remote ${
897
                         `Error renegotiating after setting new remote ${
897
-                            (this.isInitiator ? 'answer: ' : 'offer: ')
898
-                            }${error}`, newRemoteSdp);
898
+                            this.isInitiator ? 'answer: ' : 'offer: '}${error}`,
899
+                        newRemoteSdp);
899
                     JingleSessionPC.onJingleFatalError(this, error);
900
                     JingleSessionPC.onJingleFatalError(this, error);
900
                     finishedCallback(error);
901
                     finishedCallback(error);
901
                 });
902
                 });
1034
                 to: this.peerjid,
1035
                 to: this.peerjid,
1035
                 type: 'set'
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
         logger.info(
1049
         logger.info(
1049
             `Sending content-modify, video senders: ${newSendersValue}`);
1050
             `Sending content-modify, video senders: ${newSendersValue}`);
1147
                     to: this.peerjid,
1148
                     to: this.peerjid,
1148
                     type: 'set'
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
             if (options && options.reasonDescription) {
1160
             if (options && options.reasonDescription) {
1160
                 sessionTerminate.up()
1161
                 sessionTerminate.up()
1228
 
1229
 
1229
                     if (ssrcs.length) {
1230
                     if (ssrcs.length) {
1230
                         lines
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
 
1686
 
1686
                     if (ssrcs.length) {
1687
                     if (ssrcs.length) {
1687
                         lines
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
                     /* eslint-enable no-invalid-this */
1693
                     /* eslint-enable no-invalid-this */

+ 38
- 39
modules/xmpp/RtxModifier.spec.js Bestand weergeven

13
 function numVideoSsrcs(parsedSdp) {
13
 function numVideoSsrcs(parsedSdp) {
14
     const videoMLine = parsedSdp.media.find(m => m.type === 'video');
14
     const videoMLine = parsedSdp.media.find(m => m.type === 'video');
15
 
15
 
16
-
17
     return videoMLine.ssrcs
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
     videoMLine.ssrcGroups = videoMLine.ssrcGroups || [];
72
     videoMLine.ssrcGroups = videoMLine.ssrcGroups || [];
74
 
73
 
75
     return videoMLine.ssrcGroups
74
     return videoMLine.ssrcGroups
76
-    .filter(g => g.semantics === groupSemantics);
75
+        .filter(g => g.semantics === groupSemantics);
77
 }
76
 }
78
 
77
 
79
 describe('RtxModifier', () => {
78
 describe('RtxModifier', () => {
90
                 this.primaryVideoSsrc = getPrimaryVideoSsrc(this.singleVideoSdp);
89
                 this.primaryVideoSsrc = getPrimaryVideoSsrc(this.singleVideoSdp);
91
             });
90
             });
92
             it('should add a single rtx ssrc', function() {
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
                 const newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.singleVideoSdp));
94
                 const newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.singleVideoSdp));
96
                 const newSdp = transform.parse(newSdpStr);
95
                 const newSdp = transform.parse(newSdpStr);
97
                 const newPrimaryVideoSsrc = getPrimaryVideoSsrc(newSdp);
96
                 const newPrimaryVideoSsrc = getPrimaryVideoSsrc(newSdp);
98
 
97
 
99
                 expect(newPrimaryVideoSsrc).toEqual(this.primaryVideoSsrc);
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
                 expect(numVideoSsrcs(newSdp)).toEqual(2);
101
                 expect(numVideoSsrcs(newSdp)).toEqual(2);
103
 
102
 
104
-          // Should now have an FID group
103
+                // Should now have an FID group
105
                 const fidGroups = getVideoGroups(newSdp, 'FID');
104
                 const fidGroups = getVideoGroups(newSdp, 'FID');
106
 
105
 
107
                 expect(fidGroups.length).toEqual(1);
106
                 expect(fidGroups.length).toEqual(1);
113
             });
112
             });
114
 
113
 
115
             it('should re-use the same rtx ssrc for a primary ssrc it\'s seen before', function() {
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
                 let newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.singleVideoSdp));
118
                 let newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.singleVideoSdp));
120
                 let newSdp = transform.parse(newSdpStr);
119
                 let newSdp = transform.parse(newSdpStr);
121
 
120
 
122
                 let fidGroup = getVideoGroups(newSdp, 'FID')[0];
121
                 let fidGroup = getVideoGroups(newSdp, 'FID')[0];
123
                 const fidGroupRtxSsrc = SDPUtil.parseGroupSsrcs(fidGroup)[1];
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
                 newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.singleVideoSdp));
125
                 newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.singleVideoSdp));
127
                 newSdp = transform.parse(newSdpStr);
126
                 newSdp = transform.parse(newSdpStr);
128
                 fidGroup = getVideoGroups(newSdp, 'FID')[0];
127
                 fidGroup = getVideoGroups(newSdp, 'FID')[0];
132
             });
131
             });
133
 
132
 
134
             it('should NOT re-use the same rtx ssrc for a primary ssrc it\'s seen before if the cache has been cleared', function() {
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
                 let newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.singleVideoSdp));
138
                 let newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.singleVideoSdp));
140
                 let newSdp = transform.parse(newSdpStr);
139
                 let newSdp = transform.parse(newSdpStr);
141
 
140
 
144
 
143
 
145
                 this.rtxModifier.clearSsrcCache();
144
                 this.rtxModifier.clearSsrcCache();
146
 
145
 
147
-          // Now pass the original sdp through again
146
+                // Now pass the original sdp through again
148
                 newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.singleVideoSdp));
147
                 newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.singleVideoSdp));
149
                 newSdp = transform.parse(newSdpStr);
148
                 newSdp = transform.parse(newSdpStr);
150
                 fidGroup = getVideoGroups(newSdp, 'FID')[0];
149
                 fidGroup = getVideoGroups(newSdp, 'FID')[0];
154
             });
153
             });
155
 
154
 
156
             it('should use the rtx ssrc from the cache when the cache has been manually set', function() {
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
                 const forcedRtxSsrc = 123456;
159
                 const forcedRtxSsrc = 123456;
161
                 const ssrcCache = new Map();
160
                 const ssrcCache = new Map();
162
 
161
 
179
             });
178
             });
180
 
179
 
181
             it('should add rtx ssrcs for all of them', function() {
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
                 const newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.multipleVideoSdp));
183
                 const newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.multipleVideoSdp));
185
                 const newSdp = transform.parse(newSdpStr);
184
                 const newSdp = transform.parse(newSdpStr);
186
                 const newPrimaryVideoSsrcs = getPrimaryVideoSsrcs(newSdp);
185
                 const newPrimaryVideoSsrcs = getPrimaryVideoSsrcs(newSdp);
187
 
186
 
188
                 expect(newPrimaryVideoSsrcs).toEqual(this.primaryVideoSsrcs);
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
                 expect(numVideoSsrcs(newSdp)).toEqual(this.primaryVideoSsrcs.length * 2);
190
                 expect(numVideoSsrcs(newSdp)).toEqual(this.primaryVideoSsrcs.length * 2);
192
 
191
 
193
-          // Should now have FID groups
192
+                // Should now have FID groups
194
                 const fidGroups = getVideoGroups(newSdp, 'FID');
193
                 const fidGroups = getVideoGroups(newSdp, 'FID');
195
 
194
 
196
                 expect(fidGroups.length).toEqual(this.primaryVideoSsrcs.length);
195
                 expect(fidGroups.length).toEqual(this.primaryVideoSsrcs.length);
202
             });
201
             });
203
 
202
 
204
             it('should re-use the same rtx ssrcs for any primary ssrc it\'s seen before', function() {
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
                 let newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.multipleVideoSdp));
207
                 let newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.multipleVideoSdp));
209
                 let newSdp = transform.parse(newSdpStr);
208
                 let newSdp = transform.parse(newSdpStr);
210
 
209
 
211
                 const rtxMapping = new Map();
210
                 const rtxMapping = new Map();
212
                 let fidGroups = getVideoGroups(newSdp, 'FID');
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
                 fidGroups.forEach(fidGroup => {
215
                 fidGroups.forEach(fidGroup => {
217
                     const fidSsrcs = SDPUtil.parseGroupSsrcs(fidGroup);
216
                     const fidSsrcs = SDPUtil.parseGroupSsrcs(fidGroup);
221
                     rtxMapping.set(fidGroupPrimarySsrc, fidGroupRtxSsrc);
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
                 newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.multipleVideoSdp));
224
                 newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.multipleVideoSdp));
226
                 newSdp = transform.parse(newSdpStr);
225
                 newSdp = transform.parse(newSdpStr);
227
                 fidGroups = getVideoGroups(newSdp, 'FID');
226
                 fidGroups = getVideoGroups(newSdp, 'FID');
236
             });
235
             });
237
 
236
 
238
             it('should NOT re-use the same rtx ssrcs for any primary ssrc it\'s seen before if the cache has been cleared', function() {
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
                 let newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.multipleVideoSdp));
242
                 let newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.multipleVideoSdp));
244
                 let newSdp = transform.parse(newSdpStr);
243
                 let newSdp = transform.parse(newSdpStr);
245
 
244
 
246
                 const rtxMapping = new Map();
245
                 const rtxMapping = new Map();
247
                 let fidGroups = getVideoGroups(newSdp, 'FID');
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
                 fidGroups.forEach(fidGroup => {
250
                 fidGroups.forEach(fidGroup => {
252
                     const fidSsrcs = SDPUtil.parseGroupSsrcs(fidGroup);
251
                     const fidSsrcs = SDPUtil.parseGroupSsrcs(fidGroup);
258
 
257
 
259
                 this.rtxModifier.clearSsrcCache();
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
                 newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.multipleVideoSdp));
261
                 newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.multipleVideoSdp));
263
                 newSdp = transform.parse(newSdpStr);
262
                 newSdp = transform.parse(newSdpStr);
264
                 fidGroups = getVideoGroups(newSdp, 'FID');
263
                 fidGroups = getVideoGroups(newSdp, 'FID');
273
             });
272
             });
274
 
273
 
275
             it('should use the rtx ssrcs from the cache when the cache has been manually set', function() {
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
                 const rtxMapping = new Map();
278
                 const rtxMapping = new Map();
280
 
279
 
281
                 this.primaryVideoSsrcs.forEach(ssrc => {
280
                 this.primaryVideoSsrcs.forEach(ssrc => {

+ 6
- 5
modules/xmpp/SDP.js Bestand weergeven

56
         tmp = SDPUtil.findLines(self.media[mediaindex], 'a=ssrc:');
56
         tmp = SDPUtil.findLines(self.media[mediaindex], 'a=ssrc:');
57
         const mid
57
         const mid
58
             = SDPUtil.parseMID(
58
             = SDPUtil.parseMID(
59
-                SDPUtil.findLine(self.media[mediaindex],
60
-                'a=mid:'));
59
+                SDPUtil.findLine(self.media[mediaindex], 'a=mid:'));
61
         const media = {
60
         const media = {
62
             mediaindex,
61
             mediaindex,
63
             mid,
62
             mid,
782
                 += $(this)
781
                 += $(this)
783
                     .find('parameter')
782
                     .find('parameter')
784
                     .map(function() {
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
                     .get()
790
                     .get()
790
                     .join('; ');
791
                     .join('; ');

+ 1
- 2
modules/xmpp/SDPUtil.js Bestand weergeven

552
      */
552
      */
553
     getUfrag(sdp) {
553
     getUfrag(sdp) {
554
         const ufragLines
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
         if (ufragLines.length > 0) {
557
         if (ufragLines.length > 0) {
559
             return ufragLines[0].substr('a=ice-ufrag:'.length);
558
             return ufragLines[0].substr('a=ice-ufrag:'.length);

+ 5
- 5
modules/xmpp/SdpTransformUtil.js Bestand weergeven

29
     }
29
     }
30
 
30
 
31
     return mLine.ssrcs
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
             return this.mLine.ssrcs[0].id;
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
         if (this.mLine.ssrcGroups) {
246
         if (this.mLine.ssrcGroups) {
247
             const simGroup = this.findGroup('SIM');
247
             const simGroup = this.findGroup('SIM');
248
 
248
 
346
 
346
 
347
         this.mLine.ssrcGroups
347
         this.mLine.ssrcGroups
348
             = this.mLine.ssrcGroups
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 Bestand weergeven

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

+ 76
- 62
modules/xmpp/recording.js Bestand weergeven

1
-  /* global $, $iq */
1
+/* global $, $iq */
2
 
2
 
3
 import { getLogger } from 'jitsi-meet-logger';
3
 import { getLogger } from 'jitsi-meet-logger';
4
 const logger = getLogger(__filename);
4
 const logger = getLogger(__filename);
12
  * @param {Element|Object} errorIqNode - Either DOM element or the structure
12
  * @param {Element|Object} errorIqNode - Either DOM element or the structure
13
  * from ChatRoom packet2JSON.
13
  * from ChatRoom packet2JSON.
14
  * @return {{
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
 function getJibriErrorDetails(errorIqNode) {
20
 function getJibriErrorDetails(errorIqNode) {
177
         })
177
         })
178
             .c('jibri', {
178
             .c('jibri', {
179
                 'xmlns': 'http://jitsi.org/protocol/jibri',
179
                 'xmlns': 'http://jitsi.org/protocol/jibri',
180
-                'action': state === Recording.status.ON
180
+                'action':
181
+                    state === Recording.status.ON
181
                         ? Recording.action.START
182
                         ? Recording.action.START
182
                         : Recording.action.STOP,
183
                         : Recording.action.STOP,
183
-                'recording_mode': this.type === Recording.types.JIBRI_FILE
184
+                'recording_mode':
185
+                    this.type === Recording.types.JIBRI_FILE
184
                         ? 'file'
186
                         ? 'file'
185
                         : 'stream',
187
                         : 'stream',
186
-                'streamid': this.type === Recording.types.JIBRI
188
+                'streamid':
189
+                    this.type === Recording.types.JIBRI
187
                         ? options.streamId
190
                         ? options.streamId
188
                         : undefined
191
                         : undefined
189
             })
192
             })
192
     logger.log(`Set jibri recording: ${state}`, iq.nodeTree);
195
     logger.log(`Set jibri recording: ${state}`, iq.nodeTree);
193
     logger.log(iq.nodeTree);
196
     logger.log(iq.nodeTree);
194
     this.connection.sendIQ(
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
 /* eslint-enable max-params */
214
 /* eslint-enable max-params */
215
             errCallback(new Error('Invalid state!'));
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
         if (state === Recording.status.OFF) {
233
         if (state === Recording.status.OFF) {
227
             iq.attrs({ rid: this.jireconRid });
234
             iq.attrs({ rid: this.jireconRid });
231
         const self = this;
238
         const self = this;
232
 
239
 
233
         this.connection.sendIQ(
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
 /* eslint-disable max-params */
266
 /* eslint-disable max-params */
341
  * @param statusChangeHandler {function} receives the new status as argument.
350
  * @param statusChangeHandler {function} receives the new status as argument.
342
  */
351
  */
343
 Recording.prototype.toggleRecording = function(
352
 Recording.prototype.toggleRecording = function(
344
-    options = { },
345
-    statusChangeHandler) {
353
+        options = { },
354
+        statusChangeHandler) {
346
     const oldState = this.state;
355
     const oldState = this.state;
347
 
356
 
348
     // If the recorder is currently unavailable we throw an error.
357
     // If the recorder is currently unavailable we throw an error.
349
     if (oldState === Recording.status.UNAVAILABLE
358
     if (oldState === Recording.status.UNAVAILABLE
350
         || oldState === Recording.status.FAILED) {
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
     } else if (oldState === Recording.status.BUSY) {
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
     // If we're about to turn ON the recording we need either a streamId or
369
     // If we're about to turn ON the recording we need either a streamId or
359
     // an authentication token depending on the recording type. If we don't
370
     // an authentication token depending on the recording type. If we don't
360
     // have any of those we throw an error.
371
     // have any of those we throw an error.
361
     if ((oldState === Recording.status.OFF
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
         logger.error('No token passed!');
380
         logger.error('No token passed!');
368
 
381
 
369
         return;
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
     const self = this;
391
     const self = this;
378
 
392
 

+ 40
- 38
modules/xmpp/strophe.jingle.js Bestand weergeven

136
                 const audioMuted = startMuted.attr('audio');
136
                 const audioMuted = startMuted.attr('audio');
137
                 const videoMuted = startMuted.attr('video');
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
             // FIXME that should work most of the time, but we'd have to
145
             // FIXME that should work most of the time, but we'd have to
148
             logger.info(
150
             logger.info(
149
                 `Marking session from ${fromJid
151
                 `Marking session from ${fromJid
150
                 } as ${isP2P ? '' : '*not*'} P2P`);
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
             this.sessions[sess.sid] = sess;
165
             this.sessions[sess.sid] = sess;
163
 
166
 
164
             this.eventEmitter.emit(XMPPEvents.CALL_INCOMING,
167
             this.eventEmitter.emit(XMPPEvents.CALL_INCOMING,
165
-                    sess, $(iq).find('>jingle'), now);
168
+                sess, $(iq).find('>jingle'), now);
166
             Statistics.analytics.sendEvent(
169
             Statistics.analytics.sendEvent(
167
-                    'xmpp.session-initiate', { value: now });
170
+                'xmpp.session-initiate', { value: now });
168
             break;
171
             break;
169
         }
172
         }
170
         case 'session-accept': {
173
         case 'session-accept': {
199
         case 'transport-replace':
202
         case 'transport-replace':
200
             logger.info('(TIME) Start transport replace', now);
203
             logger.info('(TIME) Start transport replace', now);
201
             Statistics.analytics.sendEvent(
204
             Statistics.analytics.sendEvent(
202
-                    'xmpp.transport-replace.start', { value: now });
205
+                'xmpp.transport-replace.start',
206
+                { value: now });
203
 
207
 
204
             sess.replaceTransport($(iq).find('>jingle'), () => {
208
             sess.replaceTransport($(iq).find('>jingle'), () => {
205
                 const successTime = window.performance.now();
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
                 Statistics.analytics.sendEvent(
212
                 Statistics.analytics.sendEvent(
210
-                        'xmpp.transport-replace.success',
211
-                        { value: successTime });
213
+                    'xmpp.transport-replace.success',
214
+                    { value: successTime });
212
             }, error => {
215
             }, error => {
213
                 GlobalOnErrorHandler.callErrorHandler(error);
216
                 GlobalOnErrorHandler.callErrorHandler(error);
214
                 logger.error('Transport replace failed', error);
217
                 logger.error('Transport replace failed', error);
227
             logger.warn('jingle action not implemented', action);
230
             logger.warn('jingle action not implemented', action);
228
             ack.attrs({ type: 'error' });
231
             ack.attrs({ type: 'error' });
229
             ack.c('error', { type: 'cancel' })
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
             break;
236
             break;
234
         }
237
         }
235
         this.connection.send(ack);
238
         this.connection.send(ack);
247
     newP2PJingleSession(me, peer) {
250
     newP2PJingleSession(me, peer) {
248
         const sess
251
         const sess
249
             = new JingleSessionPC(
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
         this.sessions[sess.sid] = sess;
263
         this.sessions[sess.sid] = sess;
261
 
264
 
325
                         // ?id=1508
328
                         // ?id=1508
326
 
329
 
327
                         if (username) {
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
                                 dict.url += `${username}@`;
336
                                 dict.url += `${username}@`;
335
                             } else {
337
                             } else {
336
-                                    // only works in M28
338
+                                // only works in M28
337
                                 dict.username = username;
339
                                 dict.username = username;
338
                             }
340
                             }
339
                         }
341
                         }

+ 3
- 3
modules/xmpp/strophe.util.js Bestand weergeven

63
         /* eslint-disable no-case-declarations */
63
         /* eslint-disable no-case-declarations */
64
         switch (level) {
64
         switch (level) {
65
         case Strophe.LogLevel.DEBUG:
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
             if (lastErrorStatus !== -1
68
             if (lastErrorStatus !== -1
69
-                        && resetLastErrorStatusRegExpr.test(msg)) {
69
+                    && resetLastErrorStatusRegExpr.test(msg)) {
70
                 logger.debug('Reset lastErrorStatus');
70
                 logger.debug('Reset lastErrorStatus');
71
                 lastErrorStatus = -1;
71
                 lastErrorStatus = -1;
72
             }
72
             }

+ 4
- 4
modules/xmpp/xmpp.js Bestand weergeven

162
                 this.authenticatedUser = true;
162
                 this.authenticatedUser = true;
163
             }
163
             }
164
             if (this.connection && this.connection.connected
164
             if (this.connection && this.connection.connected
165
-                && Strophe.getResourceFromJid(this.connection.jid)) {
165
+                    && Strophe.getResourceFromJid(this.connection.jid)) {
166
                 // .connected is true while connecting?
166
                 // .connected is true while connecting?
167
-    //                this.connection.send($pres());
167
+                // this.connection.send($pres());
168
                 this.eventEmitter.emit(
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
         } else if (status === Strophe.Status.CONNFAIL) {
172
         } else if (status === Strophe.Status.CONNFAIL) {
173
             if (msg === 'x-strophe-bad-non-anon-jid') {
173
             if (msg === 'x-strophe-bad-non-anon-jid') {

+ 3
- 3
package.json Bestand weergeven

30
   },
30
   },
31
   "devDependencies": {
31
   "devDependencies": {
32
     "babel-core": "6.26.0",
32
     "babel-core": "6.26.0",
33
-    "babel-eslint": "7.2.3",
33
+    "babel-eslint": "8.0.1",
34
     "babel-loader": "7.1.2",
34
     "babel-loader": "7.1.2",
35
     "babel-preset-es2015": "6.24.1",
35
     "babel-preset-es2015": "6.24.1",
36
     "babel-preset-stage-1": "6.24.1",
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
     "eslint-plugin-import": "2.7.0",
39
     "eslint-plugin-import": "2.7.0",
40
     "flow-bin": "0.38.0",
40
     "flow-bin": "0.38.0",
41
     "jasmine-core": "2.5.2",
41
     "jasmine-core": "2.5.2",

+ 4
- 4
webpack.config.js Bestand weergeven

39
                 flags: 'g',
39
                 flags: 'g',
40
                 replace:
40
                 replace:
41
                     child_process.execSync( // eslint-disable-line camelcase
41
                     child_process.execSync( // eslint-disable-line camelcase
42
-                            `${__dirname}/get-version.sh`)
42
+                        `${__dirname}/get-version.sh`)
43
 
43
 
44
                         // The type of the return value of
44
                         // The type of the return value of
45
                         // child_process.execSync is either Buffer or String.
45
                         // child_process.execSync is either Buffer or String.
46
                         .toString()
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
                 search: '{#COMMIT_HASH#}'
51
                 search: '{#COMMIT_HASH#}'
52
             },
52
             },
53
             test: `${__dirname}/JitsiMeetJS.js`
53
             test: `${__dirname}/JitsiMeetJS.js`

Laden…
Annuleren
Opslaan