Преглед на файлове

Renames JingleSession to JingleSessionPC.

j8
Boris Grozev преди 10 години
родител
ревизия
6ca1e131af
променени са 2 файла, в които са добавени 39 реда и са изтрити 39 реда
  1. 38
    38
      modules/xmpp/JingleSessionPC.js
  2. 1
    1
      modules/xmpp/strophe.jingle.js

modules/xmpp/JingleSession.js → modules/xmpp/JingleSessionPC.js Целия файл

10
 var SSRCReplacement = require("./LocalSSRCReplacement");
10
 var SSRCReplacement = require("./LocalSSRCReplacement");
11
 
11
 
12
 // Jingle stuff
12
 // Jingle stuff
13
-function JingleSession(me, sid, connection, service, eventEmitter) {
13
+function JingleSessionPC(me, sid, connection, service, eventEmitter) {
14
     this.me = me;
14
     this.me = me;
15
     this.sid = sid;
15
     this.sid = sid;
16
     this.connection = connection;
16
     this.connection = connection;
66
     this.modifySourcesQueue.pause();
66
     this.modifySourcesQueue.pause();
67
 }
67
 }
68
 
68
 
69
-JingleSession.prototype.updateModifySourcesQueue = function() {
69
+JingleSessionPC.prototype.updateModifySourcesQueue = function() {
70
     var signalingState = this.peerconnection.signalingState;
70
     var signalingState = this.peerconnection.signalingState;
71
     var iceConnectionState = this.peerconnection.iceConnectionState;
71
     var iceConnectionState = this.peerconnection.iceConnectionState;
72
     if (signalingState === 'stable' && iceConnectionState === 'connected') {
72
     if (signalingState === 'stable' && iceConnectionState === 'connected') {
76
     }
76
     }
77
 };
77
 };
78
 
78
 
79
-JingleSession.prototype.initiate = function (peerjid, isInitiator) {
79
+JingleSessionPC.prototype.initiate = function (peerjid, isInitiator) {
80
     var self = this;
80
     var self = this;
81
     if (this.state !== null) {
81
     if (this.state !== null) {
82
         console.error('attempt to initiate on session ' + this.sid +
82
         console.error('attempt to initiate on session ' + this.sid +
211
     }
211
     }
212
 }
212
 }
213
 
213
 
214
-JingleSession.prototype.accept = function () {
214
+JingleSessionPC.prototype.accept = function () {
215
     this.state = 'active';
215
     this.state = 'active';
216
 
216
 
217
     var pranswer = this.peerconnection.localDescription;
217
     var pranswer = this.peerconnection.localDescription;
268
                         reason: $(stanza).find('error :first')[0].tagName
268
                         reason: $(stanza).find('error :first')[0].tagName
269
                     }:{};
269
                     }:{};
270
                     error.source = 'answer';
270
                     error.source = 'answer';
271
-                    JingleSession.onJingleError(self.sid, error);
271
+                    JingleSessionPC.onJingleError(self.sid, error);
272
                 },
272
                 },
273
                 10000);
273
                 10000);
274
         },
274
         },
279
     );
279
     );
280
 };
280
 };
281
 
281
 
282
-JingleSession.prototype.terminate = function (reason) {
282
+JingleSessionPC.prototype.terminate = function (reason) {
283
     this.state = 'ended';
283
     this.state = 'ended';
284
     this.reason = reason;
284
     this.reason = reason;
285
     this.peerconnection.close();
285
     this.peerconnection.close();
289
     }
289
     }
290
 };
290
 };
291
 
291
 
292
-JingleSession.prototype.active = function () {
292
+JingleSessionPC.prototype.active = function () {
293
     return this.state == 'active';
293
     return this.state == 'active';
294
 };
294
 };
295
 
295
 
296
-JingleSession.prototype.sendIceCandidate = function (candidate) {
296
+JingleSessionPC.prototype.sendIceCandidate = function (candidate) {
297
     var self = this;
297
     var self = this;
298
     if (candidate && !this.lasticecandidate) {
298
     if (candidate && !this.lasticecandidate) {
299
         var ice = SDPUtil.iceparams(this.localSDP.media[candidate.sdpMLineIndex], this.localSDP.session);
299
         var ice = SDPUtil.iceparams(this.localSDP.media[candidate.sdpMLineIndex], this.localSDP.session);
365
                             reason: $(stanza).find('error :first')[0].tagName,
365
                             reason: $(stanza).find('error :first')[0].tagName,
366
                         }:{};
366
                         }:{};
367
                         error.source = 'offer';
367
                         error.source = 'offer';
368
-                        JingleSession.onJingleError(self.sid, error);
368
+                        JingleSessionPC.onJingleError(self.sid, error);
369
                     },
369
                     },
370
                     10000);
370
                     10000);
371
             }
371
             }
381
     }
381
     }
382
 };
382
 };
383
 
383
 
384
-JingleSession.prototype.sendIceCandidates = function (candidates) {
384
+JingleSessionPC.prototype.sendIceCandidates = function (candidates) {
385
     console.log('sendIceCandidates', candidates);
385
     console.log('sendIceCandidates', candidates);
386
     var cand = $iq({to: this.peerjid, type: 'set'})
386
     var cand = $iq({to: this.peerjid, type: 'set'})
387
         .c('jingle', {xmlns: 'urn:xmpp:jingle:1',
387
         .c('jingle', {xmlns: 'urn:xmpp:jingle:1',
430
                 reason: $(stanza).find('error :first')[0].tagName,
430
                 reason: $(stanza).find('error :first')[0].tagName,
431
             }:{};
431
             }:{};
432
             error.source = 'transportinfo';
432
             error.source = 'transportinfo';
433
-            JingleSession.onJingleError(this.sid, error);
433
+            JingleSessionPC.onJingleError(this.sid, error);
434
         },
434
         },
435
         10000);
435
         10000);
436
 };
436
 };
437
 
437
 
438
 
438
 
439
-JingleSession.prototype.sendOffer = function () {
439
+JingleSessionPC.prototype.sendOffer = function () {
440
     //console.log('sendOffer...');
440
     //console.log('sendOffer...');
441
     var self = this;
441
     var self = this;
442
     this.peerconnection.createOffer(function (sdp) {
442
     this.peerconnection.createOffer(function (sdp) {
450
 };
450
 };
451
 
451
 
452
 // FIXME createdOffer is never used in jitsi-meet
452
 // FIXME createdOffer is never used in jitsi-meet
453
-JingleSession.prototype.createdOffer = function (sdp) {
453
+JingleSessionPC.prototype.createdOffer = function (sdp) {
454
     //console.log('createdOffer', sdp);
454
     //console.log('createdOffer', sdp);
455
     var self = this;
455
     var self = this;
456
     this.localSDP = new SDP(sdp.sdp);
456
     this.localSDP = new SDP(sdp.sdp);
483
                     reason: $(stanza).find('error :first')[0].tagName,
483
                     reason: $(stanza).find('error :first')[0].tagName,
484
                 }:{};
484
                 }:{};
485
                 error.source = 'offer';
485
                 error.source = 'offer';
486
-                JingleSession.onJingleError(self.sid, error);
486
+                JingleSessionPC.onJingleError(self.sid, error);
487
             },
487
             },
488
             10000);
488
             10000);
489
     }
489
     }
513
     }
513
     }
514
 };
514
 };
515
 
515
 
516
-JingleSession.prototype.readSsrcInfo = function (contents) {
516
+JingleSessionPC.prototype.readSsrcInfo = function (contents) {
517
     var self = this;
517
     var self = this;
518
     $(contents).each(function (idx, content) {
518
     $(contents).each(function (idx, content) {
519
         var name = $(content).attr('name');
519
         var name = $(content).attr('name');
531
     });
531
     });
532
 };
532
 };
533
 
533
 
534
-JingleSession.prototype.getSsrcOwner = function (ssrc) {
534
+JingleSessionPC.prototype.getSsrcOwner = function (ssrc) {
535
     return this.ssrcOwners[ssrc];
535
     return this.ssrcOwners[ssrc];
536
 };
536
 };
537
 
537
 
538
-JingleSession.prototype.setRemoteDescription = function (elem, desctype) {
538
+JingleSessionPC.prototype.setRemoteDescription = function (elem, desctype) {
539
     //console.log('setting remote description... ', desctype);
539
     //console.log('setting remote description... ', desctype);
540
     this.remoteSDP = new SDP('');
540
     this.remoteSDP = new SDP('');
541
     this.remoteSDP.fromJingle(elem);
541
     this.remoteSDP.fromJingle(elem);
575
         },
575
         },
576
         function (e) {
576
         function (e) {
577
             console.error('setRemoteDescription error', e);
577
             console.error('setRemoteDescription error', e);
578
-            JingleSession.onJingleFatalError(self, e);
578
+            JingleSessionPC.onJingleFatalError(self, e);
579
         }
579
         }
580
     );
580
     );
581
 };
581
 };
582
 
582
 
583
-JingleSession.prototype.addIceCandidate = function (elem) {
583
+JingleSessionPC.prototype.addIceCandidate = function (elem) {
584
     var self = this;
584
     var self = this;
585
     if (this.peerconnection.signalingState == 'closed') {
585
     if (this.peerconnection.signalingState == 'closed') {
586
         return;
586
         return;
688
     });
688
     });
689
 };
689
 };
690
 
690
 
691
-JingleSession.prototype.sendAnswer = function (provisional) {
691
+JingleSessionPC.prototype.sendAnswer = function (provisional) {
692
     //console.log('createAnswer', provisional);
692
     //console.log('createAnswer', provisional);
693
     var self = this;
693
     var self = this;
694
     this.peerconnection.createAnswer(
694
     this.peerconnection.createAnswer(
703
     );
703
     );
704
 };
704
 };
705
 
705
 
706
-JingleSession.prototype.createdAnswer = function (sdp, provisional) {
706
+JingleSessionPC.prototype.createdAnswer = function (sdp, provisional) {
707
     //console.log('createAnswer callback');
707
     //console.log('createAnswer callback');
708
     var self = this;
708
     var self = this;
709
     this.localSDP = new SDP(sdp.sdp);
709
     this.localSDP = new SDP(sdp.sdp);
747
                             reason: $(stanza).find('error :first')[0].tagName,
747
                             reason: $(stanza).find('error :first')[0].tagName,
748
                         }:{};
748
                         }:{};
749
                         error.source = 'answer';
749
                         error.source = 'answer';
750
-                        JingleSession.onJingleError(self.sid, error);
750
+                        JingleSessionPC.onJingleError(self.sid, error);
751
                     },
751
                     },
752
                     10000);
752
                     10000);
753
     }
753
     }
777
     }
777
     }
778
 };
778
 };
779
 
779
 
780
-JingleSession.prototype.sendTerminate = function (reason, text) {
780
+JingleSessionPC.prototype.sendTerminate = function (reason, text) {
781
     var self = this,
781
     var self = this,
782
         term = $iq({to: this.peerjid,
782
         term = $iq({to: this.peerjid,
783
             type: 'set'})
783
             type: 'set'})
815
     }
815
     }
816
 };
816
 };
817
 
817
 
818
-JingleSession.prototype.addSource = function (elem, fromJid) {
818
+JingleSessionPC.prototype.addSource = function (elem, fromJid) {
819
 
819
 
820
     var self = this;
820
     var self = this;
821
     // FIXME: dirty waiting
821
     // FIXME: dirty waiting
897
     });
897
     });
898
 };
898
 };
899
 
899
 
900
-JingleSession.prototype.removeSource = function (elem, fromJid) {
900
+JingleSessionPC.prototype.removeSource = function (elem, fromJid) {
901
 
901
 
902
     var self = this;
902
     var self = this;
903
     // FIXME: dirty waiting
903
     // FIXME: dirty waiting
968
     });
968
     });
969
 };
969
 };
970
 
970
 
971
-JingleSession.prototype._modifySources = function (successCallback, queueCallback) {
971
+JingleSessionPC.prototype._modifySources = function (successCallback, queueCallback) {
972
     var self = this;
972
     var self = this;
973
 
973
 
974
     if (this.peerconnection.signalingState == 'closed') return;
974
     if (this.peerconnection.signalingState == 'closed') return;
1074
  * @param oldStream old video stream of this session.
1074
  * @param oldStream old video stream of this session.
1075
  * @param success_callback callback executed after successful stream switch.
1075
  * @param success_callback callback executed after successful stream switch.
1076
  */
1076
  */
1077
-JingleSession.prototype.switchStreams = function (new_stream, oldStream, success_callback, isAudio) {
1077
+JingleSessionPC.prototype.switchStreams = function (new_stream, oldStream, success_callback, isAudio) {
1078
 
1078
 
1079
     var self = this;
1079
     var self = this;
1080
 
1080
 
1112
  * @param old_sdp SDP object for old description.
1112
  * @param old_sdp SDP object for old description.
1113
  * @param new_sdp SDP object for new description.
1113
  * @param new_sdp SDP object for new description.
1114
  */
1114
  */
1115
-JingleSession.prototype.notifyMySSRCUpdate = function (old_sdp, new_sdp) {
1115
+JingleSessionPC.prototype.notifyMySSRCUpdate = function (old_sdp, new_sdp) {
1116
 
1116
 
1117
     if (!(this.peerconnection.signalingState == 'stable' &&
1117
     if (!(this.peerconnection.signalingState == 'stable' &&
1118
         this.peerconnection.iceConnectionState == 'connected')){
1118
         this.peerconnection.iceConnectionState == 'connected')){
1197
  * specifies whether the method was initiated in response to a user command (in
1197
  * specifies whether the method was initiated in response to a user command (in
1198
  * contrast to an automatic decision made by the application logic)
1198
  * contrast to an automatic decision made by the application logic)
1199
  */
1199
  */
1200
-JingleSession.prototype.setVideoMute = function (mute, callback, options) {
1200
+JingleSessionPC.prototype.setVideoMute = function (mute, callback, options) {
1201
     var byUser;
1201
     var byUser;
1202
 
1202
 
1203
     if (options) {
1203
     if (options) {
1237
     });
1237
     });
1238
 };
1238
 };
1239
 
1239
 
1240
-JingleSession.prototype.hardMuteVideo = function (muted) {
1240
+JingleSessionPC.prototype.hardMuteVideo = function (muted) {
1241
     this.pendingop = muted ? 'mute' : 'unmute';
1241
     this.pendingop = muted ? 'mute' : 'unmute';
1242
 };
1242
 };
1243
 
1243
 
1244
-JingleSession.prototype.sendMute = function (muted, content) {
1244
+JingleSessionPC.prototype.sendMute = function (muted, content) {
1245
     var info = $iq({to: this.peerjid,
1245
     var info = $iq({to: this.peerjid,
1246
         type: 'set'})
1246
         type: 'set'})
1247
         .c('jingle', {xmlns: 'urn:xmpp:jingle:1',
1247
         .c('jingle', {xmlns: 'urn:xmpp:jingle:1',
1256
     this.connection.send(info);
1256
     this.connection.send(info);
1257
 };
1257
 };
1258
 
1258
 
1259
-JingleSession.prototype.sendRinging = function () {
1259
+JingleSessionPC.prototype.sendRinging = function () {
1260
     var info = $iq({to: this.peerjid,
1260
     var info = $iq({to: this.peerjid,
1261
         type: 'set'})
1261
         type: 'set'})
1262
         .c('jingle', {xmlns: 'urn:xmpp:jingle:1',
1262
         .c('jingle', {xmlns: 'urn:xmpp:jingle:1',
1267
     this.connection.send(info);
1267
     this.connection.send(info);
1268
 };
1268
 };
1269
 
1269
 
1270
-JingleSession.prototype.getStats = function (interval) {
1270
+JingleSessionPC.prototype.getStats = function (interval) {
1271
     var self = this;
1271
     var self = this;
1272
     var recv = {audio: 0, video: 0};
1272
     var recv = {audio: 0, video: 0};
1273
     var lost = {audio: 0, video: 0};
1273
     var lost = {audio: 0, video: 0};
1313
     return this.statsinterval;
1313
     return this.statsinterval;
1314
 };
1314
 };
1315
 
1315
 
1316
-JingleSession.onJingleError = function (session, error)
1316
+JingleSessionPC.onJingleError = function (session, error)
1317
 {
1317
 {
1318
     console.error("Jingle error", error);
1318
     console.error("Jingle error", error);
1319
 }
1319
 }
1320
 
1320
 
1321
-JingleSession.onJingleFatalError = function (session, error)
1321
+JingleSessionPC.onJingleFatalError = function (session, error)
1322
 {
1322
 {
1323
     this.service.sessionTerminated = true;
1323
     this.service.sessionTerminated = true;
1324
     this.connection.emuc.doLeave();
1324
     this.connection.emuc.doLeave();
1326
     this.eventEmitter.emit(XMPPEvents.JINGLE_FATAL_ERROR, session, error);
1326
     this.eventEmitter.emit(XMPPEvents.JINGLE_FATAL_ERROR, session, error);
1327
 }
1327
 }
1328
 
1328
 
1329
-JingleSession.prototype.setLocalDescription = function () {
1329
+JingleSessionPC.prototype.setLocalDescription = function () {
1330
     var self = this;
1330
     var self = this;
1331
     var newssrcs = [];
1331
     var newssrcs = [];
1332
     var session = transform.parse(this.peerconnection.localDescription.sdp);
1332
     var session = transform.parse(this.peerconnection.localDescription.sdp);
1401
 }
1401
 }
1402
 
1402
 
1403
 
1403
 
1404
-JingleSession.prototype.remoteStreamAdded = function (data, times) {
1404
+JingleSessionPC.prototype.remoteStreamAdded = function (data, times) {
1405
     var self = this;
1405
     var self = this;
1406
     var thessrc;
1406
     var thessrc;
1407
     var streamId = APP.RTC.getStreamID(data.stream);
1407
     var streamId = APP.RTC.getStreamID(data.stream);
1453
     }
1453
     }
1454
 }
1454
 }
1455
 
1455
 
1456
-module.exports = JingleSession;
1456
+module.exports = JingleSessionPC;

+ 1
- 1
modules/xmpp/strophe.jingle.js Целия файл

1
 /* jshint -W117 */
1
 /* jshint -W117 */
2
 
2
 
3
-var JingleSession = require("./JingleSession");
3
+var JingleSession = require("./JingleSessionPC");
4
 var XMPPEvents = require("../../service/xmpp/XMPPEvents");
4
 var XMPPEvents = require("../../service/xmpp/XMPPEvents");
5
 var RTCBrowserType = require("../RTC/RTCBrowserType");
5
 var RTCBrowserType = require("../RTC/RTCBrowserType");
6
 
6
 

Loading…
Отказ
Запис