|
|
@@ -968,57 +968,58 @@ JingleSession.prototype.switchStreams = function (new_stream, oldStream, success
|
|
968
|
968
|
*/
|
|
969
|
969
|
JingleSession.prototype.notifyMySSRCUpdate = function (old_sdp, new_sdp) {
|
|
970
|
970
|
|
|
971
|
|
- if (!(this.peerconnection.signalingState == 'stable' && this.peerconnection.iceConnectionState == 'connected')){
|
|
|
971
|
+ if (!(this.peerconnection.signalingState == 'stable' &&
|
|
|
972
|
+ this.peerconnection.iceConnectionState == 'connected')){
|
|
972
|
973
|
console.log("Too early to send updates");
|
|
973
|
974
|
return;
|
|
974
|
975
|
}
|
|
975
|
976
|
|
|
976
|
|
- // send source-add IQ.
|
|
977
|
|
- var sdpDiffer = new SDPDiffer(old_sdp, new_sdp);
|
|
978
|
|
- var add = $iq({to: self.peerjid, type: 'set'})
|
|
|
977
|
+ // send source-remove IQ.
|
|
|
978
|
+ sdpDiffer = new SDPDiffer(new_sdp, old_sdp);
|
|
|
979
|
+ var remove = $iq({to: this.peerjid, type: 'set'})
|
|
979
|
980
|
.c('jingle', {
|
|
980
|
981
|
xmlns: 'urn:xmpp:jingle:1',
|
|
981
|
|
- action: 'source-add',
|
|
982
|
|
- initiator: self.initiator,
|
|
983
|
|
- sid: self.sid
|
|
|
982
|
+ action: 'source-remove',
|
|
|
983
|
+ initiator: this.initiator,
|
|
|
984
|
+ sid: this.sid
|
|
984
|
985
|
}
|
|
985
|
986
|
);
|
|
986
|
|
- var added = sdpDiffer.toJingle(add);
|
|
987
|
|
- if (added) {
|
|
988
|
|
- this.connection.sendIQ(add,
|
|
|
987
|
+ var removed = sdpDiffer.toJingle(remove);
|
|
|
988
|
+ if (removed) {
|
|
|
989
|
+ this.connection.sendIQ(remove,
|
|
989
|
990
|
function (res) {
|
|
990
|
|
- console.info('got add result', res);
|
|
|
991
|
+ console.info('got remove result', res);
|
|
991
|
992
|
},
|
|
992
|
993
|
function (err) {
|
|
993
|
|
- console.error('got add error', err);
|
|
|
994
|
+ console.error('got remove error', err);
|
|
994
|
995
|
}
|
|
995
|
996
|
);
|
|
996
|
997
|
} else {
|
|
997
|
|
- console.log('addition not necessary');
|
|
|
998
|
+ console.log('removal not necessary');
|
|
998
|
999
|
}
|
|
999
|
1000
|
|
|
1000
|
|
- // send source-remove IQ.
|
|
1001
|
|
- sdpDiffer = new SDPDiffer(new_sdp, old_sdp);
|
|
1002
|
|
- var remove = $iq({to: self.peerjid, type: 'set'})
|
|
|
1001
|
+ // send source-add IQ.
|
|
|
1002
|
+ var sdpDiffer = new SDPDiffer(old_sdp, new_sdp);
|
|
|
1003
|
+ var add = $iq({to: this.peerjid, type: 'set'})
|
|
1003
|
1004
|
.c('jingle', {
|
|
1004
|
1005
|
xmlns: 'urn:xmpp:jingle:1',
|
|
1005
|
|
- action: 'source-remove',
|
|
1006
|
|
- initiator: self.initiator,
|
|
1007
|
|
- sid: self.sid
|
|
|
1006
|
+ action: 'source-add',
|
|
|
1007
|
+ initiator: this.initiator,
|
|
|
1008
|
+ sid: this.sid
|
|
1008
|
1009
|
}
|
|
1009
|
1010
|
);
|
|
1010
|
|
- var removed = sdpDiffer.toJingle(remove);
|
|
1011
|
|
- if (removed) {
|
|
1012
|
|
- this.connection.sendIQ(remove,
|
|
|
1011
|
+ var added = sdpDiffer.toJingle(add);
|
|
|
1012
|
+ if (added) {
|
|
|
1013
|
+ this.connection.sendIQ(add,
|
|
1013
|
1014
|
function (res) {
|
|
1014
|
|
- console.info('got remove result', res);
|
|
|
1015
|
+ console.info('got add result', res);
|
|
1015
|
1016
|
},
|
|
1016
|
1017
|
function (err) {
|
|
1017
|
|
- console.error('got remove error', err);
|
|
|
1018
|
+ console.error('got add error', err);
|
|
1018
|
1019
|
}
|
|
1019
|
1020
|
);
|
|
1020
|
1021
|
} else {
|
|
1021
|
|
- console.log('removal not necessary');
|
|
|
1022
|
+ console.log('addition not necessary');
|
|
1022
|
1023
|
}
|
|
1023
|
1024
|
};
|
|
1024
|
1025
|
|