|
|
@@ -7,7 +7,6 @@ var SDPDiffer = require("./SDPDiffer");
|
|
7
|
7
|
var SDPUtil = require("./SDPUtil");
|
|
8
|
8
|
var SDP = require("./SDP");
|
|
9
|
9
|
var async = require("async");
|
|
10
|
|
-var transform = require("sdp-transform");
|
|
11
|
10
|
var XMPPEvents = require("../../service/xmpp/XMPPEvents");
|
|
12
|
11
|
var RTCBrowserType = require("../RTC/RTCBrowserType");
|
|
13
|
12
|
var RTC = require("../RTC/RTC");
|
|
|
@@ -39,11 +38,6 @@ function JingleSessionPC(me, sid, connection, service) {
|
|
39
|
38
|
this.modifyingLocalStreams = false;
|
|
40
|
39
|
this.modifiedSSRCs = {};
|
|
41
|
40
|
|
|
42
|
|
- /**
|
|
43
|
|
- * A map that stores SSRCs of local streams
|
|
44
|
|
- * @type {{}} maps media type('audio' or 'video') to SSRC number
|
|
45
|
|
- */
|
|
46
|
|
- this.localStreamsSSRC = {};
|
|
47
|
41
|
/**
|
|
48
|
42
|
* A map that stores SSRCs of remote streams. And is used only locally
|
|
49
|
43
|
* We store the mapping when jingle is received, and later is used
|
|
|
@@ -271,9 +265,6 @@ JingleSessionPC.prototype.accept = function () {
|
|
271
|
265
|
var self = this;
|
|
272
|
266
|
this.peerconnection.setLocalDescription(new RTCSessionDescription({type: 'answer', sdp: sdp}),
|
|
273
|
267
|
function () {
|
|
274
|
|
- //logger.log('setLocalDescription success');
|
|
275
|
|
- self.setLocalDescription();
|
|
276
|
|
-
|
|
277
|
268
|
self.connection.sendIQ(accept,
|
|
278
|
269
|
function () {
|
|
279
|
270
|
var ack = {};
|
|
|
@@ -474,15 +465,6 @@ JingleSessionPC.prototype.readSsrcInfo = function (contents) {
|
|
474
|
465
|
});
|
|
475
|
466
|
};
|
|
476
|
467
|
|
|
477
|
|
-/**
|
|
478
|
|
- * Returns the SSRC of local audio stream.
|
|
479
|
|
- * @param mediaType 'audio' or 'video' media type
|
|
480
|
|
- * @returns {*} the SSRC number of local audio or video stream.
|
|
481
|
|
- */
|
|
482
|
|
-JingleSessionPC.prototype.getLocalSSRC = function (mediaType) {
|
|
483
|
|
- return this.localStreamsSSRC[mediaType];
|
|
484
|
|
-};
|
|
485
|
|
-
|
|
486
|
468
|
JingleSessionPC.prototype.setRemoteDescription = function (elem, desctype) {
|
|
487
|
469
|
//logger.log('setting remote description... ', desctype);
|
|
488
|
470
|
this.remoteSDP = new SDP('');
|
|
|
@@ -732,7 +714,6 @@ JingleSessionPC.prototype.createdAnswer = function (sdp, provisional) {
|
|
732
|
714
|
if (self.usetrickle && !self.usepranswer) {
|
|
733
|
715
|
sendJingle();
|
|
734
|
716
|
}
|
|
735
|
|
- self.setLocalDescription();
|
|
736
|
717
|
},
|
|
737
|
718
|
function (e) {
|
|
738
|
719
|
logger.error('setLocalDescription failed', e);
|
|
|
@@ -953,8 +934,8 @@ JingleSessionPC.prototype._modifySources = function (successCallback, queueCallb
|
|
953
|
934
|
if (this.peerconnection.signalingState == 'closed') return;
|
|
954
|
935
|
if (!(this.addssrc.length || this.removessrc.length || this.pendingop !== null
|
|
955
|
936
|
|| this.modifyingLocalStreams)){
|
|
956
|
|
- // There is nothing to do since scheduled job might have been executed by another succeeding call
|
|
957
|
|
- this.setLocalDescription();
|
|
|
937
|
+ // There is nothing to do since scheduled job might have been
|
|
|
938
|
+ // executed by another succeeding call
|
|
958
|
939
|
if(successCallback){
|
|
959
|
940
|
successCallback();
|
|
960
|
941
|
}
|
|
|
@@ -1021,8 +1002,6 @@ JingleSessionPC.prototype._modifySources = function (successCallback, queueCallb
|
|
1021
|
1002
|
//modifiedAnswer.sdp = modifiedAnswer.sdp.replace(/a=setup:active/g, 'a=setup:actpass');
|
|
1022
|
1003
|
self.peerconnection.setLocalDescription(modifiedAnswer,
|
|
1023
|
1004
|
function() {
|
|
1024
|
|
- //logger.log('modified setLocalDescription ok');
|
|
1025
|
|
- self.setLocalDescription();
|
|
1026
|
1005
|
if(successCallback){
|
|
1027
|
1006
|
successCallback();
|
|
1028
|
1007
|
}
|
|
|
@@ -1291,33 +1270,6 @@ JingleSessionPC.onJingleFatalError = function (session, error)
|
|
1291
|
1270
|
this.room.eventEmitter.emit(XMPPEvents.JINGLE_FATAL_ERROR, session, error);
|
|
1292
|
1271
|
}
|
|
1293
|
1272
|
|
|
1294
|
|
-JingleSessionPC.prototype.setLocalDescription = function () {
|
|
1295
|
|
- var self = this;
|
|
1296
|
|
- var newssrcs = [];
|
|
1297
|
|
- if(!this.peerconnection.localDescription)
|
|
1298
|
|
- return;
|
|
1299
|
|
- var session = transform.parse(this.peerconnection.localDescription.sdp);
|
|
1300
|
|
- var i;
|
|
1301
|
|
- session.media.forEach(function (media) {
|
|
1302
|
|
-
|
|
1303
|
|
- if (media.ssrcs && media.ssrcs.length > 0) {
|
|
1304
|
|
- // TODO(gp) maybe exclude FID streams?
|
|
1305
|
|
- media.ssrcs.forEach(function (ssrc) {
|
|
1306
|
|
- if (ssrc.attribute !== 'cname') {
|
|
1307
|
|
- return;
|
|
1308
|
|
- }
|
|
1309
|
|
- newssrcs.push({
|
|
1310
|
|
- 'ssrc': ssrc.id,
|
|
1311
|
|
- 'type': media.type
|
|
1312
|
|
- });
|
|
1313
|
|
- // FIXME allows for only one SSRC per media type
|
|
1314
|
|
- self.localStreamsSSRC[media.type] = ssrc.id;
|
|
1315
|
|
- });
|
|
1316
|
|
- }
|
|
1317
|
|
-
|
|
1318
|
|
- });
|
|
1319
|
|
-}
|
|
1320
|
|
-
|
|
1321
|
1273
|
// an attempt to work around https://github.com/jitsi/jitmeet/issues/32
|
|
1322
|
1274
|
JingleSessionPC.prototype.sendKeyframe = function () {
|
|
1323
|
1275
|
var pc = this.peerconnection;
|