Sfoglia il codice sorgente

[eslint] camelcase

dev1
Lyubo Marinov 8 anni fa
parent
commit
c88c4f9124

+ 1
- 0
.eslintrc.js Vedi File

@@ -160,6 +160,7 @@ module.exports = {
160 160
         ],
161 161
         'block-spacing': [ 'error', 'always' ],
162 162
         'brace-style': 2,
163
+        'camelcase': 2,
163 164
         'comma-dangle': 2,
164 165
         'comma-spacing': 2,
165 166
         'comma-style': 2,

+ 3
- 3
connection_optimization/external_connect.js Vedi File

@@ -11,7 +11,7 @@
11 11
  *
12 12
  * @param webserviceUrl the url for the web service that is going to create the
13 13
  * connection.
14
- * @param success_callback callback function called with the result of the AJAX
14
+ * @param successCallback callback function called with the result of the AJAX
15 15
  * request if the request was successfull. The callback will receive one
16 16
  * parameter which will be JS Object with properties - rid, sid and jid. This
17 17
  * result should be passed to JitsiConnection.attach method in order to use that
@@ -22,7 +22,7 @@
22 22
  */
23 23
 function createConnectionExternally( // eslint-disable-line no-unused-vars
24 24
         webserviceUrl,
25
-        success_callback,
25
+        successCallback,
26 26
         error_callback) {
27 27
     if (!window.XMLHttpRequest) {
28 28
         error_callback(new Error('XMLHttpRequest is not supported!'));
@@ -51,7 +51,7 @@ function createConnectionExternally( // eslint-disable-line no-unused-vars
51 51
                         'CrossRegion': proxyRegion !== jitsiRegion ? 1 : 0
52 52
                     };
53 53
 
54
-                    success_callback(data);
54
+                    successCallback(data);
55 55
                 } catch (e) {
56 56
                     error_callback(e);
57 57
                 }

+ 1
- 1
modules/RTC/RTC.js Vedi File

@@ -528,7 +528,7 @@ export default class RTC extends Listenable {
528 528
     }
529 529
 
530 530
     static getPCConstraints() {
531
-        return RTCUtils.pc_constraints;
531
+        return RTCUtils.pcConstraints;
532 532
     }
533 533
 
534 534
     static attachMediaStream(elSelector, stream) {

+ 16
- 16
modules/RTC/RTCUtils.js Vedi File

@@ -794,7 +794,7 @@ class RTCUtils extends Listenable {
794 794
                     = wrapEnumerateDevices(
795 795
                         navigator.mediaDevices.enumerateDevices.bind(
796 796
                             navigator.mediaDevices));
797
-                this.pc_constraints = {};
797
+                this.pcConstraints = {};
798 798
                 this.attachMediaStream
799 799
                     = wrapAttachMediaStream((element, stream) => {
800 800
                         // srcObject is being standardized and FF will
@@ -826,7 +826,7 @@ class RTCUtils extends Listenable {
826 826
                         id = tracks[0].id;
827 827
                     }
828 828
 
829
-                    return SDPUtil.filter_special_chars(id);
829
+                    return SDPUtil.filterSpecialChars(id);
830 830
                 };
831 831
 
832 832
                 /* eslint-disable no-global-assign, no-native-reassign */
@@ -878,21 +878,21 @@ class RTCUtils extends Listenable {
878 878
                     return (
879 879
                         typeof id === 'number'
880 880
                             ? id
881
-                            : SDPUtil.filter_special_chars(id));
881
+                            : SDPUtil.filterSpecialChars(id));
882 882
                 };
883 883
 
884
-                this.pc_constraints = { optional: [] };
884
+                this.pcConstraints = { optional: [] };
885 885
 
886 886
                 // Allows sending of video to be suspended if the bandwidth
887 887
                 // estimation is too low.
888 888
                 if (!options.disableSuspendVideo) {
889
-                    this.pc_constraints.optional.push(
889
+                    this.pcConstraints.optional.push(
890 890
                         { googSuspendBelowMinBitrate: true });
891 891
                 }
892 892
 
893 893
                 if (options.useIPv6) {
894 894
                     // https://code.google.com/p/webrtc/issues/detail?id=2828
895
-                    this.pc_constraints.optional.push({ googIPv6: true });
895
+                    this.pcConstraints.optional.push({ googIPv6: true });
896 896
                 }
897 897
 
898 898
                 if (!webkitMediaStream.prototype.getVideoTracks) {
@@ -942,7 +942,7 @@ class RTCUtils extends Listenable {
942 942
                             return attachMediaStream(element, stream);
943 943
                         });
944 944
                     this.getStreamID
945
-                        = stream => SDPUtil.filter_special_chars(stream.label);
945
+                        = stream => SDPUtil.filterSpecialChars(stream.label);
946 946
 
947 947
                     onReady(
948 948
                         options,
@@ -990,8 +990,8 @@ class RTCUtils extends Listenable {
990 990
 
991 991
     /**
992 992
     * @param {string[]} um required user media types
993
-    * @param {function} success_callback
994
-    * @param {Function} failure_callback
993
+    * @param {function} successCallback
994
+    * @param {Function} failureCallback
995 995
     * @param {Object} [options] optional parameters
996 996
     * @param {string} options.resolution
997 997
     * @param {number} options.bandwidth
@@ -1002,8 +1002,8 @@ class RTCUtils extends Listenable {
1002 1002
     **/
1003 1003
     getUserMediaWithConstraints(
1004 1004
             um,
1005
-            success_callback,
1006
-            failure_callback,
1005
+            successCallback,
1006
+            failureCallback,
1007 1007
             options = {}) {
1008 1008
         const constraints = getConstraints(um, options);
1009 1009
 
@@ -1015,23 +1015,23 @@ class RTCUtils extends Listenable {
1015 1015
                 stream => {
1016 1016
                     logger.log('onUserMediaSuccess');
1017 1017
                     setAvailableDevices(um, stream);
1018
-                    success_callback(stream);
1018
+                    successCallback(stream);
1019 1019
                 },
1020 1020
                 error => {
1021 1021
                     setAvailableDevices(um, undefined);
1022 1022
                     logger.warn('Failed to get access to local media. Error ',
1023 1023
                         error, constraints);
1024 1024
 
1025
-                    if (failure_callback) {
1026
-                        failure_callback(
1025
+                    if (failureCallback) {
1026
+                        failureCallback(
1027 1027
                             new JitsiTrackError(error, constraints, um));
1028 1028
                     }
1029 1029
                 });
1030 1030
         } catch (e) {
1031 1031
             logger.error('GUM failed: ', e);
1032 1032
 
1033
-            if (failure_callback) {
1034
-                failure_callback(new JitsiTrackError(e, constraints, um));
1033
+            if (failureCallback) {
1034
+                failureCallback(new JitsiTrackError(e, constraints, um));
1035 1035
             }
1036 1036
         }
1037 1037
     }

+ 5
- 5
modules/RTC/TraceablePeerConnection.js Vedi File

@@ -23,7 +23,7 @@ const SIMULCAST_LAYERS = 3;
23 23
  * @param {RTC} rtc the instance of <tt>RTC</tt> service
24 24
  * @param {number} id the peer connection id assigned by the parent RTC module.
25 25
  * @param {SignalingLayer} signalingLayer the signaling layer instance
26
- * @param {object} ice_config WebRTC 'PeerConnection' ICE config
26
+ * @param {object} iceConfig WebRTC 'PeerConnection' ICE config
27 27
  * @param {object} constraints WebRTC 'PeerConnection' constraints
28 28
  * @param {object} options <tt>TracablePeerConnection</tt> config options.
29 29
  * @param {boolean} options.disableSimulcast if set to 'true' will disable
@@ -39,7 +39,7 @@ const SIMULCAST_LAYERS = 3;
39 39
  *
40 40
  * @constructor
41 41
  */
42
-function TraceablePeerConnection(rtc, id, signalingLayer, ice_config,
42
+function TraceablePeerConnection(rtc, id, signalingLayer, iceConfig,
43 43
                                  constraints, options) {
44 44
     const self = this;
45 45
 
@@ -72,7 +72,7 @@ function TraceablePeerConnection(rtc, id, signalingLayer, ice_config,
72 72
     } else {
73 73
         RTCPeerConnectionType = webkitRTCPeerConnection;
74 74
     }
75
-    this.peerconnection = new RTCPeerConnectionType(ice_config, constraints);
75
+    this.peerconnection = new RTCPeerConnectionType(iceConfig, constraints);
76 76
     this.updateLog = [];
77 77
     this.stats = {};
78 78
     this.statsinterval = null;
@@ -300,7 +300,7 @@ TraceablePeerConnection.prototype._remoteTrackAdded = function(stream, track) {
300 300
         return;
301 301
     }
302 302
 
303
-    let ssrcLines = SDPUtil.find_lines(mediaLines[0], 'a=ssrc:');
303
+    let ssrcLines = SDPUtil.findLines(mediaLines[0], 'a=ssrc:');
304 304
 
305 305
     ssrcLines = ssrcLines.filter(
306 306
         line => {
@@ -864,7 +864,7 @@ const _fixAnswerRFC4145Setup = function(offer, answer) {
864 864
             && offer.media && answer.media
865 865
             && offer.media.length === answer.media.length) {
866 866
         answer.media.forEach((a, i) => {
867
-            if (SDPUtil.find_line(
867
+            if (SDPUtil.findLine(
868 868
                     offer.media[i],
869 869
                     'a=setup:actpass',
870 870
                     offer.session)) {

+ 18
- 18
modules/statistics/CallStats.js Vedi File

@@ -130,7 +130,7 @@ function initCallback(err, msg) {
130 130
  * @return a function which invokes f in a try/catch block, logs any exception
131 131
  * to the console, and then swallows it
132 132
  */
133
-function _try_catch(f) {
133
+function tryCatch(f) {
134 134
     return function() {
135 135
         try {
136 136
             f.apply(this, arguments); // eslint-disable-line prefer-rest-params
@@ -146,7 +146,7 @@ function _try_catch(f) {
146 146
  * @param peerConnection {JingleSessionPC} the session object
147 147
  * @param options {object} credentials for callstats.
148 148
  */
149
-const CallStats = _try_catch(function(jingleSession, options) {
149
+const CallStats = tryCatch(function(jingleSession, options) {
150 150
     try {
151 151
         CallStats.feedbackEnabled = false;
152 152
         callStats = new callstats($, io, jsSHA); // eslint-disable-line new-cap
@@ -242,7 +242,7 @@ const reportType = {
242 242
     MST_WITH_USERID: 'mstWithUserID'
243 243
 };
244 244
 
245
-CallStats.prototype.pcCallback = _try_catch((err, msg) => {
245
+CallStats.prototype.pcCallback = tryCatch((err, msg) => {
246 246
     if (callStats && err !== 'success') {
247 247
         logger.error(`Monitoring status: ${err} msg: ${msg}`);
248 248
     }
@@ -269,7 +269,7 @@ CallStats.prototype.associateStreamWithVideoTag
269 269
     // 'jitsi' is default remote user ID for now
270 270
     const callStatsId = isLocal ? this.userID : DEFAULT_REMOTE_USER;
271 271
 
272
-    _try_catch(function() {
272
+    tryCatch(function() {
273 273
         logger.debug(
274 274
             'Calling callStats.associateMstWithUserID with:',
275 275
             this.peerconnection,
@@ -307,7 +307,7 @@ CallStats.prototype.associateStreamWithVideoTag
307 307
  * @param type {String} "audio"/"video"
308 308
  * @param {CallStats} cs callstats instance related to the event
309 309
  */
310
-CallStats.sendMuteEvent = _try_catch((mute, type, cs) => {
310
+CallStats.sendMuteEvent = tryCatch((mute, type, cs) => {
311 311
     let event;
312 312
 
313 313
     if (type === 'video') {
@@ -325,7 +325,7 @@ CallStats.sendMuteEvent = _try_catch((mute, type, cs) => {
325 325
  * false for not stopping
326 326
  * @param {CallStats} cs callstats instance related to the event
327 327
  */
328
-CallStats.sendScreenSharingEvent = _try_catch((start, cs) => {
328
+CallStats.sendScreenSharingEvent = tryCatch((start, cs) => {
329 329
     CallStats._reportEvent.call(
330 330
         cs,
331 331
         start ? fabricEvent.screenShareStart : fabricEvent.screenShareStop);
@@ -335,7 +335,7 @@ CallStats.sendScreenSharingEvent = _try_catch((start, cs) => {
335 335
  * Notifies CallStats that we are the new dominant speaker in the conference.
336 336
  * @param {CallStats} cs callstats instance related to the event
337 337
  */
338
-CallStats.sendDominantSpeakerEvent = _try_catch(cs => {
338
+CallStats.sendDominantSpeakerEvent = tryCatch(cs => {
339 339
     CallStats._reportEvent.call(cs, fabricEvent.dominantSpeaker);
340 340
 });
341 341
 
@@ -344,7 +344,7 @@ CallStats.sendDominantSpeakerEvent = _try_catch(cs => {
344 344
  * @param {{deviceList: {String:String}}} list of devices with their data
345 345
  * @param {CallStats} cs callstats instance related to the event
346 346
  */
347
-CallStats.sendActiveDeviceListEvent = _try_catch((devicesData, cs) => {
347
+CallStats.sendActiveDeviceListEvent = tryCatch((devicesData, cs) => {
348 348
     CallStats._reportEvent.call(cs, fabricEvent.activeDeviceList, devicesData);
349 349
 });
350 350
 
@@ -374,7 +374,7 @@ CallStats._reportEvent = function(event, eventData) {
374 374
 /**
375 375
  * Notifies CallStats for connection setup errors
376 376
  */
377
-CallStats.prototype.sendTerminateEvent = _try_catch(function() {
377
+CallStats.prototype.sendTerminateEvent = tryCatch(function() {
378 378
     if (!CallStats.initialized) {
379 379
         return;
380 380
     }
@@ -387,7 +387,7 @@ CallStats.prototype.sendTerminateEvent = _try_catch(function() {
387 387
  * @param {RTCPeerConnection} pc connection on which failure occured.
388 388
  * @param {CallStats} cs callstats instance related to the error (optional)
389 389
  */
390
-CallStats.prototype.sendIceConnectionFailedEvent = _try_catch((pc, cs) => {
390
+CallStats.prototype.sendIceConnectionFailedEvent = tryCatch((pc, cs) => {
391 391
     CallStats._reportError.call(
392 392
         cs, wrtcFuncNames.iceConnectionFailure, null, pc);
393 393
 });
@@ -399,7 +399,7 @@ CallStats.prototype.sendIceConnectionFailedEvent = _try_catch((pc, cs) => {
399 399
  * user feedback
400 400
  * @param detailedFeedback detailed feedback from the user. Not yet used
401 401
  */
402
-CallStats.prototype.sendFeedback = _try_catch(
402
+CallStats.prototype.sendFeedback = tryCatch(
403 403
 function(overallFeedback, detailedFeedback) {
404 404
     if (!CallStats.feedbackEnabled) {
405 405
         return;
@@ -450,7 +450,7 @@ CallStats._reportError = function(type, e, pc) {
450 450
  * @param {Error} e error to send
451 451
  * @param {CallStats} cs callstats instance related to the error (optional)
452 452
  */
453
-CallStats.sendGetUserMediaFailed = _try_catch((e, cs) => {
453
+CallStats.sendGetUserMediaFailed = tryCatch((e, cs) => {
454 454
     CallStats._reportError.call(cs, wrtcFuncNames.getUserMedia, e, null);
455 455
 });
456 456
 
@@ -461,7 +461,7 @@ CallStats.sendGetUserMediaFailed = _try_catch((e, cs) => {
461 461
  * @param {RTCPeerConnection} pc connection on which failure occured.
462 462
  * @param {CallStats} cs callstats instance related to the error (optional)
463 463
  */
464
-CallStats.sendCreateOfferFailed = _try_catch((e, pc, cs) => {
464
+CallStats.sendCreateOfferFailed = tryCatch((e, pc, cs) => {
465 465
     CallStats._reportError.call(cs, wrtcFuncNames.createOffer, e, pc);
466 466
 });
467 467
 
@@ -472,7 +472,7 @@ CallStats.sendCreateOfferFailed = _try_catch((e, pc, cs) => {
472 472
  * @param {RTCPeerConnection} pc connection on which failure occured.
473 473
  * @param {CallStats} cs callstats instance related to the error (optional)
474 474
  */
475
-CallStats.sendCreateAnswerFailed = _try_catch((e, pc, cs) => {
475
+CallStats.sendCreateAnswerFailed = tryCatch((e, pc, cs) => {
476 476
     CallStats._reportError.call(cs, wrtcFuncNames.createAnswer, e, pc);
477 477
 });
478 478
 
@@ -483,7 +483,7 @@ CallStats.sendCreateAnswerFailed = _try_catch((e, pc, cs) => {
483 483
  * @param {RTCPeerConnection} pc connection on which failure occured.
484 484
  * @param {CallStats} cs callstats instance related to the error (optional)
485 485
  */
486
-CallStats.sendSetLocalDescFailed = _try_catch((e, pc, cs) => {
486
+CallStats.sendSetLocalDescFailed = tryCatch((e, pc, cs) => {
487 487
     CallStats._reportError.call(cs, wrtcFuncNames.setLocalDescription, e, pc);
488 488
 });
489 489
 
@@ -494,7 +494,7 @@ CallStats.sendSetLocalDescFailed = _try_catch((e, pc, cs) => {
494 494
  * @param {RTCPeerConnection} pc connection on which failure occured.
495 495
  * @param {CallStats} cs callstats instance related to the error (optional)
496 496
  */
497
-CallStats.sendSetRemoteDescFailed = _try_catch((e, pc, cs) => {
497
+CallStats.sendSetRemoteDescFailed = tryCatch((e, pc, cs) => {
498 498
     CallStats._reportError.call(cs, wrtcFuncNames.setRemoteDescription, e, pc);
499 499
 });
500 500
 
@@ -505,7 +505,7 @@ CallStats.sendSetRemoteDescFailed = _try_catch((e, pc, cs) => {
505 505
  * @param {RTCPeerConnection} pc connection on which failure occured.
506 506
  * @param {CallStats} cs callstats instance related to the error (optional)
507 507
  */
508
-CallStats.sendAddIceCandidateFailed = _try_catch((e, pc, cs) => {
508
+CallStats.sendAddIceCandidateFailed = tryCatch((e, pc, cs) => {
509 509
     CallStats._reportError.call(cs, wrtcFuncNames.addIceCandidate, e, pc);
510 510
 });
511 511
 
@@ -515,7 +515,7 @@ CallStats.sendAddIceCandidateFailed = _try_catch((e, pc, cs) => {
515 515
  * @param {Error} e error to send or {String} message
516 516
  * @param {CallStats} cs callstats instance related to the error (optional)
517 517
  */
518
-CallStats.sendApplicationLog = _try_catch((e, cs) => {
518
+CallStats.sendApplicationLog = tryCatch((e, cs) => {
519 519
     CallStats._reportError.call(cs, wrtcFuncNames.applicationLog, e, null);
520 520
 });
521 521
 

+ 6
- 6
modules/xmpp/JingleSession.js Vedi File

@@ -17,19 +17,19 @@ export default class JingleSession {
17 17
      * @param {string} localJid our JID
18 18
      * @param {string} peerjid the JID of the remote peer
19 19
      * @param {Strophe.Connection} connection the XMPP connection
20
-     * @param {Object} media_constraints the media constraints object passed to
20
+     * @param {Object} mediaConstraints the media constraints object passed to
21 21
      * the PeerConnection onCreateAnswer/Offer as defined by the WebRTC.
22
-     * @param {Object} ice_config the ICE servers config object as defined by
22
+     * @param {Object} iceConfig the ICE servers config object as defined by
23 23
      * the WebRTC. Passed to the PeerConnection's constructor.
24 24
      */
25 25
     constructor(sid,
26
-                localJid, peerjid, connection, media_constraints, ice_config) {
26
+                localJid, peerjid, connection, mediaConstraints, iceConfig) {
27 27
         this.sid = sid;
28 28
         this.localJid = localJid;
29 29
         this.peerjid = peerjid;
30 30
         this.connection = connection;
31
-        this.media_constraints = media_constraints;
32
-        this.ice_config = ice_config;
31
+        this.mediaConstraints = mediaConstraints;
32
+        this.iceConfig = iceConfig;
33 33
 
34 34
         /**
35 35
          * Whether to use dripping or not. Dripping is sending trickle
@@ -40,7 +40,7 @@ export default class JingleSession {
40 40
         /**
41 41
          *  When dripping is used, stores ICE candidates which are to be sent.
42 42
          */
43
-        this.drip_container = [];
43
+        this.dripContainer = [];
44 44
 
45 45
         /**
46 46
          * The chat room instance associated with the session.

+ 26
- 26
modules/xmpp/JingleSessionPC.js Vedi File

@@ -32,9 +32,9 @@ export default class JingleSessionPC extends JingleSession {
32 32
      * @param {string} peerjid remote peer JID
33 33
      * @param {Strophe.Connection} connection Strophe XMPP connection instance
34 34
      * used to send packets.
35
-     * @param media_constraints the media constraints object passed to
35
+     * @param mediaConstraints the media constraints object passed to
36 36
      * createOffer/Answer, as defined by the WebRTC standard
37
-     * @param ice_config the ICE servers config object as defined by the WebRTC
37
+     * @param iceConfig the ICE servers config object as defined by the WebRTC
38 38
      * standard.
39 39
      * @param {object} options a set of config options
40 40
      * @param {boolean} options.webrtcIceUdpDisable <tt>true</tt> to block UDP
@@ -49,8 +49,8 @@ export default class JingleSessionPC extends JingleSession {
49 49
      * @implements {SignalingLayer}
50 50
      */
51 51
     constructor(sid, me, peerjid, connection,
52
-                media_constraints, ice_config, options) {
53
-        super(sid, me, peerjid, connection, media_constraints, ice_config);
52
+                mediaConstraints, iceConfig, options) {
53
+        super(sid, me, peerjid, connection, mediaConstraints, iceConfig);
54 54
 
55 55
         this.lasticecandidate = false;
56 56
         this.closed = false;
@@ -111,7 +111,7 @@ export default class JingleSessionPC extends JingleSession {
111 111
         this.peerconnection
112 112
             = this.rtc.createPeerConnection(
113 113
                 this,
114
-                this.connection.jingle.ice_config,
114
+                this.connection.jingle.iceConfig,
115 115
 
116 116
                 /* Options */
117 117
                 {
@@ -254,17 +254,17 @@ export default class JingleSessionPC extends JingleSession {
254 254
             ice.xmlns = 'urn:xmpp:jingle:transports:ice-udp:1';
255 255
 
256 256
             if (this.usedrip) {
257
-                if (this.drip_container.length === 0) {
257
+                if (this.dripContainer.length === 0) {
258 258
                     // start 20ms callout
259 259
                     setTimeout(() => {
260
-                        if (this.drip_container.length === 0) {
260
+                        if (this.dripContainer.length === 0) {
261 261
                             return;
262 262
                         }
263
-                        this.sendIceCandidates(this.drip_container);
264
-                        this.drip_container = [];
263
+                        this.sendIceCandidates(this.dripContainer);
264
+                        this.dripContainer = [];
265 265
                     }, 20);
266 266
                 }
267
-                this.drip_container.push(candidate);
267
+                this.dripContainer.push(candidate);
268 268
             } else {
269 269
                 this.sendIceCandidates([ candidate ]);
270 270
             }
@@ -290,7 +290,7 @@ export default class JingleSessionPC extends JingleSession {
290 290
         for (let mid = 0; mid < localSDP.media.length; mid++) {
291 291
             const cands = candidates.filter(el => el.sdpMLineIndex === mid);
292 292
             const mline
293
-                = SDPUtil.parse_mline(localSDP.media[mid].split('\r\n')[0]);
293
+                = SDPUtil.parseMLine(localSDP.media[mid].split('\r\n')[0]);
294 294
 
295 295
             if (cands.length > 0) {
296 296
                 const ice
@@ -315,13 +315,13 @@ export default class JingleSessionPC extends JingleSession {
315 315
                 }
316 316
 
317 317
                 // add fingerprint
318
-                const fingerprint_line
319
-                    = SDPUtil.find_line(
318
+                const fingerprintLine
319
+                    = SDPUtil.findLine(
320 320
                         localSDP.media[mid],
321 321
                         'a=fingerprint:', localSDP.session);
322 322
 
323
-                if (fingerprint_line) {
324
-                    const tmp = SDPUtil.parse_fingerprint(fingerprint_line);
323
+                if (fingerprintLine) {
324
+                    const tmp = SDPUtil.parseFingerprint(fingerprintLine);
325 325
 
326 326
                     tmp.required = true;
327 327
                     cand.c(
@@ -569,7 +569,7 @@ export default class JingleSessionPC extends JingleSession {
569 569
             });
570 570
 
571 571
         localSDP.media.forEach((medialines, idx) => {
572
-            const mline = SDPUtil.parse_mline(medialines.split('\r\n')[0]);
572
+            const mline = SDPUtil.parseMLine(medialines.split('\r\n')[0]);
573 573
 
574 574
             transportAccept.c('content',
575 575
                 {
@@ -730,7 +730,7 @@ export default class JingleSessionPC extends JingleSession {
730 730
                 });
731 731
             });
732 732
             currentRemoteSdp.media.forEach((media, idx) => {
733
-                if (!SDPUtil.find_line(media, `a=mid:${name}`)) {
733
+                if (!SDPUtil.findLine(media, `a=mid:${name}`)) {
734 734
                     return;
735 735
                 }
736 736
                 if (!addSsrcInfo[idx]) {
@@ -927,7 +927,7 @@ export default class JingleSessionPC extends JingleSession {
927 927
      *  rejects with an error {string}
928 928
      */
929 929
     _renegotiate(optionalRemoteSdp) {
930
-        const media_constraints = this.media_constraints;
930
+        const mediaConstraints = this.mediaConstraints;
931 931
         const remoteSdp
932 932
             = optionalRemoteSdp
933 933
                 || new SDP(this.peerconnection.remoteDescription.sdp);
@@ -989,7 +989,7 @@ export default class JingleSessionPC extends JingleSession {
989 989
                             );
990 990
                         },
991 991
                         error => reject(`createAnswer failed: ${error}`),
992
-                        media_constraints
992
+                        mediaConstraints
993 993
                     );
994 994
                 },
995 995
                 error => {
@@ -1126,7 +1126,7 @@ export default class JingleSessionPC extends JingleSession {
1126 1126
                 ssrcs.push(ssrc);
1127 1127
             });
1128 1128
             currentRemoteSdp.media.forEach((media, idx) => {
1129
-                if (!SDPUtil.find_line(media, `a=mid:${name}`)) {
1129
+                if (!SDPUtil.findLine(media, `a=mid:${name}`)) {
1130 1130
                     return;
1131 1131
                 }
1132 1132
                 if (!removeSsrcInfo[idx]) {
@@ -1134,7 +1134,7 @@ export default class JingleSessionPC extends JingleSession {
1134 1134
                 }
1135 1135
                 ssrcs.forEach(ssrc => {
1136 1136
                     const ssrcLines
1137
-                        = SDPUtil.find_lines(media, `a=ssrc:${ssrc}`);
1137
+                        = SDPUtil.findLines(media, `a=ssrc:${ssrc}`);
1138 1138
 
1139 1139
                     if (ssrcLines.length) {
1140 1140
                         removeSsrcInfo[idx] += `${ssrcLines.join('\r\n')}\r\n`;
@@ -1341,10 +1341,10 @@ export default class JingleSessionPC extends JingleSession {
1341 1341
 
1342 1342
     /**
1343 1343
      * Figures out added/removed ssrcs and send update IQs.
1344
-     * @param old_sdp SDP object for old description.
1345
-     * @param new_sdp SDP object for new description.
1344
+     * @param oldSDP SDP object for old description.
1345
+     * @param newSDP SDP object for new description.
1346 1346
      */
1347
-    notifyMySSRCUpdate(old_sdp, new_sdp) {
1347
+    notifyMySSRCUpdate(oldSDP, newSDP) {
1348 1348
 
1349 1349
         if (this.state !== JingleSessionState.ACTIVE) {
1350 1350
             logger.warn(`Skipping SSRC update in '${this.state} ' state.`);
@@ -1353,7 +1353,7 @@ export default class JingleSessionPC extends JingleSession {
1353 1353
         }
1354 1354
 
1355 1355
         // send source-remove IQ.
1356
-        let sdpDiffer = new SDPDiffer(new_sdp, old_sdp);
1356
+        let sdpDiffer = new SDPDiffer(newSDP, oldSDP);
1357 1357
         const remove = $iq({ to: this.peerjid,
1358 1358
             type: 'set' })
1359 1359
             .c('jingle', {
@@ -1380,7 +1380,7 @@ export default class JingleSessionPC extends JingleSession {
1380 1380
         }
1381 1381
 
1382 1382
         // send source-add IQ.
1383
-        sdpDiffer = new SDPDiffer(old_sdp, new_sdp);
1383
+        sdpDiffer = new SDPDiffer(oldSDP, newSDP);
1384 1384
         const add = $iq({ to: this.peerjid,
1385 1385
             type: 'set' })
1386 1386
             .c('jingle', {

+ 54
- 54
modules/xmpp/SDP.js Vedi File

@@ -7,12 +7,12 @@ function SDP(sdp) {
7 7
     const media = sdp.split('\r\nm=');
8 8
 
9 9
     for (let i = 1, length = media.length; i < length; i++) {
10
-        let media_i = `m=${media[i]}`;
10
+        let mediaI = `m=${media[i]}`;
11 11
 
12 12
         if (i !== length - 1) {
13
-            media_i += '\r\n';
13
+            mediaI += '\r\n';
14 14
         }
15
-        media[i] = media_i;
15
+        media[i] = mediaI;
16 16
     }
17 17
     const session = `${media.shift()}\r\n`;
18 18
 
@@ -46,14 +46,14 @@ SDP.prototype.removeUdpCandidates = false;
46 46
  */
47 47
 SDP.prototype.getMediaSsrcMap = function() {
48 48
     const self = this;
49
-    const media_ssrcs = {};
49
+    const mediaSSRCs = {};
50 50
     let tmp;
51 51
 
52 52
     for (let mediaindex = 0; mediaindex < self.media.length; mediaindex++) {
53
-        tmp = SDPUtil.find_lines(self.media[mediaindex], 'a=ssrc:');
53
+        tmp = SDPUtil.findLines(self.media[mediaindex], 'a=ssrc:');
54 54
         const mid
55
-            = SDPUtil.parse_mid(
56
-                SDPUtil.find_line(self.media[mediaindex],
55
+            = SDPUtil.parseMID(
56
+                SDPUtil.findLine(self.media[mediaindex],
57 57
                 'a=mid:'));
58 58
         const media = {
59 59
             mediaindex,
@@ -62,7 +62,7 @@ SDP.prototype.getMediaSsrcMap = function() {
62 62
             ssrcGroups: []
63 63
         };
64 64
 
65
-        media_ssrcs[mediaindex] = media;
65
+        mediaSSRCs[mediaindex] = media;
66 66
         tmp.forEach(line => {
67 67
             const linessrc = line.substring(7).split(' ')[0];
68 68
 
@@ -76,7 +76,7 @@ SDP.prototype.getMediaSsrcMap = function() {
76 76
             }
77 77
             media.ssrcs[linessrc].lines.push(line);
78 78
         });
79
-        tmp = SDPUtil.find_lines(self.media[mediaindex], 'a=ssrc-group:');
79
+        tmp = SDPUtil.findLines(self.media[mediaindex], 'a=ssrc-group:');
80 80
         tmp.forEach(line => {
81 81
             const idx = line.indexOf(' ');
82 82
             const semantics = line.substr(0, idx).substr(13);
@@ -91,7 +91,7 @@ SDP.prototype.getMediaSsrcMap = function() {
91 91
         });
92 92
     }
93 93
 
94
-    return media_ssrcs;
94
+    return mediaSSRCs;
95 95
 };
96 96
 
97 97
 /**
@@ -123,7 +123,7 @@ SDP.prototype.mangle = function() {
123 123
     for (i = 0; i < this.media.length; i++) {
124 124
         lines = this.media[i].split('\r\n');
125 125
         lines.pop(); // remove empty last element
126
-        mline = SDPUtil.parse_mline(lines.shift());
126
+        mline = SDPUtil.parseMLine(lines.shift());
127 127
         if (mline.media !== 'audio') {
128 128
             continue; // eslint-disable-line no-continue
129 129
         }
@@ -131,7 +131,7 @@ SDP.prototype.mangle = function() {
131 131
         mline.fmt.length = 0;
132 132
         for (j = 0; j < lines.length; j++) {
133 133
             if (lines[j].substr(0, 9) === 'a=rtpmap:') {
134
-                rtpmap = SDPUtil.parse_rtpmap(lines[j]);
134
+                rtpmap = SDPUtil.parseRTPMap(lines[j]);
135 135
                 if (rtpmap.name === 'CN' || rtpmap.name === 'ISAC') {
136 136
                     continue; // eslint-disable-line no-continue
137 137
                 }
@@ -139,7 +139,7 @@ SDP.prototype.mangle = function() {
139 139
             }
140 140
             newdesc += `${lines[j]}\r\n`;
141 141
         }
142
-        this.media[i] = `${SDPUtil.build_mline(mline)}\r\n${newdesc}`;
142
+        this.media[i] = `${SDPUtil.buildMLine(mline)}\r\n${newdesc}`;
143 143
     }
144 144
     this.raw = this.session + this.media.join('');
145 145
 };
@@ -147,7 +147,7 @@ SDP.prototype.mangle = function() {
147 147
 // remove lines matching prefix from session section
148 148
 SDP.prototype.removeSessionLines = function(prefix) {
149 149
     const self = this;
150
-    const lines = SDPUtil.find_lines(this.session, prefix);
150
+    const lines = SDPUtil.findLines(this.session, prefix);
151 151
 
152 152
     lines.forEach(line => {
153 153
         self.session = self.session.replace(`${line}\r\n`, '');
@@ -161,7 +161,7 @@ SDP.prototype.removeSessionLines = function(prefix) {
161 161
 // TODO: non-numeric mediaindex could match mid
162 162
 SDP.prototype.removeMediaLines = function(mediaindex, prefix) {
163 163
     const self = this;
164
-    const lines = SDPUtil.find_lines(this.media[mediaindex], prefix);
164
+    const lines = SDPUtil.findLines(this.media[mediaindex], prefix);
165 165
 
166 166
     lines.forEach(line => {
167 167
         self.media[mediaindex]
@@ -178,7 +178,7 @@ SDP.prototype.toJingle = function(elem, thecreator) {
178 178
 
179 179
     // new bundle plan
180 180
 
181
-    lines = SDPUtil.find_lines(this.session, 'a=group:');
181
+    lines = SDPUtil.findLines(this.session, 'a=group:');
182 182
     if (lines.length) {
183 183
         for (i = 0; i < lines.length; i++) {
184 184
             tmp = lines[i].split(' ');
@@ -193,13 +193,13 @@ SDP.prototype.toJingle = function(elem, thecreator) {
193 193
         }
194 194
     }
195 195
     for (i = 0; i < this.media.length; i++) {
196
-        mline = SDPUtil.parse_mline(this.media[i].split('\r\n')[0]);
196
+        mline = SDPUtil.parseMLine(this.media[i].split('\r\n')[0]);
197 197
         if (!(mline.media === 'audio'
198 198
               || mline.media === 'video'
199 199
               || mline.media === 'application')) {
200 200
             continue; // eslint-disable-line no-continue
201 201
         }
202
-        const assrcline = SDPUtil.find_line(this.media[i], 'a=ssrc:');
202
+        const assrcline = SDPUtil.findLine(this.media[i], 'a=ssrc:');
203 203
 
204 204
         if (assrcline) {
205 205
             ssrc = assrcline.substring(7).split(' ')[0]; // take the first
@@ -209,16 +209,16 @@ SDP.prototype.toJingle = function(elem, thecreator) {
209 209
 
210 210
         elem.c('content', { creator: thecreator,
211 211
             name: mline.media });
212
-        const amidline = SDPUtil.find_line(this.media[i], 'a=mid:');
212
+        const amidline = SDPUtil.findLine(this.media[i], 'a=mid:');
213 213
 
214 214
         if (amidline) {
215 215
             // prefer identifier from a=mid if present
216
-            const mid = SDPUtil.parse_mid(amidline);
216
+            const mid = SDPUtil.parseMID(amidline);
217 217
 
218 218
             elem.attrs({ name: mid });
219 219
         }
220 220
 
221
-        if (SDPUtil.find_line(this.media[i], 'a=rtpmap:').length) {
221
+        if (SDPUtil.findLine(this.media[i], 'a=rtpmap:').length) {
222 222
             elem.c('description',
223 223
                 { xmlns: 'urn:xmpp:jingle:apps:rtp:1',
224 224
                     media: mline.media });
@@ -227,20 +227,20 @@ SDP.prototype.toJingle = function(elem, thecreator) {
227 227
             }
228 228
             for (j = 0; j < mline.fmt.length; j++) {
229 229
                 rtpmap
230
-                    = SDPUtil.find_line(
230
+                    = SDPUtil.findLine(
231 231
                         this.media[i],
232 232
                         `a=rtpmap:${mline.fmt[j]}`);
233
-                elem.c('payload-type', SDPUtil.parse_rtpmap(rtpmap));
233
+                elem.c('payload-type', SDPUtil.parseRTPMap(rtpmap));
234 234
 
235 235
                 // put any 'a=fmtp:' + mline.fmt[j] lines into <param name=foo
236 236
                 // value=bar/>
237 237
                 const afmtpline
238
-                    = SDPUtil.find_line(
238
+                    = SDPUtil.findLine(
239 239
                         this.media[i],
240 240
                         `a=fmtp:${mline.fmt[j]}`);
241 241
 
242 242
                 if (afmtpline) {
243
-                    tmp = SDPUtil.parse_fmtp(afmtpline);
243
+                    tmp = SDPUtil.parseFmtp(afmtpline);
244 244
                     for (k = 0; k < tmp.length; k++) {
245 245
                         elem.c('parameter', tmp[k]).up();
246 246
                     }
@@ -252,12 +252,12 @@ SDP.prototype.toJingle = function(elem, thecreator) {
252 252
                 elem.up();
253 253
             }
254 254
             const crypto
255
-                = SDPUtil.find_lines(this.media[i], 'a=crypto:', this.session);
255
+                = SDPUtil.findLines(this.media[i], 'a=crypto:', this.session);
256 256
 
257 257
             if (crypto.length) {
258 258
                 elem.c('encryption', { required: 1 });
259 259
                 crypto.forEach(
260
-                    line => elem.c('crypto', SDPUtil.parse_crypto(line)).up());
260
+                    line => elem.c('crypto', SDPUtil.parseCrypto(line)).up());
261 261
                 elem.up(); // end of encryption
262 262
             }
263 263
 
@@ -267,7 +267,7 @@ SDP.prototype.toJingle = function(elem, thecreator) {
267 267
                     xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
268 268
 
269 269
                 // FIXME: group by ssrc and support multiple different ssrcs
270
-                const ssrclines = SDPUtil.find_lines(this.media[i], 'a=ssrc:');
270
+                const ssrclines = SDPUtil.findLines(this.media[i], 'a=ssrc:');
271 271
 
272 272
                 if (ssrclines.length > 0) {
273 273
                     // eslint-disable-next-line no-loop-func
@@ -293,7 +293,7 @@ SDP.prototype.toJingle = function(elem, thecreator) {
293 293
 
294 294
                             let v = kv.split(':', 2)[1];
295 295
 
296
-                            v = SDPUtil.filter_special_chars(v);
296
+                            v = SDPUtil.filterSpecialChars(v);
297 297
                             elem.attrs({ value: v });
298 298
                         }
299 299
                         elem.up();
@@ -323,7 +323,7 @@ SDP.prototype.toJingle = function(elem, thecreator) {
323 323
                         msid = localTrack.getTrackId();
324 324
                     }
325 325
                     if (msid !== null) {
326
-                        msid = SDPUtil.filter_special_chars(msid);
326
+                        msid = SDPUtil.filterSpecialChars(msid);
327 327
                         elem.c('parameter');
328 328
                         elem.attrs({ name: 'msid',
329 329
                             value: msid });
@@ -341,10 +341,10 @@ SDP.prototype.toJingle = function(elem, thecreator) {
341 341
                 elem.up();
342 342
 
343 343
                 // XEP-0339 handle ssrc-group attributes
344
-                const ssrc_group_lines
345
-                    = SDPUtil.find_lines(this.media[i], 'a=ssrc-group:');
344
+                const ssrcGroupLines
345
+                    = SDPUtil.findLines(this.media[i], 'a=ssrc-group:');
346 346
 
347
-                ssrc_group_lines.forEach(line => {
347
+                ssrcGroupLines.forEach(line => {
348 348
                     const idx = line.indexOf(' ');
349 349
                     const semantics = line.substr(0, idx).substr(13);
350 350
                     const ssrcs = line.substr(14 + semantics.length).split(' ');
@@ -358,7 +358,7 @@ SDP.prototype.toJingle = function(elem, thecreator) {
358 358
                 });
359 359
             }
360 360
 
361
-            if (SDPUtil.find_line(this.media[i], 'a=rtcp-mux')) {
361
+            if (SDPUtil.findLine(this.media[i], 'a=rtcp-mux')) {
362 362
                 elem.c('rtcp-mux').up();
363 363
             }
364 364
 
@@ -366,10 +366,10 @@ SDP.prototype.toJingle = function(elem, thecreator) {
366 366
             this.rtcpFbToJingle(i, elem, '*');
367 367
 
368 368
             // XEP-0294
369
-            lines = SDPUtil.find_lines(this.media[i], 'a=extmap:');
369
+            lines = SDPUtil.findLines(this.media[i], 'a=extmap:');
370 370
             if (lines.length) {
371 371
                 for (j = 0; j < lines.length; j++) {
372
-                    tmp = SDPUtil.parse_extmap(lines[j]);
372
+                    tmp = SDPUtil.parseExtmap(lines[j]);
373 373
                     elem.c('rtp-hdrext', {
374 374
                         xmlns: 'urn:xmpp:jingle:apps:rtp:rtp-hdrext:0',
375 375
                         uri: tmp.uri,
@@ -404,13 +404,13 @@ SDP.prototype.toJingle = function(elem, thecreator) {
404 404
 
405 405
         const m = this.media[i];
406 406
 
407
-        if (SDPUtil.find_line(m, 'a=sendrecv', this.session)) {
407
+        if (SDPUtil.findLine(m, 'a=sendrecv', this.session)) {
408 408
             elem.attrs({ senders: 'both' });
409
-        } else if (SDPUtil.find_line(m, 'a=sendonly', this.session)) {
409
+        } else if (SDPUtil.findLine(m, 'a=sendonly', this.session)) {
410 410
             elem.attrs({ senders: 'initiator' });
411
-        } else if (SDPUtil.find_line(m, 'a=recvonly', this.session)) {
411
+        } else if (SDPUtil.findLine(m, 'a=recvonly', this.session)) {
412 412
             elem.attrs({ senders: 'responder' });
413
-        } else if (SDPUtil.find_line(m, 'a=inactive', this.session)) {
413
+        } else if (SDPUtil.findLine(m, 'a=inactive', this.session)) {
414 414
             elem.attrs({ senders: 'none' });
415 415
         }
416 416
         if (mline.port === '0') {
@@ -432,10 +432,10 @@ SDP.prototype.transportToJingle = function(mediaindex, elem) {
432 432
 
433 433
     // XEP-0343 DTLS/SCTP
434 434
     const sctpmap
435
-        = SDPUtil.find_line(this.media[mediaindex], 'a=sctpmap:', self.session);
435
+        = SDPUtil.findLine(this.media[mediaindex], 'a=sctpmap:', self.session);
436 436
 
437 437
     if (sctpmap) {
438
-        const sctpAttrs = SDPUtil.parse_sctpmap(sctpmap);
438
+        const sctpAttrs = SDPUtil.parseSCTPMap(sctpmap);
439 439
 
440 440
         elem.c('sctpmap', {
441 441
             xmlns: 'urn:xmpp:jingle:transports:dtls-sctp:1',
@@ -452,20 +452,20 @@ SDP.prototype.transportToJingle = function(mediaindex, elem) {
452 452
 
453 453
     // XEP-0320
454 454
     const fingerprints
455
-        = SDPUtil.find_lines(
455
+        = SDPUtil.findLines(
456 456
             this.media[mediaindex],
457 457
             'a=fingerprint:',
458 458
             this.session);
459 459
 
460 460
     fingerprints.forEach(line => {
461
-        tmp = SDPUtil.parse_fingerprint(line);
461
+        tmp = SDPUtil.parseFingerprint(line);
462 462
         tmp.xmlns = 'urn:xmpp:jingle:apps:dtls:0';
463 463
         elem.c('fingerprint').t(tmp.fingerprint);
464 464
         delete tmp.fingerprint;
465 465
 
466 466
         // eslint-disable-next-line no-param-reassign
467 467
         line
468
-            = SDPUtil.find_line(
468
+            = SDPUtil.findLine(
469 469
                 self.media[mediaindex],
470 470
                 'a=setup:',
471 471
                 self.session);
@@ -482,7 +482,7 @@ SDP.prototype.transportToJingle = function(mediaindex, elem) {
482 482
 
483 483
         // XEP-0176
484 484
         const lines
485
-            = SDPUtil.find_lines(
485
+            = SDPUtil.findLines(
486 486
                 this.media[mediaindex],
487 487
                 'a=candidate:',
488 488
                 this.session);
@@ -514,12 +514,12 @@ SDP.prototype.transportToJingle = function(mediaindex, elem) {
514 514
 // XEP-0293
515 515
 SDP.prototype.rtcpFbToJingle = function(mediaindex, elem, payloadtype) {
516 516
     const lines
517
-        = SDPUtil.find_lines(
517
+        = SDPUtil.findLines(
518 518
             this.media[mediaindex],
519 519
             `a=rtcp-fb:${payloadtype}`);
520 520
 
521 521
     lines.forEach(line => {
522
-        const tmp = SDPUtil.parse_rtcpfb(line);
522
+        const tmp = SDPUtil.parseRTCPFB(line);
523 523
 
524 524
         if (tmp.type === 'trr-int') {
525 525
             elem.c('rtcp-fb-trr-int', {
@@ -608,7 +608,7 @@ SDP.prototype.fromJingle = function(jingle) {
608 608
 
609 609
     // reconstruct msid-semantic -- apparently not necessary
610 610
     /*
611
-     var msid = SDPUtil.parse_ssrc(this.raw);
611
+     var msid = SDPUtil.parseSSRC(this.raw);
612 612
      if (msid.hasOwnProperty('mslabel')) {
613 613
      this.session += "a=msid-semantic: WMS " + msid.mslabel + "\r\n";
614 614
      }
@@ -657,7 +657,7 @@ SDP.prototype.jingle2media = function(content) {
657 657
                     return this.getAttribute('id');
658 658
                 })
659 659
                 .get();
660
-        media += `${SDPUtil.build_mline(tmp)}\r\n`;
660
+        media += `${SDPUtil.buildMLine(tmp)}\r\n`;
661 661
     }
662 662
 
663 663
     media += 'c=IN IP4 0.0.0.0\r\n';
@@ -669,10 +669,10 @@ SDP.prototype.jingle2media = function(content) {
669 669
             '>transport[xmlns="urn:xmpp:jingle:transports:ice-udp:1"]');
670 670
     if (tmp.length) {
671 671
         if (tmp.attr('ufrag')) {
672
-            media += `${SDPUtil.build_iceufrag(tmp.attr('ufrag'))}\r\n`;
672
+            media += `${SDPUtil.buildICEUfrag(tmp.attr('ufrag'))}\r\n`;
673 673
         }
674 674
         if (tmp.attr('pwd')) {
675
-            media += `${SDPUtil.build_icepwd(tmp.attr('pwd'))}\r\n`;
675
+            media += `${SDPUtil.buildICEPwd(tmp.attr('pwd'))}\r\n`;
676 676
         }
677 677
         tmp.find('>fingerprint').each(function() {
678 678
             // FIXME: check namespace at some point
@@ -720,7 +720,7 @@ SDP.prototype.jingle2media = function(content) {
720 720
         });
721 721
     }
722 722
     desc.find('payload-type').each(function() {
723
-        media += `${SDPUtil.build_rtpmap(this)}\r\n`;
723
+        media += `${SDPUtil.buildRTPMap(this)}\r\n`;
724 724
         if ($(this).find('>parameter').length) {
725 725
             media += `a=fmtp:${this.getAttribute('id')} `;
726 726
             media
@@ -803,7 +803,7 @@ SDP.prototype.jingle2media = function(content) {
803 803
             const name = this.getAttribute('name');
804 804
             let value = this.getAttribute('value');
805 805
 
806
-            value = SDPUtil.filter_special_chars(value);
806
+            value = SDPUtil.filterSpecialChars(value);
807 807
             media += `a=ssrc:${ssrc} ${name}`;
808 808
             if (value && value.length) {
809 809
                 media += `:${value}`;

+ 1
- 1
modules/xmpp/SDPDiffer.js Vedi File

@@ -148,7 +148,7 @@ SDPDiffer.prototype.toJingle = function(modify) {
148 148
                 } else {
149 149
                     const nv = kv.split(':', 2);
150 150
                     const name = nv[0];
151
-                    const value = SDPUtil.filter_special_chars(nv[1]);
151
+                    const value = SDPUtil.filterSpecialChars(nv[1]);
152 152
 
153 153
                     modify.attrs({ name });
154 154
                     modify.attrs({ value });

+ 26
- 26
modules/xmpp/SDPUtil.js Vedi File

@@ -5,7 +5,7 @@ import RandomUtil from '../util/RandomUtil';
5 5
 const RTCBrowserType = require('../RTC/RTCBrowserType');
6 6
 
7 7
 const SDPUtil = {
8
-    filter_special_chars(text) {
8
+    filterSpecialChars(text) {
9 9
         // XXX Neither one of the falsy values (e.g. null, undefined, false,
10 10
         // "", etc.) "contain" special chars.
11 11
         // eslint-disable-next-line no-useless-escape
@@ -15,36 +15,36 @@ const SDPUtil = {
15 15
         let data = null;
16 16
         let pwd, ufrag;
17 17
 
18
-        if ((ufrag = SDPUtil.find_line(mediadesc, 'a=ice-ufrag:', sessiondesc))
18
+        if ((ufrag = SDPUtil.findLine(mediadesc, 'a=ice-ufrag:', sessiondesc))
19 19
                 && (pwd
20
-                    = SDPUtil.find_line(
20
+                    = SDPUtil.findLine(
21 21
                         mediadesc,
22 22
                         'a=ice-pwd:',
23 23
                         sessiondesc))) {
24 24
             data = {
25
-                ufrag: SDPUtil.parse_iceufrag(ufrag),
26
-                pwd: SDPUtil.parse_icepwd(pwd)
25
+                ufrag: SDPUtil.parseICEUfrag(ufrag),
26
+                pwd: SDPUtil.parseICEPwd(pwd)
27 27
             };
28 28
         }
29 29
 
30 30
         return data;
31 31
     },
32
-    parse_iceufrag(line) {
32
+    parseICEUfrag(line) {
33 33
         return line.substring(12);
34 34
     },
35
-    build_iceufrag(frag) {
35
+    buildICEUfrag(frag) {
36 36
         return `a=ice-ufrag:${frag}`;
37 37
     },
38
-    parse_icepwd(line) {
38
+    parseICEPwd(line) {
39 39
         return line.substring(10);
40 40
     },
41
-    build_icepwd(pwd) {
41
+    buildICEPwd(pwd) {
42 42
         return `a=ice-pwd:${pwd}`;
43 43
     },
44
-    parse_mid(line) {
44
+    parseMID(line) {
45 45
         return line.substring(6);
46 46
     },
47
-    parse_mline(line) {
47
+    parseMLine(line) {
48 48
         const data = {};
49 49
         const parts = line.substring(2).split(' ');
50 50
 
@@ -58,12 +58,12 @@ const SDPUtil = {
58 58
 
59 59
         return data;
60 60
     },
61
-    build_mline(mline) {
61
+    buildMLine(mline) {
62 62
         return (
63 63
             `m=${mline.media} ${mline.port} ${mline.proto} ${
64 64
                 mline.fmt.join(' ')}`);
65 65
     },
66
-    parse_rtpmap(line) {
66
+    parseRTPMap(line) {
67 67
         const data = {};
68 68
         let parts = line.substring(9).split(' ');
69 69
 
@@ -81,7 +81,7 @@ const SDPUtil = {
81 81
      * @param line eg. "a=sctpmap:5000 webrtc-datachannel"
82 82
      * @returns [SCTP port number, protocol, streams]
83 83
      */
84
-    parse_sctpmap(line) {
84
+    parseSCTPMap(line) {
85 85
         const parts = line.substring(10).split(' ');
86 86
         const sctpPort = parts[0];
87 87
         const protocol = parts[1];
@@ -92,7 +92,7 @@ const SDPUtil = {
92 92
 
93 93
         return [ sctpPort, protocol, streamCount ];// SCTP port
94 94
     },
95
-    build_rtpmap(el) {
95
+    buildRTPMap(el) {
96 96
         let line
97 97
             = `a=rtpmap:${el.getAttribute('id')} ${el.getAttribute('name')}/${
98 98
                 el.getAttribute('clockrate')}`;
@@ -104,7 +104,7 @@ const SDPUtil = {
104 104
 
105 105
         return line;
106 106
     },
107
-    parse_crypto(line) {
107
+    parseCrypto(line) {
108 108
         const data = {};
109 109
         const parts = line.substring(9).split(' ');
110 110
 
@@ -117,7 +117,7 @@ const SDPUtil = {
117 117
 
118 118
         return data;
119 119
     },
120
-    parse_fingerprint(line) { // RFC 4572
120
+    parseFingerprint(line) { // RFC 4572
121 121
         const data = {};
122 122
         const parts = line.substring(14).split(' ');
123 123
 
@@ -127,7 +127,7 @@ const SDPUtil = {
127 127
         // TODO assert that fingerprint satisfies 2UHEX *(":" 2UHEX) ?
128 128
         return data;
129 129
     },
130
-    parse_fmtp(line) {
130
+    parseFmtp(line) {
131 131
         const data = [];
132 132
         let parts = line.split(' ');
133 133
 
@@ -153,7 +153,7 @@ const SDPUtil = {
153 153
 
154 154
         return data;
155 155
     },
156
-    parse_icecandidate(line) {
156
+    parseICECandidate(line) {
157 157
         const candidate = {};
158 158
         const elems = line.split(' ');
159 159
 
@@ -183,7 +183,7 @@ const SDPUtil = {
183 183
                 break;
184 184
             default: // TODO
185 185
                 logger.log(
186
-                    `parse_icecandidate not translating "${
186
+                    `parseICECandidate not translating "${
187 187
                         elems[i]}" = "${elems[i + 1]}"`);
188 188
             }
189 189
         }
@@ -195,7 +195,7 @@ const SDPUtil = {
195 195
 
196 196
         return candidate;
197 197
     },
198
-    build_icecandidate(cand) {
198
+    buildICECandidate(cand) {
199 199
         let line = [
200 200
             `a=candidate:${cand.foundation}`,
201 201
             cand.component,
@@ -237,7 +237,7 @@ const SDPUtil = {
237 237
 
238 238
         return line;
239 239
     },
240
-    parse_ssrc(desc) {
240
+    parseSSRC(desc) {
241 241
         // proprietary mapping of a=ssrc lines
242 242
         // TODO: see "Jingle RTP Source Description" by Juberti and P. Thatcher
243 243
         // on google docs and parse according to that
@@ -255,7 +255,7 @@ const SDPUtil = {
255 255
 
256 256
         return data;
257 257
     },
258
-    parse_rtcpfb(line) {
258
+    parseRTCPFB(line) {
259 259
         const parts = line.substr(10).split(' ');
260 260
         const data = {};
261 261
 
@@ -265,7 +265,7 @@ const SDPUtil = {
265 265
 
266 266
         return data;
267 267
     },
268
-    parse_extmap(line) {
268
+    parseExtmap(line) {
269 269
         const parts = line.substr(9).split(' ');
270 270
         const data = {};
271 271
 
@@ -281,7 +281,7 @@ const SDPUtil = {
281 281
 
282 282
         return data;
283 283
     },
284
-    find_line(haystack, needle, sessionpart) {
284
+    findLine(haystack, needle, sessionpart) {
285 285
         let lines = haystack.split('\r\n');
286 286
 
287 287
         for (let i = 0; i < lines.length; i++) {
@@ -303,7 +303,7 @@ const SDPUtil = {
303 303
 
304 304
         return false;
305 305
     },
306
-    find_lines(haystack, needle, sessionpart) {
306
+    findLines(haystack, needle, sessionpart) {
307 307
         let lines = haystack.split('\r\n');
308 308
         const needles = [];
309 309
 

+ 1
- 1
modules/xmpp/SDPUtil.spec.js Vedi File

@@ -4,7 +4,7 @@ import * as SampleSdpStrings from './SampleSdpStrings.js';
4 4
 describe('SDPUtil', () => {
5 5
     it('should parse an ice ufrag correctly', () => {
6 6
         const line = 'a=ice-ufrag:3jlcc1b3j1rqt6';
7
-        const parsed = SDPUtil.parse_iceufrag(line);
7
+        const parsed = SDPUtil.parseICEUfrag(line);
8 8
 
9 9
         expect(parsed).toEqual('3jlcc1b3j1rqt6');
10 10
     });

+ 5
- 5
modules/xmpp/strophe.jingle.js Vedi File

@@ -19,8 +19,8 @@ class JingleConnectionPlugin extends ConnectionPlugin {
19 19
         this.xmpp = xmpp;
20 20
         this.eventEmitter = eventEmitter;
21 21
         this.sessions = {};
22
-        this.ice_config = { iceServers: [] };
23
-        this.media_constraints = {
22
+        this.iceConfig = { iceServers: [] };
23
+        this.mediaConstraints = {
24 24
             mandatory: {
25 25
                 'OfferToReceiveAudio': true,
26 26
                 'OfferToReceiveVideo': true
@@ -119,8 +119,8 @@ class JingleConnectionPlugin extends ConnectionPlugin {
119 119
                         $(iq).attr('to'),
120 120
                         fromJid,
121 121
                         this.connection,
122
-                        this.media_constraints,
123
-                        this.ice_config, this.xmpp.options);
122
+                        this.mediaConstraints,
123
+                        this.iceConfig, this.xmpp.options);
124 124
 
125 125
             this.sessions[sess.sid] = sess;
126 126
 
@@ -271,7 +271,7 @@ class JingleConnectionPlugin extends ConnectionPlugin {
271 271
                     }
272 272
                     }
273 273
                 });
274
-                this.ice_config.iceServers = iceservers;
274
+                this.iceConfig.iceServers = iceservers;
275 275
             }, err => {
276 276
                 logger.warn('getting turn credentials failed', err);
277 277
                 logger.warn('is mod_turncredentials or similar installed?');

+ 4
- 4
modules/xmpp/strophe.logger.js Vedi File

@@ -12,15 +12,15 @@ class StropheLogger extends ConnectionPlugin {
12 12
 
13 13
     init(connection) {
14 14
         super.init(connection);
15
-        this.connection.rawInput = this.log_incoming.bind(this);
16
-        this.connection.rawOutput = this.log_outgoing.bind(this);
15
+        this.connection.rawInput = this.logIncoming.bind(this);
16
+        this.connection.rawOutput = this.logOutgoing.bind(this);
17 17
     }
18 18
 
19
-    log_incoming(stanza) {
19
+    logIncoming(stanza) {
20 20
         this.log.push([ new Date().getTime(), 'incoming', stanza ]);
21 21
     }
22 22
 
23
-    log_outgoing(stanza) {
23
+    logOutgoing(stanza) {
24 24
         this.log.push([ new Date().getTime(), 'outgoing', stanza ]);
25 25
     }
26 26
 }

+ 6
- 6
modules/xmpp/strophe.rayo.js Vedi File

@@ -54,8 +54,8 @@ class RayoConnectionPlugin extends ConnectionPlugin {
54 54
                 // eslint-disable-next-line newline-per-chained-call
55 55
                 const resource = $(result).find('ref').attr('uri');
56 56
 
57
-                this.call_resource = resource.substr('xmpp:'.length);
58
-                logger.info(`Received call resource: ${this.call_resource}`);
57
+                this.callResource = resource.substr('xmpp:'.length);
58
+                logger.info(`Received call resource: ${this.callResource}`);
59 59
                 resolve();
60 60
             }, error => {
61 61
                 logger.info('Dial error ', error);
@@ -66,7 +66,7 @@ class RayoConnectionPlugin extends ConnectionPlugin {
66 66
 
67 67
     hangup() {
68 68
         return new Promise((resolve, reject) => {
69
-            if (!this.call_resource) {
69
+            if (!this.callResource) {
70 70
                 reject(new Error('No call in progress'));
71 71
                 logger.warn('No call in progress');
72 72
 
@@ -75,7 +75,7 @@ class RayoConnectionPlugin extends ConnectionPlugin {
75 75
 
76 76
             const req = $iq({
77 77
                 type: 'set',
78
-                to: this.call_resource
78
+                to: this.callResource
79 79
             });
80 80
 
81 81
             req.c('hangup', {
@@ -84,11 +84,11 @@ class RayoConnectionPlugin extends ConnectionPlugin {
84 84
 
85 85
             this.connection.sendIQ(req, result => {
86 86
                 logger.info('Hangup result ', result);
87
-                this.call_resource = null;
87
+                this.callResource = null;
88 88
                 resolve();
89 89
             }, error => {
90 90
                 logger.info('Hangup error ', error);
91
-                this.call_resource = null;
91
+                this.callResource = null;
92 92
                 reject(new Error('Hangup error '));
93 93
             });
94 94
         });

Loading…
Annulla
Salva