|
|
@@ -361,7 +361,6 @@ JingleSessionPC.prototype.sendIceCandidate = function (candidate) {
|
|
361
|
361
|
init,
|
|
362
|
362
|
self.initiator == self.me ? 'initiator' : 'responder',
|
|
363
|
363
|
ssrc);
|
|
364
|
|
-
|
|
365
|
364
|
self.connection.sendIQ(init,
|
|
366
|
365
|
function () {
|
|
367
|
366
|
//logger.log('session initiate ack');
|
|
|
@@ -689,7 +688,7 @@ JingleSessionPC.prototype.createdAnswer = function (sdp, provisional) {
|
|
689
|
688
|
accept,
|
|
690
|
689
|
self.initiator == self.me ? 'initiator' : 'responder',
|
|
691
|
690
|
ssrcs);
|
|
692
|
|
-
|
|
|
691
|
+ self.fixJingle(accept);
|
|
693
|
692
|
self.connection.sendIQ(accept,
|
|
694
|
693
|
function () {
|
|
695
|
694
|
var ack = {};
|
|
|
@@ -1027,11 +1026,16 @@ JingleSessionPC.prototype._modifySources = function (successCallback, queueCallb
|
|
1027
|
1026
|
};
|
|
1028
|
1027
|
|
|
1029
|
1028
|
/**
|
|
1030
|
|
- * Adds streams.
|
|
|
1029
|
+ * Adds stream.
|
|
1031
|
1030
|
* @param stream new stream that will be added.
|
|
1032
|
1031
|
* @param success_callback callback executed after successful stream addition.
|
|
|
1032
|
+ * @param ssrcInfo object with information about the SSRCs associated with the
|
|
|
1033
|
+ * stream.
|
|
|
1034
|
+ * @param dontModifySources {boolean} if true _modifySources won't be called.
|
|
|
1035
|
+ * Used for streams added before the call start.
|
|
1033
|
1036
|
*/
|
|
1034
|
|
-JingleSessionPC.prototype.addStream = function (stream, callback, ssrcInfo) {
|
|
|
1037
|
+JingleSessionPC.prototype.addStream = function (stream, callback, ssrcInfo,
|
|
|
1038
|
+ dontModifySources) {
|
|
1035
|
1039
|
// Remember SDP to figure out added/removed SSRCs
|
|
1036
|
1040
|
var oldSdp = null;
|
|
1037
|
1041
|
if(this.peerconnection) {
|
|
|
@@ -1045,7 +1049,13 @@ JingleSessionPC.prototype.addStream = function (stream, callback, ssrcInfo) {
|
|
1045
|
1049
|
}
|
|
1046
|
1050
|
|
|
1047
|
1051
|
// Conference is not active
|
|
1048
|
|
- if(!oldSdp || !this.peerconnection) {
|
|
|
1052
|
+ if(!oldSdp || !this.peerconnection || dontModifySources) {
|
|
|
1053
|
+ if(ssrcInfo) {
|
|
|
1054
|
+ //available only on video unmute or when adding muted stream
|
|
|
1055
|
+ this.modifiedSSRCs[ssrcInfo.type] =
|
|
|
1056
|
+ this.modifiedSSRCs[ssrcInfo.type] || [];
|
|
|
1057
|
+ this.modifiedSSRCs[ssrcInfo.type].push(ssrcInfo);
|
|
|
1058
|
+ }
|
|
1049
|
1059
|
callback();
|
|
1050
|
1060
|
return;
|
|
1051
|
1061
|
}
|
|
|
@@ -1054,14 +1064,13 @@ JingleSessionPC.prototype.addStream = function (stream, callback, ssrcInfo) {
|
|
1054
|
1064
|
var self = this;
|
|
1055
|
1065
|
this.modifySourcesQueue.push(function() {
|
|
1056
|
1066
|
logger.log('modify sources done');
|
|
1057
|
|
-
|
|
1058
|
|
- callback();
|
|
1059
|
1067
|
if(ssrcInfo) {
|
|
1060
|
1068
|
//available only on video unmute or when adding muted stream
|
|
1061
|
1069
|
self.modifiedSSRCs[ssrcInfo.type] =
|
|
1062
|
1070
|
self.modifiedSSRCs[ssrcInfo.type] || [];
|
|
1063
|
1071
|
self.modifiedSSRCs[ssrcInfo.type].push(ssrcInfo);
|
|
1064
|
1072
|
}
|
|
|
1073
|
+ callback();
|
|
1065
|
1074
|
var newSdp = new SDP(self.peerconnection.localDescription.sdp);
|
|
1066
|
1075
|
logger.log("SDPs", oldSdp, newSdp);
|
|
1067
|
1076
|
self.notifyMySSRCUpdate(oldSdp, newSdp);
|
|
|
@@ -1081,6 +1090,8 @@ JingleSessionPC.prototype.generateNewStreamSSRCInfo = function () {
|
|
1081
|
1090
|
* Remove streams.
|
|
1082
|
1091
|
* @param stream stream that will be removed.
|
|
1083
|
1092
|
* @param success_callback callback executed after successful stream addition.
|
|
|
1093
|
+ * @param ssrcInfo object with information about the SSRCs associated with the
|
|
|
1094
|
+ * stream.
|
|
1084
|
1095
|
*/
|
|
1085
|
1096
|
JingleSessionPC.prototype.removeStream = function (stream, callback, ssrcInfo) {
|
|
1086
|
1097
|
// Remember SDP to figure out added/removed SSRCs
|
|
|
@@ -1183,7 +1194,7 @@ JingleSessionPC.prototype.notifyMySSRCUpdate = function (old_sdp, new_sdp) {
|
|
1183
|
1194
|
var removed = this.fixJingle(remove);
|
|
1184
|
1195
|
|
|
1185
|
1196
|
if (removed && remove) {
|
|
1186
|
|
- logger.info("Sending source-remove", remove);
|
|
|
1197
|
+ logger.info("Sending source-remove", remove.tree());
|
|
1187
|
1198
|
this.connection.sendIQ(remove,
|
|
1188
|
1199
|
function (res) {
|
|
1189
|
1200
|
logger.info('got remove result', res);
|
|
|
@@ -1211,7 +1222,7 @@ JingleSessionPC.prototype.notifyMySSRCUpdate = function (old_sdp, new_sdp) {
|
|
1211
|
1222
|
var added = this.fixJingle(add);
|
|
1212
|
1223
|
|
|
1213
|
1224
|
if (added && add) {
|
|
1214
|
|
- logger.info("Sending source-add", add);
|
|
|
1225
|
+ logger.info("Sending source-add", add.tree());
|
|
1215
|
1226
|
this.connection.sendIQ(add,
|
|
1216
|
1227
|
function (res) {
|
|
1217
|
1228
|
logger.info('got add result', res);
|
|
|
@@ -1389,6 +1400,7 @@ JingleSessionPC.prototype.fixJingle = function(jingle) {
|
|
1389
|
1400
|
var action = $(jingle.nodeTree).find("jingle").attr("action");
|
|
1390
|
1401
|
switch (action) {
|
|
1391
|
1402
|
case "source-add":
|
|
|
1403
|
+ case "session-accept":
|
|
1392
|
1404
|
this.fixSourceAddJingle(jingle);
|
|
1393
|
1405
|
break;
|
|
1394
|
1406
|
case "source-remove":
|