Ver código fonte

Coding style

Random coding style-related issues that bothered me while reading the
source code touched by "Fix local video disappearing from local
thumbnail" (https://github.com/jitsi/lib-jitsi-meet/pull/571). These
include naming, formatting, comments, typos, duplication.
master
Lyubo Marinov 8 anos atrás
pai
commit
b379a94d6c
3 arquivos alterados com 150 adições e 143 exclusões
  1. 107
    103
      modules/RTC/JitsiLocalTrack.js
  2. 28
    20
      modules/RTC/JitsiTrack.js
  3. 15
    20
      modules/RTC/LocalSdpMunger.js

+ 107
- 103
modules/RTC/JitsiLocalTrack.js Ver arquivo

4
 import { getLogger } from 'jitsi-meet-logger';
4
 import { getLogger } from 'jitsi-meet-logger';
5
 import JitsiTrack from './JitsiTrack';
5
 import JitsiTrack from './JitsiTrack';
6
 import JitsiTrackError from '../../JitsiTrackError';
6
 import JitsiTrackError from '../../JitsiTrackError';
7
-import * as JitsiTrackErrors from '../../JitsiTrackErrors';
8
-import * as JitsiTrackEvents from '../../JitsiTrackEvents';
7
+import { TRACK_NO_STREAM_FOUND } from '../../JitsiTrackErrors';
8
+import {
9
+    LOCAL_TRACK_STOPPED,
10
+    NO_DATA_FROM_SOURCE,
11
+    TRACK_MUTE_CHANGED
12
+} from '../../JitsiTrackEvents';
9
 import * as MediaType from '../../service/RTC/MediaType';
13
 import * as MediaType from '../../service/RTC/MediaType';
10
 import RTCBrowserType from './RTCBrowserType';
14
 import RTCBrowserType from './RTCBrowserType';
11
 import RTCEvents from '../../service/RTC/RTCEvents';
15
 import RTCEvents from '../../service/RTC/RTCEvents';
37
      * source. NOTE: defined for desktop sharing tracks only.
41
      * source. NOTE: defined for desktop sharing tracks only.
38
      * @constructor
42
      * @constructor
39
      */
43
      */
40
-    constructor(trackInfo) {
41
-        const {
42
-            rtcId,
43
-            stream,
44
-            track,
45
-            mediaType,
46
-            videoType,
47
-            resolution,
48
-            deviceId,
49
-            facingMode,
50
-            sourceId,
51
-            sourceType
52
-        } = trackInfo;
53
-
44
+    constructor({
45
+        deviceId,
46
+        facingMode,
47
+        mediaType,
48
+        resolution,
49
+        rtcId,
50
+        sourceId,
51
+        sourceType,
52
+        stream,
53
+        track,
54
+        videoType
55
+    }) {
54
         super(
56
         super(
55
-            null /* RTC */,
57
+            /* conference */ null,
56
             stream,
58
             stream,
57
             track,
59
             track,
58
-            () => {
59
-                this.emit(JitsiTrackEvents.LOCAL_TRACK_STOPPED);
60
-            } /* inactiveHandler */,
60
+            /* streamInactiveHandler */ () => this.emit(LOCAL_TRACK_STOPPED),
61
             mediaType,
61
             mediaType,
62
             videoType);
62
             videoType);
63
 
63
 
66
          * @type {number}
66
          * @type {number}
67
          */
67
          */
68
         this.rtcId = rtcId;
68
         this.rtcId = rtcId;
69
-        this.resolution = resolution;
70
         this.sourceId = sourceId;
69
         this.sourceId = sourceId;
71
         this.sourceType = sourceType;
70
         this.sourceType = sourceType;
72
 
71
 
73
-        // FIXME: currently firefox is ignoring our constraints about
72
+        // FIXME Currently, Firefox is ignoring our constraints about
74
         // resolutions so we do not store it, to avoid wrong reporting of local
73
         // resolutions so we do not store it, to avoid wrong reporting of local
75
-        // track resolution
76
-        if (RTCBrowserType.isFirefox()) {
77
-            this.resolution = null;
78
-        }
74
+        // track resolution.
75
+        this.resolution = RTCBrowserType.isFirefox() ? null : resolution;
79
 
76
 
80
         this.deviceId = deviceId;
77
         this.deviceId = deviceId;
81
-        this.storedMSID = this.getMSID();
82
 
78
 
83
         /**
79
         /**
84
          * The <tt>Promise</tt> which represents the progress of a previously
80
          * The <tt>Promise</tt> which represents the progress of a previously
85
-         * queued/scheduled {@link _setMute} (from the point of view of
86
-         * {@link _queueSetMute}).
81
+         * queued/scheduled {@link _setMuted} (from the point of view of
82
+         * {@link _queueSetMuted}).
87
          *
83
          *
88
          * @private
84
          * @private
89
          * @type {Promise}
85
          * @type {Promise}
90
          */
86
          */
91
-        this._prevSetMute = Promise.resolve();
87
+        this._prevSetMuted = Promise.resolve();
92
 
88
 
93
         /**
89
         /**
94
          * The facing mode of the camera from which this JitsiLocalTrack
90
          * The facing mode of the camera from which this JitsiLocalTrack
123
         // soon as it's called.
119
         // soon as it's called.
124
         this._realDeviceId = this.deviceId === '' ? undefined : this.deviceId;
120
         this._realDeviceId = this.deviceId === '' ? undefined : this.deviceId;
125
 
121
 
126
-        /**
127
-         * Set to <tt>true</tt> when there's ongoing "mute/unmute" operation in
128
-         * progress. Used by {@link LocalSdpMunger}.
129
-         * @type {boolean}
130
-         */
131
-        this.inMuteOrUnmuteProgress = true;
132
-
133
-        /**
134
-         * Indicates that we have called RTCUtils.stopMediaStream for the
135
-         * MediaStream related to this JitsiTrack object.
136
-         */
137
-        this.stopStreamInProgress = false;
138
-
139
         /**
122
         /**
140
          * On mute event we are waiting for 3s to check if the stream is going
123
          * On mute event we are waiting for 3s to check if the stream is going
141
          * to be still muted before firing the event for camera issue detected
124
          * to be still muted before firing the event for camera issue detected
234
     }
217
     }
235
 
218
 
236
     /**
219
     /**
237
-     * Fires JitsiTrackEvents.NO_DATA_FROM_SOURCE and logs it to analytics and
238
-     * callstats.
220
+     * Fires NO_DATA_FROM_SOURCE event and logs it to analytics and callstats.
239
      */
221
      */
240
     _fireNoDataFromSourceEvent() {
222
     _fireNoDataFromSourceEvent() {
241
-        this.emit(JitsiTrackEvents.NO_DATA_FROM_SOURCE);
223
+        this.emit(NO_DATA_FROM_SOURCE);
242
         const eventName = `${this.getType()}.no_data_from_source`;
224
         const eventName = `${this.getType()}.no_data_from_source`;
243
 
225
 
244
         Statistics.analytics.sendEvent(eventName);
226
         Statistics.analytics.sendEvent(eventName);
273
     /**
255
     /**
274
      * Sets the stream property of JitsiLocalTrack object and sets all stored
256
      * Sets the stream property of JitsiLocalTrack object and sets all stored
275
      * handlers to it.
257
      * handlers to it.
258
+     *
276
      * @param {MediaStream} stream the new stream.
259
      * @param {MediaStream} stream the new stream.
260
+     * @protected
277
      */
261
      */
278
     _setStream(stream) {
262
     _setStream(stream) {
279
         super._setStream(stream);
263
         super._setStream(stream);
280
 
264
 
281
-        // Store the MSID for video mute/unmute purposes
282
         if (stream) {
265
         if (stream) {
266
+            // Store the MSID for video mute/unmute purposes.
283
             this.storedMSID = this.getMSID();
267
             this.storedMSID = this.getMSID();
284
             logger.debug(`Setting new MSID: ${this.storedMSID} on ${this}`);
268
             logger.debug(`Setting new MSID: ${this.storedMSID} on ${this}`);
285
         } else {
269
         } else {
288
     }
272
     }
289
 
273
 
290
     /**
274
     /**
291
-     * Mutes the track. Will reject the Promise if there is mute/unmute
292
-     * operation in progress.
275
+     * Asynchronously mutes this track.
276
+     *
293
      * @returns {Promise}
277
      * @returns {Promise}
294
      */
278
      */
295
     mute() {
279
     mute() {
296
-        return this._queueSetMute(true);
280
+        return this._queueSetMuted(true);
297
     }
281
     }
298
 
282
 
299
     /**
283
     /**
300
-     * Unmutes the track. Will reject the Promise if there is mute/unmute
301
-     * operation in progress.
284
+     * Asynchronously unmutes this track.
285
+     *
302
      * @returns {Promise}
286
      * @returns {Promise}
303
      */
287
      */
304
     unmute() {
288
     unmute() {
305
-        return this._queueSetMute(false);
289
+        return this._queueSetMuted(false);
306
     }
290
     }
307
 
291
 
308
     /**
292
     /**
309
-     * Initializes a new Promise to execute {@link _setMute}. May be called
310
-     * multiple times in a row and the invocations of {@link _setMute} and,
311
-     * consequently, {@link mute} and/or {@link unmute} will be resolved in a
293
+     * Initializes a new Promise to execute {@link #_setMuted}. May be called
294
+     * multiple times in a row and the invocations of {@link #_setMuted} and,
295
+     * consequently, {@link #mute} and/or {@link #unmute} will be resolved in a
312
      * serialized fashion.
296
      * serialized fashion.
313
      *
297
      *
314
-     * @param {boolean} mute - Whether to mute or unmute this track.
298
+     * @param {boolean} muted - The value to invoke <tt>_setMuted</tt> with.
315
      * @returns {Promise}
299
      * @returns {Promise}
316
      */
300
      */
317
-    _queueSetMute(mute) {
318
-        const setMute = this._setMute.bind(this, mute);
301
+    _queueSetMuted(muted) {
302
+        const setMuted = this._setMuted.bind(this, muted);
319
 
303
 
320
-        this._prevSetMute = this._prevSetMute.then(setMute, setMute);
304
+        this._prevSetMuted = this._prevSetMuted.then(setMuted, setMuted);
321
 
305
 
322
-        return this._prevSetMute;
306
+        return this._prevSetMuted;
323
     }
307
     }
324
 
308
 
325
     /**
309
     /**
326
-     * Mutes / unmutes the track.
310
+     * Mutes / unmutes this track.
327
      *
311
      *
328
-     * @param {boolean} mute - If true the track will be muted. Otherwise the
329
-     * track will be unmuted.
312
+     * @param {boolean} muted - If <tt>true</tt>, this track will be muted;
313
+     * otherwise, this track will be unmuted.
330
      * @private
314
      * @private
331
      * @returns {Promise}
315
      * @returns {Promise}
332
      */
316
      */
333
-    _setMute(mute) {
334
-        if (this.isMuted() === mute) {
317
+    _setMuted(muted) {
318
+        if (this.isMuted() === muted) {
335
             return Promise.resolve();
319
             return Promise.resolve();
336
         }
320
         }
337
 
321
 
338
         let promise = Promise.resolve();
322
         let promise = Promise.resolve();
339
 
323
 
340
-        this.inMuteOrUnmuteProgress = true;
324
+        /**
325
+         * Set to <tt>true</tt> when there's ongoing "mute/unmute" operation in
326
+         * progress. Used by {@link LocalSdpMunger}.
327
+         *
328
+         * @public
329
+         * @type {boolean}
330
+         */
331
+        this.setMutedInProgress = true;
341
 
332
 
342
         // A function that will print info about muted status transition
333
         // A function that will print info about muted status transition
343
-        const logMuteInfo = () => logger.info(`Mute ${this}: ${mute}`);
334
+        const logMuteInfo = () => logger.info(`Mute ${this}: ${muted}`);
344
 
335
 
345
         if (this.isAudioTrack()
336
         if (this.isAudioTrack()
346
-            || this.videoType === VideoType.DESKTOP
347
-            || !RTCBrowserType.doesVideoMuteByStreamRemove()) {
337
+                || this.videoType === VideoType.DESKTOP
338
+                || !RTCBrowserType.doesVideoMuteByStreamRemove()) {
348
             logMuteInfo();
339
             logMuteInfo();
349
             if (this.track) {
340
             if (this.track) {
350
-                this.track.enabled = !mute;
341
+                this.track.enabled = !muted;
351
             }
342
             }
352
-        } else if (mute) {
343
+        } else if (muted) {
353
             promise = new Promise((resolve, reject) => {
344
             promise = new Promise((resolve, reject) => {
354
                 logMuteInfo();
345
                 logMuteInfo();
355
-                this._removeStreamFromConferenceAsMute(() => {
356
-                    // FIXME: Maybe here we should set the SRC for the
357
-                    // containers to something
358
-                    // We don't want any events to be fired on this stream
359
-                    this._unregisterHandlers();
360
-                    this._stopMediaStream();
361
-                    this._setStream(null);
362
-                    resolve();
363
-                }, err => {
364
-                    reject(err);
365
-                });
346
+                this._removeStreamFromConferenceAsMute(
347
+                    () => {
348
+                        // FIXME: Maybe here we should set the SRC for the
349
+                        // containers to something
350
+                        // We don't want any events to be fired on this stream
351
+                        this._unregisterHandlers();
352
+                        this._stopStream();
353
+                        this._setStream(null);
354
+                        resolve();
355
+                    },
356
+                    reject);
366
             });
357
             });
367
         } else {
358
         } else {
368
             logMuteInfo();
359
             logMuteInfo();
397
                             this.videoType = streamInfo.videoType;
388
                             this.videoType = streamInfo.videoType;
398
                         }
389
                         }
399
                     } else {
390
                     } else {
400
-                        throw new JitsiTrackError(
401
-                            JitsiTrackErrors.TRACK_NO_STREAM_FOUND);
391
+                        throw new JitsiTrackError(TRACK_NO_STREAM_FOUND);
402
                     }
392
                     }
403
 
393
 
404
                     this.containers = this.containers.map(
394
                     this.containers = this.containers.map(
409
         }
399
         }
410
 
400
 
411
         return promise
401
         return promise
412
-            .then(() => this._sendMuteStatus(mute))
413
-            .then(() => {
414
-                this.inMuteOrUnmuteProgress = false;
415
-            }, error => {
416
-                this.inMuteOrUnmuteProgress = false;
417
-
418
-                throw error;
419
-            })
420
-            .then(() => {
421
-                this.emit(JitsiTrackEvents.TRACK_MUTE_CHANGED, this);
422
-            });
402
+            .then(() => this._sendMuteStatus(muted))
403
+            .then(
404
+                /* onFulfilled */ () => {
405
+                    this.setMutedInProgress = false;
406
+                },
407
+                /* onRejected */ error => {
408
+                    this.setMutedInProgress = false;
409
+
410
+                    throw error;
411
+                })
412
+            .then(() => this.emit(TRACK_MUTE_CHANGED, this));
423
     }
413
     }
424
 
414
 
425
     /**
415
     /**
503
         }
493
         }
504
 
494
 
505
         if (this.stream) {
495
         if (this.stream) {
506
-            this._stopMediaStream();
496
+            this._stopStream();
507
             this.detach();
497
             this.detach();
508
         }
498
         }
509
 
499
 
648
     /**
638
     /**
649
      * Stops the associated MediaStream.
639
      * Stops the associated MediaStream.
650
      */
640
      */
651
-    _stopMediaStream() {
652
-        this.stopStreamInProgress = true;
653
-        RTCUtils.stopMediaStream(this.stream);
654
-        this.stopStreamInProgress = false;
641
+    _stopStream() {
642
+
643
+        /**
644
+         * Indicates that we are executing {@link #_stopStream} i.e.
645
+         * {@link RTCUtils#stopMediaStream} for the <tt>MediaStream</tt>
646
+         * associated with this <tt>JitsiTrack</tt> instance.
647
+         *
648
+         * @private
649
+         * @type {boolean}
650
+         */
651
+        this._stopStreamInProgress = true;
652
+
653
+        try {
654
+            RTCUtils.stopMediaStream(this.stream);
655
+        } finally {
656
+            this._stopStreamInProgress = false;
657
+        }
655
     }
658
     }
656
 
659
 
657
     /**
660
     /**
685
      * @returns {boolean} true if an issue is detected and false otherwise
688
      * @returns {boolean} true if an issue is detected and false otherwise
686
      */
689
      */
687
     _checkForCameraIssues() {
690
     _checkForCameraIssues() {
688
-        if (!this.isVideoTrack() || this.stopStreamInProgress
689
-            || this.videoType === VideoType.DESKTOP) {
691
+        if (!this.isVideoTrack()
692
+                || this._stopStreamInProgress
693
+                || this.videoType === VideoType.DESKTOP) {
690
             return false;
694
             return false;
691
         }
695
         }
692
 
696
 

+ 28
- 20
modules/RTC/JitsiTrack.js Ver arquivo

62
     /**
62
     /**
63
      * Represents a single media track (either audio or video).
63
      * Represents a single media track (either audio or video).
64
      * @constructor
64
      * @constructor
65
-     * @param rtc the rtc instance
65
+     * @param conference the rtc instance
66
      * @param stream the WebRTC MediaStream instance
66
      * @param stream the WebRTC MediaStream instance
67
      * @param track the WebRTC MediaStreamTrack instance, must be part of
67
      * @param track the WebRTC MediaStreamTrack instance, must be part of
68
      * the given <tt>stream</tt>.
68
      * the given <tt>stream</tt>.
72
      * @param videoType the VideoType for this track if any
72
      * @param videoType the VideoType for this track if any
73
      */
73
      */
74
     constructor(
74
     constructor(
75
-        conference,
76
-        stream,
77
-        track,
78
-        streamInactiveHandler,
79
-        trackMediaType,
80
-        videoType) {
75
+            conference,
76
+            stream,
77
+            track,
78
+            streamInactiveHandler,
79
+            trackMediaType,
80
+            videoType) {
81
         super();
81
         super();
82
 
82
 
83
         // aliases for addListener/removeListener
83
         // aliases for addListener/removeListener
90
          */
90
          */
91
         this.containers = [];
91
         this.containers = [];
92
         this.conference = conference;
92
         this.conference = conference;
93
-        this.stream = stream;
94
         this.audioLevel = -1;
93
         this.audioLevel = -1;
95
         this.type = trackMediaType;
94
         this.type = trackMediaType;
96
         this.track = track;
95
         this.track = track;
108
 
107
 
109
         /**
108
         /**
110
          * The inactive handler which will be triggered when the underlying
109
          * The inactive handler which will be triggered when the underlying
111
-         * media stream ends.
110
+         * <tt>MediaStream</tt> ends.
111
+         *
112
+         * @private
112
          * @type {Function}
113
          * @type {Function}
113
          */
114
          */
114
         this._streamInactiveHandler = streamInactiveHandler;
115
         this._streamInactiveHandler = streamInactiveHandler;
115
-        this._bindInactiveHandler(streamInactiveHandler);
116
+
117
+        this._setStream(stream);
116
     }
118
     }
117
 
119
 
118
     /* eslint-enable max-params */
120
     /* eslint-enable max-params */
148
         }
150
         }
149
 
151
 
150
         if (this.stream) {
152
         if (this.stream) {
151
-            // FIXME why only video tacks ?
153
+            // FIXME Why only video tracks?
152
             for (const track of this.stream.getVideoTracks()) {
154
             for (const track of this.stream.getVideoTracks()) {
153
                 track[trackHandler2Prop[type]] = handler;
155
                 track[trackHandler2Prop[type]] = handler;
154
             }
156
             }
168
         }
170
         }
169
 
171
 
170
         for (const type of this.handlers.keys()) {
172
         for (const type of this.handlers.keys()) {
171
-            // FIXME why only video tracks ?
173
+            // FIXME Why only video tracks?
172
             for (const videoTrack of this.stream.getVideoTracks()) {
174
             for (const videoTrack of this.stream.getVideoTracks()) {
173
                 videoTrack[trackHandler2Prop[type]] = undefined;
175
                 videoTrack[trackHandler2Prop[type]] = undefined;
174
             }
176
             }
181
     /**
183
     /**
182
      * Sets the stream property of JitsiTrack object and sets all stored
184
      * Sets the stream property of JitsiTrack object and sets all stored
183
      * handlers to it.
185
      * handlers to it.
186
+     *
184
      * @param {MediaStream} stream the new stream.
187
      * @param {MediaStream} stream the new stream.
188
+     * @protected
185
      */
189
      */
186
     _setStream(stream) {
190
     _setStream(stream) {
187
         if (this.stream === stream) {
191
         if (this.stream === stream) {
188
-            logger.warn(`Attempt to set the same stream twice on ${this}`);
189
-
190
             return;
192
             return;
191
         }
193
         }
192
 
194
 
193
         this.stream = stream;
195
         this.stream = stream;
194
-        for (const type of this.handlers.keys()) {
195
-            this._setHandler(type, this.handlers.get(type));
196
-        }
197
-        if (this._streamInactiveHandler && this.stream) {
198
-            this._bindInactiveHandler(this._streamInactiveHandler);
196
+
197
+        // TODO Practically, that's like the opposite of _unregisterHandlers
198
+        // i.e. may be abstracted into a function/method called
199
+        // _registerHandlers for clarity and easing the maintenance of the two
200
+        // pieces of source code.
201
+        if (this.stream) {
202
+            for (const type of this.handlers.keys()) {
203
+                this._setHandler(type, this.handlers.get(type));
204
+            }
205
+            if (this._streamInactiveHandler) {
206
+                this._bindInactiveHandler(this._streamInactiveHandler);
207
+            }
199
         }
208
         }
200
     }
209
     }
201
 
210
 
437
         const streamId = this.getStreamId();
446
         const streamId = this.getStreamId();
438
         const trackId = this.getTrackId();
447
         const trackId = this.getTrackId();
439
 
448
 
440
-
441
         return streamId && trackId ? `${streamId} ${trackId}` : null;
449
         return streamId && trackId ? `${streamId} ${trackId}` : null;
442
     }
450
     }
443
 
451
 

+ 15
- 20
modules/RTC/LocalSdpMunger.js Ver arquivo

65
         let modified = false;
65
         let modified = false;
66
 
66
 
67
         for (const videoTrack of localVideos) {
67
         for (const videoTrack of localVideos) {
68
-            const isMuted = videoTrack.isMuted();
69
-            const muteInProgress = videoTrack.inMuteOrUnmuteProgress;
70
-            const shouldFakeSdp = isMuted || muteInProgress;
68
+            const muted = videoTrack.isMuted();
69
+            const { setMutedInProgress } = videoTrack;
70
+            const shouldFakeSdp = muted || setMutedInProgress;
71
 
71
 
72
             logger.debug(
72
             logger.debug(
73
-                `${this.tpc} ${videoTrack
74
-                 } isMuted: ${isMuted
75
-                 }, is mute in progress: ${muteInProgress
76
-                 } => should fake sdp ? : ${shouldFakeSdp}`);
73
+                `${this.tpc} ${videoTrack} muted: ${muted
74
+                    }, is mute/unmute in progress: ${setMutedInProgress
75
+                    } => should fake sdp ? : ${shouldFakeSdp}`);
77
 
76
 
78
             if (!shouldFakeSdp) {
77
             if (!shouldFakeSdp) {
79
-                // eslint-disable-next-line no-continue
80
-                continue;
78
+                continue; // eslint-disable-line no-continue
81
             }
79
             }
82
 
80
 
83
             // Inject removed SSRCs
81
             // Inject removed SSRCs
90
                 logger.error(
88
                 logger.error(
91
                     `No SSRCs stored for: ${videoTrack} in ${this.tpc}`);
89
                     `No SSRCs stored for: ${videoTrack} in ${this.tpc}`);
92
 
90
 
93
-                // eslint-disable-next-line no-continue
94
-                continue;
91
+                continue; // eslint-disable-line no-continue
95
             }
92
             }
96
 
93
 
97
             modified = true;
94
             modified = true;
99
             // We need to fake sendrecv.
96
             // We need to fake sendrecv.
100
             // NOTE the SDP produced here goes only to Jicofo and is never set
97
             // NOTE the SDP produced here goes only to Jicofo and is never set
101
             // as localDescription. That's why
98
             // as localDescription. That's why
102
-            // {@link TraceablePeerConnection.mediaTransferActive} is ignored
103
-            // here.
99
+            // TraceablePeerConnection.mediaTransferActive is ignored here.
104
             videoMLine.direction = 'sendrecv';
100
             videoMLine.direction = 'sendrecv';
105
 
101
 
106
             // Check if the recvonly has MSID
102
             // Check if the recvonly has MSID
107
             const primarySSRC = requiredSSRCs[0];
103
             const primarySSRC = requiredSSRCs[0];
108
 
104
 
109
-            // FIXME the cname could come from the stream, but may
110
-            // turn out to be too complex. It is fine to come up
111
-            // with any value, as long as we only care about
112
-            // the actual SSRC values when deciding whether or not
113
-            // an update should be sent
105
+            // FIXME The cname could come from the stream, but may turn out to
106
+            // be too complex. It is fine to come up with any value, as long as
107
+            // we only care about the actual SSRC values when deciding whether
108
+            // or not an update should be sent.
114
             const primaryCname = `injected-${primarySSRC}`;
109
             const primaryCname = `injected-${primarySSRC}`;
115
 
110
 
116
             for (const ssrcNum of requiredSSRCs) {
111
             for (const ssrcNum of requiredSSRCs) {
119
 
114
 
120
                 // Inject
115
                 // Inject
121
                 logger.debug(
116
                 logger.debug(
122
-                    `${this.tpc} injecting video SSRC: `
123
-                        + `${ssrcNum} for ${videoTrack}`);
117
+                    `${this.tpc} injecting video SSRC: ${ssrcNum} for ${
118
+                        videoTrack}`);
124
                 videoMLine.addSSRCAttribute({
119
                 videoMLine.addSSRCAttribute({
125
                     id: ssrcNum,
120
                     id: ssrcNum,
126
                     attribute: 'cname',
121
                     attribute: 'cname',

Carregando…
Cancelar
Salvar