Lyubo Marinov 8 лет назад
Родитель
Сommit
1c5764535a
3 измененных файлов: 62 добавлений и 62 удалений
  1. 1
    0
      .eslintrc.js
  2. 44
    46
      modules/RTC/JitsiLocalTrack.js
  3. 17
    16
      modules/xmpp/SDPUtil.js

+ 1
- 0
.eslintrc.js Просмотреть файл

@@ -151,6 +151,7 @@ module.exports = {
151 151
         'new-parens': 2,
152 152
         'no-array-constructor': 2,
153 153
         'no-inline-comments': 0,
154
+        'no-lonely-if': 2,
154 155
         'no-mixed-operators': 2,
155 156
         'no-mixed-spaces-and-tabs': 2,
156 157
         'no-multiple-empty-lines': 2,

+ 44
- 46
modules/RTC/JitsiLocalTrack.js Просмотреть файл

@@ -296,57 +296,55 @@ JitsiLocalTrack.prototype._setMute = function(mute) {
296 296
         if(this.track) {
297 297
             this.track.enabled = !mute;
298 298
         }
299
-    } else {
300
-        if(mute) {
301
-            this.dontFireRemoveEvent = true;
302
-            promise = new Promise((resolve, reject) => {
303
-                this._removeStreamFromConferenceAsMute(() => {
304
-                    // FIXME: Maybe here we should set the SRC for the containers
305
-                    // to something
306
-                    this._stopMediaStream();
307
-                    this._setStream(null);
308
-                    resolve();
309
-                }, err => {
310
-                    reject(err);
311
-                });
299
+    } else if (mute) {
300
+        this.dontFireRemoveEvent = true;
301
+        promise = new Promise((resolve, reject) => {
302
+            this._removeStreamFromConferenceAsMute(() => {
303
+                // FIXME: Maybe here we should set the SRC for the containers
304
+                // to something
305
+                this._stopMediaStream();
306
+                this._setStream(null);
307
+                resolve();
308
+            }, err => {
309
+                reject(err);
312 310
             });
313
-        } else {
314
-            // This path is only for camera.
315
-            const streamOptions = {
316
-                cameraDeviceId: this.getDeviceId(),
317
-                devices: [ MediaType.VIDEO ],
318
-                facingMode: this.getCameraFacingMode()
319
-            };
320
-            if (this.resolution) {
321
-                streamOptions.resolution = this.resolution;
322
-            }
311
+        });
312
+    } else {
313
+        // This path is only for camera.
314
+        const streamOptions = {
315
+            cameraDeviceId: this.getDeviceId(),
316
+            devices: [ MediaType.VIDEO ],
317
+            facingMode: this.getCameraFacingMode()
318
+        };
319
+        if (this.resolution) {
320
+            streamOptions.resolution = this.resolution;
321
+        }
323 322
 
324
-            promise = RTCUtils.obtainAudioAndVideoPermissions(streamOptions)
325
-                .then(streamsInfo => {
326
-                    const mediaType = self.getType();
327
-                    const streamInfo = streamsInfo.find(info => info.mediaType === mediaType);
328
-
329
-                    if (streamInfo) {
330
-                        self._setStream(streamInfo.stream);
331
-                        self.track = streamInfo.track;
332
-                        // This is not good when video type changes after
333
-                        // unmute, but let's not crash here
334
-                        if (self.videoType !== streamInfo.videoType) {
335
-                            logger.warn(
336
-                                'Video type has changed after unmute!',
337
-                                self.videoType, streamInfo.videoType);
338
-                            self.videoType = streamInfo.videoType;
339
-                        }
340
-                    }else {
341
-                        throw new JitsiTrackError(
342
-                            JitsiTrackErrors.TRACK_NO_STREAM_FOUND);
323
+        promise = RTCUtils.obtainAudioAndVideoPermissions(streamOptions)
324
+            .then(streamsInfo => {
325
+                const mediaType = self.getType();
326
+                const streamInfo = streamsInfo.find(info => info.mediaType === mediaType);
327
+
328
+                if (streamInfo) {
329
+                    self._setStream(streamInfo.stream);
330
+                    self.track = streamInfo.track;
331
+                    // This is not good when video type changes after
332
+                    // unmute, but let's not crash here
333
+                    if (self.videoType !== streamInfo.videoType) {
334
+                        logger.warn(
335
+                            'Video type has changed after unmute!',
336
+                            self.videoType, streamInfo.videoType);
337
+                        self.videoType = streamInfo.videoType;
343 338
                     }
339
+                }else {
340
+                    throw new JitsiTrackError(
341
+                        JitsiTrackErrors.TRACK_NO_STREAM_FOUND);
342
+                }
344 343
 
345
-                    self.containers = self.containers.map(cont => RTCUtils.attachMediaStream(cont, self.stream));
344
+                self.containers = self.containers.map(cont => RTCUtils.attachMediaStream(cont, self.stream));
346 345
 
347
-                    return self._addStreamToConferenceAsUnmute();
348
-                });
349
-        }
346
+                return self._addStreamToConferenceAsUnmute();
347
+            });
350 348
     }
351 349
 
352 350
     return promise

+ 17
- 16
modules/xmpp/SDPUtil.js Просмотреть файл

@@ -382,7 +382,8 @@ const SDPUtil = {
382 382
             .map(ssrcInfo => ssrcInfo.id)
383 383
             .filter((ssrc, index, array) => array.indexOf(ssrc) === index)
384 384
             .length;
385
-        const numGroups = (videoMLine.ssrcGroups && videoMLine.ssrcGroups.length) || 0;
385
+        const numGroups
386
+            = (videoMLine.ssrcGroups && videoMLine.ssrcGroups.length) || 0;
386 387
         if (numSsrcs > 1 && numGroups === 0) {
387 388
             // Ambiguous, can't figure out the primary
388 389
             return;
@@ -390,21 +391,21 @@ const SDPUtil = {
390 391
         let primarySsrc = null;
391 392
         if (numSsrcs === 1) {
392 393
             primarySsrc = videoMLine.ssrcs[0].id;
393
-        } else {
394
-            if (numSsrcs === 2) {
395
-                // Can figure it out if there's an FID group
396
-                const fidGroup = videoMLine.ssrcGroups
397
-                    .find(group => group.semantics === 'FID');
398
-                if (fidGroup) {
399
-                    primarySsrc = fidGroup.ssrcs.split(' ')[0];
400
-                }
401
-            } else if (numSsrcs >= 3) {
402
-                // Can figure it out if there's a sim group
403
-                const simGroup = videoMLine.ssrcGroups
404
-                    .find(group => group.semantics === 'SIM');
405
-                if (simGroup) {
406
-                    primarySsrc = simGroup.ssrcs.split(' ')[0];
407
-                }
394
+        } else if (numSsrcs === 2) {
395
+            // Can figure it out if there's an FID group
396
+            const fidGroup
397
+                = videoMLine.ssrcGroups.find(
398
+                    group => group.semantics === 'FID');
399
+            if (fidGroup) {
400
+                primarySsrc = fidGroup.ssrcs.split(' ')[0];
401
+            }
402
+        } else if (numSsrcs >= 3) {
403
+            // Can figure it out if there's a sim group
404
+            const simGroup
405
+                = videoMLine.ssrcGroups.find(
406
+                    group => group.semantics === 'SIM');
407
+            if (simGroup) {
408
+                primarySsrc = simGroup.ssrcs.split(' ')[0];
408 409
             }
409 410
         }
410 411
         return primarySsrc;

Загрузка…
Отмена
Сохранить