Browse Source

[eslint] prefer-const

tags/v0.0.2
Lyubo Marinov 8 years ago
parent
commit
1ff84b6781

+ 1
- 0
.eslintrc.js View File

52
             { 'nestedBinaryExpressions': false }
52
             { 'nestedBinaryExpressions': false }
53
         ],
53
         ],
54
 
54
 
55
+        'prefer-const': 2,
55
         'prefer-reflect': 0,
56
         'prefer-reflect': 0,
56
         'prefer-spread': 2,
57
         'prefer-spread': 2,
57
         'require-yield': 2,
58
         'require-yield': 2,

+ 1
- 1
JitsiConference.js View File

180
 
180
 
181
     // leave the conference
181
     // leave the conference
182
     if (this.room) {
182
     if (this.room) {
183
-        let room = this.room;
183
+        const room = this.room;
184
         this.room = null;
184
         this.room = null;
185
         return room.leave().catch(() => {
185
         return room.leave().catch(() => {
186
             // remove all participants because currently the conference won't
186
             // remove all participants because currently the conference won't

+ 1
- 1
JitsiMeetJS.js View File

36
     var order = Resolutions[resolution].order;
36
     var order = Resolutions[resolution].order;
37
     var res = null;
37
     var res = null;
38
     var resName = null;
38
     var resName = null;
39
-    for(let i in Resolutions) {
39
+    for(const i in Resolutions) {
40
         var tmp = Resolutions[i];
40
         var tmp = Resolutions[i];
41
         if (!res || (res.order < tmp.order && tmp.order < order)) {
41
         if (!res || (res.order < tmp.order && tmp.order < order)) {
42
             resName = i;
42
             resName = i;

+ 5
- 5
modules/RTC/JitsiLocalTrack.js View File

144
  */
144
  */
145
 JitsiLocalTrack.prototype._initNoDataFromSourceHandlers = function () {
145
 JitsiLocalTrack.prototype._initNoDataFromSourceHandlers = function () {
146
     if(this.isVideoTrack() && this.videoType === VideoType.CAMERA) {
146
     if(this.isVideoTrack() && this.videoType === VideoType.CAMERA) {
147
-        let _onNoDataFromSourceError
147
+        const _onNoDataFromSourceError
148
             = this._onNoDataFromSourceError.bind(this);
148
             = this._onNoDataFromSourceError.bind(this);
149
         this._setHandler("track_mute", () => {
149
         this._setHandler("track_mute", () => {
150
             if(this._checkForCameraIssues()) {
150
             if(this._checkForCameraIssues()) {
151
-                let now = window.performance.now();
151
+                const now = window.performance.now();
152
                 this._noDataFromSourceTimeout
152
                 this._noDataFromSourceTimeout
153
                     = setTimeout(_onNoDataFromSourceError, 3000);
153
                     = setTimeout(_onNoDataFromSourceError, 3000);
154
                 this._setHandler("track_unmute", () => {
154
                 this._setHandler("track_unmute", () => {
192
  */
192
  */
193
 JitsiLocalTrack.prototype._fireNoDataFromSourceEvent = function () {
193
 JitsiLocalTrack.prototype._fireNoDataFromSourceEvent = function () {
194
     this.eventEmitter.emit(JitsiTrackEvents.NO_DATA_FROM_SOURCE);
194
     this.eventEmitter.emit(JitsiTrackEvents.NO_DATA_FROM_SOURCE);
195
-    let eventName = this.getType() + ".no_data_from_source";
195
+    const eventName = this.getType() + ".no_data_from_source";
196
     Statistics.analytics.sendEvent(eventName);
196
     Statistics.analytics.sendEvent(eventName);
197
-    let log = {name: eventName};
197
+    const log = {name: eventName};
198
     if (this.isAudioTrack()) {
198
     if (this.isAudioTrack()) {
199
         log.isReceivingData = this._isReceivingData();
199
         log.isReceivingData = this._isReceivingData();
200
     }
200
     }
552
     // FIXME it's a shame that PeerConnection and ICE status does not belong
552
     // FIXME it's a shame that PeerConnection and ICE status does not belong
553
     // to the RTC module and it has to be accessed through
553
     // to the RTC module and it has to be accessed through
554
     // the conference(and through the XMPP chat room ???) instead
554
     // the conference(and through the XMPP chat room ???) instead
555
-    let iceConnectionState
555
+    const iceConnectionState
556
         = this.conference ? this.conference.getConnectionState() : null;
556
         = this.conference ? this.conference.getConnectionState() : null;
557
     if(this._testByteSent && "connected" === iceConnectionState) {
557
     if(this._testByteSent && "connected" === iceConnectionState) {
558
         setTimeout(function () {
558
         setTimeout(function () {

+ 1
- 1
modules/RTC/ScreenObtainer.js View File

474
     }
474
     }
475
     return new Promise((resolve, reject) => {
475
     return new Promise((resolve, reject) => {
476
         let currentRetries = retries;
476
         let currentRetries = retries;
477
-        let interval = window.setInterval(() => {
477
+        const interval = window.setInterval(() => {
478
             checkChromeExtInstalled( (installed) => {
478
             checkChromeExtInstalled( (installed) => {
479
                 if(installed) {
479
                 if(installed) {
480
                     window.clearInterval(interval);
480
                     window.clearInterval(interval);

+ 3
- 3
modules/RTC/TraceablePeerConnection.js View File

298
 
298
 
299
     // FIXME the length of ssrcLines[0] not verified, but it will fail
299
     // FIXME the length of ssrcLines[0] not verified, but it will fail
300
     // with global error handler anyway
300
     // with global error handler anyway
301
-    let trackSsrc = ssrcLines[0].substring(7).split(' ')[0];
301
+    const trackSsrc = ssrcLines[0].substring(7).split(' ')[0];
302
     const ownerEndpointId = this.signalingLayer.getSSRCOwner(trackSsrc);
302
     const ownerEndpointId = this.signalingLayer.getSSRCOwner(trackSsrc);
303
 
303
 
304
     if (!ownerEndpointId) {
304
     if (!ownerEndpointId) {
860
 
860
 
861
                 // Fix the setup attribute (see _fixAnswerRFC4145Setup for
861
                 // Fix the setup attribute (see _fixAnswerRFC4145Setup for
862
                 //  details)
862
                 //  details)
863
-                let remoteDescription = new SDP(this.remoteDescription.sdp);
864
-                let localDescription = new SDP(answer.sdp);
863
+                const remoteDescription = new SDP(this.remoteDescription.sdp);
864
+                const localDescription = new SDP(answer.sdp);
865
                 _fixAnswerRFC4145Setup(remoteDescription, localDescription);
865
                 _fixAnswerRFC4145Setup(remoteDescription, localDescription);
866
                 answer.sdp = localDescription.raw;
866
                 answer.sdp = localDescription.raw;
867
 
867
 

+ 14
- 13
modules/connectivity/ConnectionQuality.js View File

70
     } else {
70
     } else {
71
         // See GetMaxDefaultVideoBitrateKbps in
71
         // See GetMaxDefaultVideoBitrateKbps in
72
         // media/engine/webrtcvideoengine2.cc from webrtc.org
72
         // media/engine/webrtcvideoengine2.cc from webrtc.org
73
-        let pixels = resolution.width * resolution.height;
73
+        const pixels = resolution.width * resolution.height;
74
         if (pixels <= 320 * 240) {
74
         if (pixels <= 320 * 240) {
75
             target = 600;
75
             target = 600;
76
         } else if (pixels <= 640 * 480) {
76
         } else if (pixels <= 640 * 480) {
248
 
248
 
249
         // resolutionName is an index into Resolutions (where "720" is
249
         // resolutionName is an index into Resolutions (where "720" is
250
         // "1280x720" and "960" is "960x720" ...).
250
         // "1280x720" and "960" is "960x720" ...).
251
-        let resolution = Resolutions[resolutionName];
251
+        const resolution = Resolutions[resolutionName];
252
 
252
 
253
         let quality = 100;
253
         let quality = 100;
254
         let packetLoss;
254
         let packetLoss;
301
             // Calculate a value based on the sending bitrate.
301
             // Calculate a value based on the sending bitrate.
302
 
302
 
303
             // time since sending of video was enabled.
303
             // time since sending of video was enabled.
304
-            let millisSinceStart = window.performance.now()
304
+            const millisSinceStart = window.performance.now()
305
                     - Math.max(this._timeVideoUnmuted, this._timeIceConnected);
305
                     - Math.max(this._timeVideoUnmuted, this._timeIceConnected);
306
 
306
 
307
             // expected sending bitrate in perfect conditions
307
             // expected sending bitrate in perfect conditions
320
         // Make sure that the quality doesn't climb quickly
320
         // Make sure that the quality doesn't climb quickly
321
         if (this._lastConnectionQualityUpdate > 0)
321
         if (this._lastConnectionQualityUpdate > 0)
322
         {
322
         {
323
-            let maxIncreasePerSecond = 2;
324
-            let prevConnectionQuality = this._localStats.connectionQuality;
325
-            let diffSeconds
323
+            const maxIncreasePerSecond = 2;
324
+            const prevConnectionQuality = this._localStats.connectionQuality;
325
+            const diffSeconds
326
                 = (window.performance.now()
326
                 = (window.performance.now()
327
                     - this._lastConnectionQualityUpdate) / 1000;
327
                     - this._lastConnectionQualityUpdate) / 1000;
328
             quality = Math.min(
328
             quality = Math.min(
348
      */
348
      */
349
     _broadcastLocalStats() {
349
     _broadcastLocalStats() {
350
         // Send only the data that remote participants care about.
350
         // Send only the data that remote participants care about.
351
-        let data = {
351
+        const data = {
352
             bitrate: this._localStats.bitrate,
352
             bitrate: this._localStats.bitrate,
353
             packetLoss: this._localStats.packetLoss,
353
             packetLoss: this._localStats.packetLoss,
354
             connectionQuality: this._localStats.connectionQuality
354
             connectionQuality: this._localStats.connectionQuality
357
         // TODO: It looks like the remote participants don't really "care"
357
         // TODO: It looks like the remote participants don't really "care"
358
         // about the resolution, and they look at their local rendered
358
         // about the resolution, and they look at their local rendered
359
         // resolution instead. Consider removing this.
359
         // resolution instead. Consider removing this.
360
-        let localVideoTrack
360
+        const localVideoTrack
361
             = this._conference.getLocalVideoTrack();
361
             = this._conference.getLocalVideoTrack();
362
         if (localVideoTrack && localVideoTrack.resolution) {
362
         if (localVideoTrack && localVideoTrack.resolution) {
363
             data.resolution = localVideoTrack.resolution;
363
             data.resolution = localVideoTrack.resolution;
386
      */
386
      */
387
     _updateLocalStats(data) {
387
     _updateLocalStats(data) {
388
         let key;
388
         let key;
389
-        let updateLocalConnectionQuality
389
+        const updateLocalConnectionQuality
390
             = !this._conference.isConnectionInterrupted();
390
             = !this._conference.isConnectionInterrupted();
391
-        let localVideoTrack
391
+        const localVideoTrack
392
             = this._conference.getLocalVideoTrack();
392
             = this._conference.getLocalVideoTrack();
393
-        let videoType = localVideoTrack ? localVideoTrack.videoType : undefined;
394
-        let isMuted = localVideoTrack ? localVideoTrack.isMuted() : true;
395
-        let resolution = localVideoTrack ? localVideoTrack.resolution : null;
393
+        const videoType
394
+            = localVideoTrack ? localVideoTrack.videoType : undefined;
395
+        const isMuted = localVideoTrack ? localVideoTrack.isMuted() : true;
396
+        const resolution = localVideoTrack ? localVideoTrack.resolution : null;
396
 
397
 
397
         if (!isMuted) {
398
         if (!isMuted) {
398
             this._maybeUpdateUnmuteTime();
399
             this._maybeUpdateUnmuteTime();

+ 1
- 1
modules/connectivity/ParticipantConnectionStatus.js View File

344
             isConnActiveByJvb = true;
344
             isConnActiveByJvb = true;
345
         }
345
         }
346
 
346
 
347
-        let isConnectionActive
347
+        const isConnectionActive
348
             = isConnActiveByJvb && (isVideoMuted || !isVideoTrackFrozen);
348
             = isConnActiveByJvb && (isVideoMuted || !isVideoTrackFrozen);
349
 
349
 
350
         logger.debug(
350
         logger.debug(

+ 5
- 5
modules/settings/Settings.js View File

10
  * @returns {Storage} the local Storage object (if any)
10
  * @returns {Storage} the local Storage object (if any)
11
  */
11
  */
12
 function getLocalStorage() {
12
 function getLocalStorage() {
13
-    let global = typeof window == 'undefined' ? this : window;
13
+    const global = typeof window == 'undefined' ? this : window;
14
     return global.localStorage;
14
     return global.localStorage;
15
 }
15
 }
16
 
16
 
27
  * @returns {string} random unique id
27
  * @returns {string} random unique id
28
  */
28
  */
29
 function generateJitsiMeetId() {
29
 function generateJitsiMeetId() {
30
-    let jitsiMeetId = generateUniqueId();
30
+    const jitsiMeetId = generateUniqueId();
31
     logger.log("generated id", jitsiMeetId);
31
     logger.log("generated id", jitsiMeetId);
32
 
32
 
33
     return jitsiMeetId;
33
     return jitsiMeetId;
38
  * @returns {string} fake random username
38
  * @returns {string} fake random username
39
  */
39
  */
40
 function generateCallStatsUsername() {
40
 function generateCallStatsUsername() {
41
-    let username = UsernameGenerator.generateUsername();
41
+    const username = UsernameGenerator.generateUsername();
42
     logger.log('generated callstats uid', username);
42
     logger.log('generated callstats uid', username);
43
 
43
 
44
     return username;
44
     return username;
97
      * @param {string} sessionId session id
97
      * @param {string} sessionId session id
98
      */
98
      */
99
     setSessionId (sessionId) {
99
     setSessionId (sessionId) {
100
-        let localStorage = getLocalStorage();
100
+        const localStorage = getLocalStorage();
101
         if (localStorage) {
101
         if (localStorage) {
102
             if (sessionId) {
102
             if (sessionId) {
103
                 localStorage.setItem('sessionId', sessionId);
103
                 localStorage.setItem('sessionId', sessionId);
121
     getSessionId () {
121
     getSessionId () {
122
         // We may update sessionId in localStorage from another JitsiConference
122
         // We may update sessionId in localStorage from another JitsiConference
123
         // instance and that's why we should always re-read it.
123
         // instance and that's why we should always re-read it.
124
-        let localStorage = getLocalStorage();
124
+        const localStorage = getLocalStorage();
125
         return localStorage ? localStorage.getItem('sessionId') : undefined;
125
         return localStorage ? localStorage.getItem('sessionId') : undefined;
126
     }
126
     }
127
 }
127
 }

+ 3
- 3
modules/statistics/AnalyticsAdapter.js View File

34
      * @returns {Array} with the cached events.
34
      * @returns {Array} with the cached events.
35
      */
35
      */
36
     drainCachedEvents() {
36
     drainCachedEvents() {
37
-        let eventCacheCopy = this.eventCache.slice();
37
+        const eventCacheCopy = this.eventCache.slice();
38
         this.eventCache = [];
38
         this.eventCache = [];
39
         return eventCacheCopy;
39
         return eventCacheCopy;
40
     }
40
     }
41
 
41
 
42
 }
42
 }
43
 
43
 
44
-let cacheAnalytics = new CacheAnalytics();
44
+const cacheAnalytics = new CacheAnalytics();
45
 
45
 
46
 /**
46
 /**
47
  * This class will store and manage the handlers that are going to be used.
47
  * This class will store and manage the handlers that are going to be used.
72
      * @param {Object} data can be any JSON object
72
      * @param {Object} data can be any JSON object
73
      */
73
      */
74
     sendEvent(action, data = {}) {
74
     sendEvent(action, data = {}) {
75
-        let modifiedData = Object.assign(
75
+        const modifiedData = Object.assign(
76
             {browserName: this.browserName}, this.permanentProperties, data);
76
             {browserName: this.browserName}, this.permanentProperties, data);
77
         this.analyticsHandlers.forEach(
77
         this.analyticsHandlers.forEach(
78
             analytics => analytics.sendEvent(action, modifiedData));
78
             analytics => analytics.sendEvent(action, modifiedData));

+ 2
- 2
modules/xmpp/Caps.js View File

47
             room => this._addChatRoom(room));
47
             room => this._addChatRoom(room));
48
         emuc.addListener(XMPPEvents.EMUC_ROOM_REMOVED,
48
         emuc.addListener(XMPPEvents.EMUC_ROOM_REMOVED,
49
             room => this._removeChatRoom(room));
49
             room => this._removeChatRoom(room));
50
-        for(let jid in emuc.rooms) {
50
+        for(const jid in emuc.rooms) {
51
             this._addChatRoom(this.emuc.rooms[jid]);
51
             this._addChatRoom(this.emuc.rooms[jid]);
52
         }
52
         }
53
 
53
 
102
      * @returns {Promise<Set<String>, Error>}
102
      * @returns {Promise<Set<String>, Error>}
103
      */
103
      */
104
     getFeatures(jid, timeout = 5000) {
104
     getFeatures(jid, timeout = 5000) {
105
-        let user
105
+        const user
106
             = jid in this.jidToVersion ? this.jidToVersion[jid] : null;
106
             = jid in this.jidToVersion ? this.jidToVersion[jid] : null;
107
         if(!user || !(user.version in this.versionToCapabilities))
107
         if(!user || !(user.version in this.versionToCapabilities))
108
         {
108
         {

+ 3
- 3
modules/xmpp/ChatRoom.js View File

761
             mutedNode = filterNodeFromPresenceJSON(pres, "audiomuted");
761
             mutedNode = filterNodeFromPresenceJSON(pres, "audiomuted");
762
         } else if (mediaType === MediaType.VIDEO) {
762
         } else if (mediaType === MediaType.VIDEO) {
763
             mutedNode = filterNodeFromPresenceJSON(pres, "videomuted");
763
             mutedNode = filterNodeFromPresenceJSON(pres, "videomuted");
764
-            let videoTypeNode = filterNodeFromPresenceJSON(pres, "videoType");
764
+            const videoTypeNode = filterNodeFromPresenceJSON(pres, "videoType");
765
 
765
 
766
             if(videoTypeNode.length > 0) {
766
             if(videoTypeNode.length > 0) {
767
                 data.videoType = videoTypeNode[0]["value"];
767
                 data.videoType = videoTypeNode[0]["value"];
901
      */
901
      */
902
     leave () {
902
     leave () {
903
         return new Promise((resolve, reject) => {
903
         return new Promise((resolve, reject) => {
904
-            let timeout = setTimeout(() => onMucLeft(true), 5000);
905
-            let eventEmitter = this.eventEmitter;
904
+            const timeout = setTimeout(() => onMucLeft(true), 5000);
905
+            const eventEmitter = this.eventEmitter;
906
             function onMucLeft(doReject = false) {
906
             function onMucLeft(doReject = false) {
907
                 eventEmitter.removeListener(XMPPEvents.MUC_LEFT, onMucLeft);
907
                 eventEmitter.removeListener(XMPPEvents.MUC_LEFT, onMucLeft);
908
                 clearTimeout(timeout);
908
                 clearTimeout(timeout);

+ 2
- 2
modules/xmpp/JingleSessionPC.js View File

628
      *  be added to the remote SDP
628
      *  be added to the remote SDP
629
      */
629
      */
630
     _parseSsrcInfoFromSourceAdd(sourceAddElem, currentRemoteSdp) {
630
     _parseSsrcInfoFromSourceAdd(sourceAddElem, currentRemoteSdp) {
631
-        let addSsrcInfo = [];
631
+        const addSsrcInfo = [];
632
         $(sourceAddElem).each(function (idx, content) {
632
         $(sourceAddElem).each(function (idx, content) {
633
             const name = $(content).attr('name');
633
             const name = $(content).attr('name');
634
             let lines = '';
634
             let lines = '';
881
                     logger.debug("Renegotiate: creating answer");
881
                     logger.debug("Renegotiate: creating answer");
882
                     this.peerconnection.createAnswer(
882
                     this.peerconnection.createAnswer(
883
                         (answer) => {
883
                         (answer) => {
884
-                            let localUfrag = JingleSessionPC.getUfrag(answer.sdp);
884
+                            const localUfrag = JingleSessionPC.getUfrag(answer.sdp);
885
                             if (localUfrag != this.localUfrag) {
885
                             if (localUfrag != this.localUfrag) {
886
                                 this.localUfrag = localUfrag;
886
                                 this.localUfrag = localUfrag;
887
                                 this.room.eventEmitter.emit(
887
                                 this.room.eventEmitter.emit(

+ 3
- 3
modules/xmpp/RtxModifier.js View File

130
         logger.debug("Parsed primary video ssrcs ", primaryVideoSsrcs,
130
         logger.debug("Parsed primary video ssrcs ", primaryVideoSsrcs,
131
             " making sure all have rtx streams");
131
             " making sure all have rtx streams");
132
         for (const ssrc of primaryVideoSsrcs) {
132
         for (const ssrc of primaryVideoSsrcs) {
133
-            let msid = videoMLine.getSSRCAttrValue(ssrc, "msid");
134
-            let cname = videoMLine.getSSRCAttrValue(ssrc, "cname");
133
+            const msid = videoMLine.getSSRCAttrValue(ssrc, "msid");
134
+            const cname = videoMLine.getSSRCAttrValue(ssrc, "cname");
135
             let correspondingRtxSsrc = this.correspondingRtxSsrcs.get(ssrc);
135
             let correspondingRtxSsrc = this.correspondingRtxSsrcs.get(ssrc);
136
             if (correspondingRtxSsrc) {
136
             if (correspondingRtxSsrc) {
137
                 logger.debug(
137
                 logger.debug(
142
                     `No previously associated rtx ssrc for video ssrc ${ssrc}`);
142
                     `No previously associated rtx ssrc for video ssrc ${ssrc}`);
143
                 // If there's one in the sdp already for it, we'll just set
143
                 // If there's one in the sdp already for it, we'll just set
144
                 //  that as the corresponding one
144
                 //  that as the corresponding one
145
-                let previousAssociatedRtxStream = videoMLine.getRtxSSRC(ssrc);
145
+                const previousAssociatedRtxStream = videoMLine.getRtxSSRC(ssrc);
146
                 if (previousAssociatedRtxStream) {
146
                 if (previousAssociatedRtxStream) {
147
                     logger.debug(
147
                     logger.debug(
148
                         `Rtx stream ${previousAssociatedRtxStream} ` +
148
                         `Rtx stream ${previousAssociatedRtxStream} ` +

+ 57
- 57
modules/xmpp/RtxModifier.spec.js View File

11
  * @returns {number} the number of video ssrcs in the given sdp
11
  * @returns {number} the number of video ssrcs in the given sdp
12
  */
12
  */
13
 function numVideoSsrcs (parsedSdp) {
13
 function numVideoSsrcs (parsedSdp) {
14
-  let videoMLine = parsedSdp.media.find(m => m.type === "video");
14
+  const videoMLine = parsedSdp.media.find(m => m.type === "video");
15
   return videoMLine.ssrcs
15
   return videoMLine.ssrcs
16
     .map(ssrcInfo => ssrcInfo.id)
16
     .map(ssrcInfo => ssrcInfo.id)
17
     .filter((ssrc, index, array) => array.indexOf(ssrc) === index)
17
     .filter((ssrc, index, array) => array.indexOf(ssrc) === index)
24
  * @returns {number} the primary video ssrc in the given sdp
24
  * @returns {number} the primary video ssrc in the given sdp
25
  */
25
  */
26
 function getPrimaryVideoSsrc (parsedSdp) {
26
 function getPrimaryVideoSsrc (parsedSdp) {
27
-  let videoMLine = parsedSdp.media.find(m => m.type === "video");
27
+  const videoMLine = parsedSdp.media.find(m => m.type === "video");
28
   return parseInt(SDPUtil.parsePrimaryVideoSsrc(videoMLine));
28
   return parseInt(SDPUtil.parsePrimaryVideoSsrc(videoMLine));
29
 }
29
 }
30
 
30
 
37
  * @returns {list<number>} the primary video ssrcs in the given sdp
37
  * @returns {list<number>} the primary video ssrcs in the given sdp
38
  */
38
  */
39
 function getPrimaryVideoSsrcs (parsedSdp) {
39
 function getPrimaryVideoSsrcs (parsedSdp) {
40
-  let videoMLine = parsedSdp.media.find(m => m.type === "video");
40
+  const videoMLine = parsedSdp.media.find(m => m.type === "video");
41
   if (numVideoSsrcs(parsedSdp) === 1) {
41
   if (numVideoSsrcs(parsedSdp) === 1) {
42
     return [videoMLine.ssrcs[0].id];
42
     return [videoMLine.ssrcs[0].id];
43
   } else {
43
   } else {
44
-    let simGroups = getVideoGroups(parsedSdp, "SIM");
44
+    const simGroups = getVideoGroups(parsedSdp, "SIM");
45
     if (simGroups.length > 1) {
45
     if (simGroups.length > 1) {
46
       return;
46
       return;
47
     }
47
     }
48
-    let simGroup = simGroups[0];
48
+    const simGroup = simGroups[0];
49
     return SDPUtil.parseGroupSsrcs(simGroup);
49
     return SDPUtil.parseGroupSsrcs(simGroup);
50
   }
50
   }
51
 }
51
 }
60
  *  that matched the passed semantics
60
  *  that matched the passed semantics
61
  */
61
  */
62
 function getVideoGroups (parsedSdp, groupSemantics) {
62
 function getVideoGroups (parsedSdp, groupSemantics) {
63
-  let videoMLine = parsedSdp.media.find(m => m.type === "video");
63
+  const videoMLine = parsedSdp.media.find(m => m.type === "video");
64
   videoMLine.ssrcGroups = videoMLine.ssrcGroups || [];
64
   videoMLine.ssrcGroups = videoMLine.ssrcGroups || [];
65
   return videoMLine.ssrcGroups
65
   return videoMLine.ssrcGroups
66
     .filter(g => g.semantics === groupSemantics);
66
     .filter(g => g.semantics === groupSemantics);
82
         it ("should add a single rtx ssrc", function() {
82
         it ("should add a single rtx ssrc", function() {
83
           // Call rtxModifier.modifyRtxSsrcs with an sdp that contains a single video
83
           // Call rtxModifier.modifyRtxSsrcs with an sdp that contains a single video
84
           //  ssrc.  The returned sdp should have an rtx ssrc and an fid group.
84
           //  ssrc.  The returned sdp should have an rtx ssrc and an fid group.
85
-          let newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.singleVideoSdp));
86
-          let newSdp = transform.parse(newSdpStr);
87
-          let newPrimaryVideoSsrc = getPrimaryVideoSsrc(newSdp);
85
+          const newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.singleVideoSdp));
86
+          const newSdp = transform.parse(newSdpStr);
87
+          const newPrimaryVideoSsrc = getPrimaryVideoSsrc(newSdp);
88
           expect(newPrimaryVideoSsrc).toEqual(this.primaryVideoSsrc);
88
           expect(newPrimaryVideoSsrc).toEqual(this.primaryVideoSsrc);
89
           // Should now have an rtx ssrc as well
89
           // Should now have an rtx ssrc as well
90
           expect(numVideoSsrcs(newSdp)).toEqual(2);
90
           expect(numVideoSsrcs(newSdp)).toEqual(2);
91
           // Should now have an FID group
91
           // Should now have an FID group
92
-          let fidGroups = getVideoGroups(newSdp, "FID");
92
+          const fidGroups = getVideoGroups(newSdp, "FID");
93
           expect(fidGroups.length).toEqual(1);
93
           expect(fidGroups.length).toEqual(1);
94
 
94
 
95
-          let fidGroup = fidGroups[0];
96
-          let fidGroupPrimarySsrc = SDPUtil.parseGroupSsrcs(fidGroup)[0];
95
+          const fidGroup = fidGroups[0];
96
+          const fidGroupPrimarySsrc = SDPUtil.parseGroupSsrcs(fidGroup)[0];
97
           expect(fidGroupPrimarySsrc).toEqual(this.primaryVideoSsrc);
97
           expect(fidGroupPrimarySsrc).toEqual(this.primaryVideoSsrc);
98
         });
98
         });
99
 
99
 
105
           let newSdp = transform.parse(newSdpStr);
105
           let newSdp = transform.parse(newSdpStr);
106
 
106
 
107
           let fidGroup = getVideoGroups(newSdp, "FID")[0];
107
           let fidGroup = getVideoGroups(newSdp, "FID")[0];
108
-          let fidGroupRtxSsrc = SDPUtil.parseGroupSsrcs(fidGroup)[1];
108
+          const fidGroupRtxSsrc = SDPUtil.parseGroupSsrcs(fidGroup)[1];
109
 
109
 
110
           // Now pass the original sdp through again 
110
           // Now pass the original sdp through again 
111
           newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.singleVideoSdp));
111
           newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.singleVideoSdp));
112
           newSdp = transform.parse(newSdpStr);
112
           newSdp = transform.parse(newSdpStr);
113
           fidGroup = getVideoGroups(newSdp, "FID")[0];
113
           fidGroup = getVideoGroups(newSdp, "FID")[0];
114
-          let newFidGroupRtxSsrc = SDPUtil.parseGroupSsrcs(fidGroup)[1];
114
+          const newFidGroupRtxSsrc = SDPUtil.parseGroupSsrcs(fidGroup)[1];
115
           expect(newFidGroupRtxSsrc).toEqual(fidGroupRtxSsrc);
115
           expect(newFidGroupRtxSsrc).toEqual(fidGroupRtxSsrc);
116
         });
116
         });
117
 
117
 
124
           let newSdp = transform.parse(newSdpStr);
124
           let newSdp = transform.parse(newSdpStr);
125
 
125
 
126
           let fidGroup = getVideoGroups(newSdp, "FID")[0];
126
           let fidGroup = getVideoGroups(newSdp, "FID")[0];
127
-          let fidGroupRtxSsrc = SDPUtil.parseGroupSsrcs(fidGroup)[1];
127
+          const fidGroupRtxSsrc = SDPUtil.parseGroupSsrcs(fidGroup)[1];
128
           this.rtxModifier.clearSsrcCache();
128
           this.rtxModifier.clearSsrcCache();
129
 
129
 
130
           // Now pass the original sdp through again
130
           // Now pass the original sdp through again
131
           newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.singleVideoSdp));
131
           newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.singleVideoSdp));
132
           newSdp = transform.parse(newSdpStr);
132
           newSdp = transform.parse(newSdpStr);
133
           fidGroup = getVideoGroups(newSdp, "FID")[0];
133
           fidGroup = getVideoGroups(newSdp, "FID")[0];
134
-          let newFidGroupRtxSsrc = SDPUtil.parseGroupSsrcs(fidGroup)[1];
134
+          const newFidGroupRtxSsrc = SDPUtil.parseGroupSsrcs(fidGroup)[1];
135
           expect(newFidGroupRtxSsrc).not.toEqual(fidGroupRtxSsrc);
135
           expect(newFidGroupRtxSsrc).not.toEqual(fidGroupRtxSsrc);
136
         });
136
         });
137
 
137
 
139
           // Manually set an rtx ssrc mapping in the cache
139
           // Manually set an rtx ssrc mapping in the cache
140
           // Call modifyRtxSsrcs
140
           // Call modifyRtxSsrcs
141
           // -->The rtx ssrc used should be the one we set
141
           // -->The rtx ssrc used should be the one we set
142
-          let forcedRtxSsrc = 123456;
143
-          let ssrcCache = new Map();
142
+          const forcedRtxSsrc = 123456;
143
+          const ssrcCache = new Map();
144
           ssrcCache.set(this.primaryVideoSsrc, forcedRtxSsrc);
144
           ssrcCache.set(this.primaryVideoSsrc, forcedRtxSsrc);
145
           this.rtxModifier.setSsrcCache(ssrcCache);
145
           this.rtxModifier.setSsrcCache(ssrcCache);
146
-          let newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.singleVideoSdp));
147
-          let newSdp = transform.parse(newSdpStr);
146
+          const newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.singleVideoSdp));
147
+          const newSdp = transform.parse(newSdpStr);
148
 
148
 
149
-          let fidGroup = getVideoGroups(newSdp, "FID")[0];
150
-          let fidGroupRtxSsrc = SDPUtil.parseGroupSsrcs(fidGroup)[1];
149
+          const fidGroup = getVideoGroups(newSdp, "FID")[0];
150
+          const fidGroupRtxSsrc = SDPUtil.parseGroupSsrcs(fidGroup)[1];
151
           expect(fidGroupRtxSsrc).toEqual(forcedRtxSsrc);
151
           expect(fidGroupRtxSsrc).toEqual(forcedRtxSsrc);
152
         });
152
         });
153
       });
153
       });
161
         it ("should add rtx ssrcs for all of them", function() {
161
         it ("should add rtx ssrcs for all of them", function() {
162
           // Call rtxModifier.modifyRtxSsrcs with an sdp that contains multiple video
162
           // Call rtxModifier.modifyRtxSsrcs with an sdp that contains multiple video
163
           //  ssrcs.  The returned sdp should have an rtx ssrc and an fid group for all of them.
163
           //  ssrcs.  The returned sdp should have an rtx ssrc and an fid group for all of them.
164
-          let newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.multipleVideoSdp));
165
-          let newSdp = transform.parse(newSdpStr);
166
-          let newPrimaryVideoSsrcs = getPrimaryVideoSsrcs(newSdp);
164
+          const newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.multipleVideoSdp));
165
+          const newSdp = transform.parse(newSdpStr);
166
+          const newPrimaryVideoSsrcs = getPrimaryVideoSsrcs(newSdp);
167
           expect(newPrimaryVideoSsrcs).toEqual(this.primaryVideoSsrcs);
167
           expect(newPrimaryVideoSsrcs).toEqual(this.primaryVideoSsrcs);
168
           // Should now have rtx ssrcs as well
168
           // Should now have rtx ssrcs as well
169
           expect(numVideoSsrcs(newSdp)).toEqual(this.primaryVideoSsrcs.length * 2);
169
           expect(numVideoSsrcs(newSdp)).toEqual(this.primaryVideoSsrcs.length * 2);
170
           // Should now have FID groups
170
           // Should now have FID groups
171
-          let fidGroups = getVideoGroups(newSdp, "FID");
171
+          const fidGroups = getVideoGroups(newSdp, "FID");
172
           expect(fidGroups.length).toEqual(this.primaryVideoSsrcs.length);
172
           expect(fidGroups.length).toEqual(this.primaryVideoSsrcs.length);
173
           fidGroups.forEach(fidGroup => {
173
           fidGroups.forEach(fidGroup => {
174
-            let fidGroupPrimarySsrc = SDPUtil.parseGroupSsrcs(fidGroup)[0];
174
+            const fidGroupPrimarySsrc = SDPUtil.parseGroupSsrcs(fidGroup)[0];
175
             expect(this.primaryVideoSsrcs.indexOf(fidGroupPrimarySsrc)).not.toEqual(-1);
175
             expect(this.primaryVideoSsrcs.indexOf(fidGroupPrimarySsrc)).not.toEqual(-1);
176
           });
176
           });
177
         });
177
         });
183
           let newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.multipleVideoSdp));
183
           let newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.multipleVideoSdp));
184
           let newSdp = transform.parse(newSdpStr);
184
           let newSdp = transform.parse(newSdpStr);
185
 
185
 
186
-          let rtxMapping = new Map();
186
+          const rtxMapping = new Map();
187
           let fidGroups = getVideoGroups(newSdp, "FID");
187
           let fidGroups = getVideoGroups(newSdp, "FID");
188
           // Save the first mapping that is made
188
           // Save the first mapping that is made
189
           fidGroups.forEach(fidGroup => {
189
           fidGroups.forEach(fidGroup => {
190
-            let fidSsrcs = SDPUtil.parseGroupSsrcs(fidGroup);
191
-            let fidGroupPrimarySsrc = fidSsrcs[0];
192
-            let fidGroupRtxSsrc = fidSsrcs[1];
190
+            const fidSsrcs = SDPUtil.parseGroupSsrcs(fidGroup);
191
+            const fidGroupPrimarySsrc = fidSsrcs[0];
192
+            const fidGroupRtxSsrc = fidSsrcs[1];
193
             rtxMapping.set(fidGroupPrimarySsrc, fidGroupRtxSsrc);
193
             rtxMapping.set(fidGroupPrimarySsrc, fidGroupRtxSsrc);
194
           });
194
           });
195
           // Now pass the original sdp through again and make sure we get the same mapping
195
           // Now pass the original sdp through again and make sure we get the same mapping
197
           newSdp = transform.parse(newSdpStr);
197
           newSdp = transform.parse(newSdpStr);
198
           fidGroups = getVideoGroups(newSdp, "FID");
198
           fidGroups = getVideoGroups(newSdp, "FID");
199
           fidGroups.forEach(fidGroup => {
199
           fidGroups.forEach(fidGroup => {
200
-            let fidSsrcs = SDPUtil.parseGroupSsrcs(fidGroup);
201
-            let fidGroupPrimarySsrc = fidSsrcs[0];
202
-            let fidGroupRtxSsrc = fidSsrcs[1];
200
+            const fidSsrcs = SDPUtil.parseGroupSsrcs(fidGroup);
201
+            const fidGroupPrimarySsrc = fidSsrcs[0];
202
+            const fidGroupRtxSsrc = fidSsrcs[1];
203
             expect(rtxMapping.has(fidGroupPrimarySsrc)).toBe(true);
203
             expect(rtxMapping.has(fidGroupPrimarySsrc)).toBe(true);
204
             expect(rtxMapping.get(fidGroupPrimarySsrc)).toEqual(fidGroupRtxSsrc);
204
             expect(rtxMapping.get(fidGroupPrimarySsrc)).toEqual(fidGroupRtxSsrc);
205
           });
205
           });
213
           let newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.multipleVideoSdp));
213
           let newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.multipleVideoSdp));
214
           let newSdp = transform.parse(newSdpStr);
214
           let newSdp = transform.parse(newSdpStr);
215
 
215
 
216
-          let rtxMapping = new Map();
216
+          const rtxMapping = new Map();
217
           let fidGroups = getVideoGroups(newSdp, "FID");
217
           let fidGroups = getVideoGroups(newSdp, "FID");
218
           // Save the first mapping that is made
218
           // Save the first mapping that is made
219
           fidGroups.forEach(fidGroup => {
219
           fidGroups.forEach(fidGroup => {
220
-            let fidSsrcs = SDPUtil.parseGroupSsrcs(fidGroup);
221
-            let fidGroupPrimarySsrc = fidSsrcs[0];
222
-            let fidGroupRtxSsrc = fidSsrcs[1];
220
+            const fidSsrcs = SDPUtil.parseGroupSsrcs(fidGroup);
221
+            const fidGroupPrimarySsrc = fidSsrcs[0];
222
+            const fidGroupRtxSsrc = fidSsrcs[1];
223
             rtxMapping.set(fidGroupPrimarySsrc, fidGroupRtxSsrc);
223
             rtxMapping.set(fidGroupPrimarySsrc, fidGroupRtxSsrc);
224
           });
224
           });
225
 
225
 
229
           newSdp = transform.parse(newSdpStr);
229
           newSdp = transform.parse(newSdpStr);
230
           fidGroups = getVideoGroups(newSdp, "FID");
230
           fidGroups = getVideoGroups(newSdp, "FID");
231
           fidGroups.forEach(fidGroup => {
231
           fidGroups.forEach(fidGroup => {
232
-            let fidSsrcs = SDPUtil.parseGroupSsrcs(fidGroup);
233
-            let fidGroupPrimarySsrc = fidSsrcs[0];
234
-            let fidGroupRtxSsrc = fidSsrcs[1];
232
+            const fidSsrcs = SDPUtil.parseGroupSsrcs(fidGroup);
233
+            const fidGroupPrimarySsrc = fidSsrcs[0];
234
+            const fidGroupRtxSsrc = fidSsrcs[1];
235
             expect(rtxMapping.has(fidGroupPrimarySsrc)).toBe(true);
235
             expect(rtxMapping.has(fidGroupPrimarySsrc)).toBe(true);
236
             expect(rtxMapping.get(fidGroupPrimarySsrc)).not.toEqual(fidGroupRtxSsrc);
236
             expect(rtxMapping.get(fidGroupPrimarySsrc)).not.toEqual(fidGroupRtxSsrc);
237
           });
237
           });
241
           // Manually set an rtx ssrc mapping in the cache
241
           // Manually set an rtx ssrc mapping in the cache
242
           // Call modifyRtxSsrcs
242
           // Call modifyRtxSsrcs
243
           // -->The rtx ssrc used should be the one we set
243
           // -->The rtx ssrc used should be the one we set
244
-          let rtxMapping = new Map();
244
+          const rtxMapping = new Map();
245
           this.primaryVideoSsrcs.forEach(ssrc => {
245
           this.primaryVideoSsrcs.forEach(ssrc => {
246
             rtxMapping.set(ssrc, SDPUtil.generateSsrc());
246
             rtxMapping.set(ssrc, SDPUtil.generateSsrc());
247
           });
247
           });
248
           this.rtxModifier.setSsrcCache(rtxMapping);
248
           this.rtxModifier.setSsrcCache(rtxMapping);
249
 
249
 
250
-          let newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.multipleVideoSdp));
251
-          let newSdp = transform.parse(newSdpStr);
250
+          const newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(this.multipleVideoSdp));
251
+          const newSdp = transform.parse(newSdpStr);
252
 
252
 
253
-          let fidGroups = getVideoGroups(newSdp, "FID");
253
+          const fidGroups = getVideoGroups(newSdp, "FID");
254
           fidGroups.forEach(fidGroup => {
254
           fidGroups.forEach(fidGroup => {
255
-            let fidSsrcs = SDPUtil.parseGroupSsrcs(fidGroup);
256
-            let fidGroupPrimarySsrc = fidSsrcs[0];
257
-            let fidGroupRtxSsrc = fidSsrcs[1];
255
+            const fidSsrcs = SDPUtil.parseGroupSsrcs(fidGroup);
256
+            const fidGroupPrimarySsrc = fidSsrcs[0];
257
+            const fidGroupRtxSsrc = fidSsrcs[1];
258
             expect(rtxMapping.has(fidGroupPrimarySsrc)).toBe(true);
258
             expect(rtxMapping.has(fidGroupPrimarySsrc)).toBe(true);
259
             expect(rtxMapping.get(fidGroupPrimarySsrc)).toEqual(fidGroupRtxSsrc);
259
             expect(rtxMapping.get(fidGroupPrimarySsrc)).toEqual(fidGroupRtxSsrc);
260
           });
260
           });
263
 
263
 
264
       describe ("(corner cases)", function() {
264
       describe ("(corner cases)", function() {
265
         it ("should handle a recvonly video mline", function() {
265
         it ("should handle a recvonly video mline", function() {
266
-          let sdp = SampleSdpStrings.plainVideoSdp;
267
-          let videoMLine = sdp.media.find(m => m.type === "video");
266
+          const sdp = SampleSdpStrings.plainVideoSdp;
267
+          const videoMLine = sdp.media.find(m => m.type === "video");
268
           videoMLine.direction = "recvonly";
268
           videoMLine.direction = "recvonly";
269
-          let newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(sdp));
269
+          const newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(sdp));
270
           expect(newSdpStr).toEqual(this.transform.write(sdp));
270
           expect(newSdpStr).toEqual(this.transform.write(sdp));
271
         });
271
         });
272
 
272
 
273
         it ("should handle an inactive video mline", function() {
273
         it ("should handle an inactive video mline", function() {
274
-          let sdp = SampleSdpStrings.plainVideoSdp;
275
-          let videoMLine = sdp.media.find(m => m.type === "video");
274
+          const sdp = SampleSdpStrings.plainVideoSdp;
275
+          const videoMLine = sdp.media.find(m => m.type === "video");
276
           videoMLine.direction = "inactive";
276
           videoMLine.direction = "inactive";
277
-          let newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(sdp));
277
+          const newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(sdp));
278
           expect(newSdpStr).toEqual(this.transform.write(sdp));
278
           expect(newSdpStr).toEqual(this.transform.write(sdp));
279
         });
279
         });
280
 
280
 
281
         it ("should handle a video mline with no video ssrcs", function() {
281
         it ("should handle a video mline with no video ssrcs", function() {
282
-          let sdp = SampleSdpStrings.plainVideoSdp;
283
-          let videoMLine = sdp.media.find(m => m.type === "video");
282
+          const sdp = SampleSdpStrings.plainVideoSdp;
283
+          const videoMLine = sdp.media.find(m => m.type === "video");
284
           videoMLine.ssrcs = [];
284
           videoMLine.ssrcs = [];
285
-          let newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(sdp));
285
+          const newSdpStr = this.rtxModifier.modifyRtxSsrcs(this.transform.write(sdp));
286
           expect(newSdpStr).toEqual(this.transform.write(sdp));
286
           expect(newSdpStr).toEqual(this.transform.write(sdp));
287
         });
287
         });
288
       });
288
       });

+ 5
- 5
modules/xmpp/SDPUtil.js View File

370
      * @return {number} the primary video ssrc from the given m line
370
      * @return {number} the primary video ssrc from the given m line
371
      */
371
      */
372
     parsePrimaryVideoSsrc: function(videoMLine) {
372
     parsePrimaryVideoSsrc: function(videoMLine) {
373
-        let numSsrcs = videoMLine.ssrcs
373
+        const numSsrcs = videoMLine.ssrcs
374
             .map(ssrcInfo => ssrcInfo.id)
374
             .map(ssrcInfo => ssrcInfo.id)
375
             .filter((ssrc, index, array) => array.indexOf(ssrc) === index)
375
             .filter((ssrc, index, array) => array.indexOf(ssrc) === index)
376
             .length;
376
             .length;
377
-        let numGroups = (videoMLine.ssrcGroups && videoMLine.ssrcGroups.length) || 0;
377
+        const numGroups = (videoMLine.ssrcGroups && videoMLine.ssrcGroups.length) || 0;
378
         if (numSsrcs > 1 && numGroups === 0) {
378
         if (numSsrcs > 1 && numGroups === 0) {
379
             // Ambiguous, can't figure out the primary
379
             // Ambiguous, can't figure out the primary
380
             return;
380
             return;
385
         } else {
385
         } else {
386
             if (numSsrcs === 2) {
386
             if (numSsrcs === 2) {
387
                 // Can figure it out if there's an FID group
387
                 // Can figure it out if there's an FID group
388
-                let fidGroup = videoMLine.ssrcGroups
388
+                const fidGroup = videoMLine.ssrcGroups
389
                     .find(group => group.semantics === "FID");
389
                     .find(group => group.semantics === "FID");
390
                 if (fidGroup) {
390
                 if (fidGroup) {
391
                     primarySsrc = fidGroup.ssrcs.split(" ")[0];
391
                     primarySsrc = fidGroup.ssrcs.split(" ")[0];
392
                 }
392
                 }
393
             } else if (numSsrcs >= 3) {
393
             } else if (numSsrcs >= 3) {
394
                 // Can figure it out if there's a sim group
394
                 // Can figure it out if there's a sim group
395
-                let simGroup = videoMLine.ssrcGroups
395
+                const simGroup = videoMLine.ssrcGroups
396
                     .find(group => group.semantics === "SIM");
396
                     .find(group => group.semantics === "SIM");
397
                 if (simGroup) {
397
                 if (simGroup) {
398
                     primarySsrc = simGroup.ssrcs.split(" ")[0];
398
                     primarySsrc = simGroup.ssrcs.split(" ")[0];
421
      */
421
      */
422
     getSsrcAttribute: function (mLine, ssrc, attributeName) {
422
     getSsrcAttribute: function (mLine, ssrc, attributeName) {
423
         for (let i = 0; i < mLine.ssrcs.length; ++i) {
423
         for (let i = 0; i < mLine.ssrcs.length; ++i) {
424
-            let ssrcLine = mLine.ssrcs[i];
424
+            const ssrcLine = mLine.ssrcs[i];
425
             if (ssrcLine.id === ssrc &&
425
             if (ssrcLine.id === ssrc &&
426
                 ssrcLine.attribute === attributeName) {
426
                 ssrcLine.attribute === attributeName) {
427
                 return ssrcLine.value;
427
                 return ssrcLine.value;

+ 3
- 3
modules/xmpp/SdpConsistency.js View File

81
                 logger.error("No SSRC found for the recvonly video stream!");
81
                 logger.error("No SSRC found for the recvonly video stream!");
82
             }
82
             }
83
         } else {
83
         } else {
84
-            let newPrimarySsrc = videoMLine.getPrimaryVideoSsrc();
84
+            const newPrimarySsrc = videoMLine.getPrimaryVideoSsrc();
85
             if (!newPrimarySsrc) {
85
             if (!newPrimarySsrc) {
86
                 logger.info("Sdp-consistency couldn't parse new primary ssrc");
86
                 logger.info("Sdp-consistency couldn't parse new primary ssrc");
87
                 return sdpStr;
87
                 return sdpStr;
99
                     newPrimarySsrc, this.cachedPrimarySsrc);
99
                     newPrimarySsrc, this.cachedPrimarySsrc);
100
                 for (const group of videoMLine.ssrcGroups) {
100
                 for (const group of videoMLine.ssrcGroups) {
101
                     if (group.semantics === "FID") {
101
                     if (group.semantics === "FID") {
102
-                        let primarySsrc = parsePrimarySSRC(group);
103
-                        let rtxSsrc = parseSecondarySSRC(group);
102
+                        const primarySsrc = parsePrimarySSRC(group);
103
+                        const rtxSsrc = parseSecondarySSRC(group);
104
                         if (primarySsrc === newPrimarySsrc) {
104
                         if (primarySsrc === newPrimarySsrc) {
105
                             group.ssrcs =
105
                             group.ssrcs =
106
                                 this.cachedPrimarySsrc + " " +
106
                                 this.cachedPrimarySsrc + " " +

+ 2
- 2
modules/xmpp/strophe.jingle.js View File

180
                 .c('services', {xmlns: 'urn:xmpp:extdisco:1'})
180
                 .c('services', {xmlns: 'urn:xmpp:extdisco:1'})
181
                 .c('service', {host: 'turn.' + this.connection.domain}),
181
                 .c('service', {host: 'turn.' + this.connection.domain}),
182
             res => {
182
             res => {
183
-                let iceservers = [];
183
+                const iceservers = [];
184
                 $(res).find('>services>service').each((idx, el) => {
184
                 $(res).find('>services>service').each((idx, el) => {
185
                     el = $(el);
185
                     el = $(el);
186
-                    let dict = {};
186
+                    const dict = {};
187
                     const type = el.attr('type');
187
                     const type = el.attr('type');
188
                     switch (type) {
188
                     switch (type) {
189
                         case 'stun':
189
                         case 'stun':

+ 1
- 1
modules/xmpp/strophe.rayo.js View File

48
             this.connection.sendIQ(req, (result) => {
48
             this.connection.sendIQ(req, (result) => {
49
                 logger.info('Dial result ', result);
49
                 logger.info('Dial result ', result);
50
 
50
 
51
-                let resource = $(result).find('ref').attr('uri');
51
+                const resource = $(result).find('ref').attr('uri');
52
                 this.call_resource =
52
                 this.call_resource =
53
                     resource.substr('xmpp:'.length);
53
                     resource.substr('xmpp:'.length);
54
                 logger.info("Received call resource: " + this.call_resource);
54
                 logger.info("Received call resource: " + this.call_resource);

+ 1
- 1
modules/xmpp/xmpp.js View File

265
         // By default MUC nickname is the resource part of the JID
265
         // By default MUC nickname is the resource part of the JID
266
         let mucNickname = Strophe.getNodeFromJid(this.connection.jid);
266
         let mucNickname = Strophe.getNodeFromJid(this.connection.jid);
267
         let roomjid = roomName  + "@" + this.options.hosts.muc + "/";
267
         let roomjid = roomName  + "@" + this.options.hosts.muc + "/";
268
-        let cfgNickname
268
+        const cfgNickname
269
             = options.useNicks && options.nick ? options.nick : null;
269
             = options.useNicks && options.nick ? options.nick : null;
270
 
270
 
271
         if (cfgNickname) {
271
         if (cfgNickname) {

Loading…
Cancel
Save