Adds an option to advertise our SSRCs in presence to the MUC (as well as
Jingle) for backward compatibility with jirecon. Partially reverts
a1b0677442
This commit is contained in:
parent
e0522f6977
commit
932af962b2
|
@ -1406,10 +1406,28 @@ JingleSessionPC.prototype.setLocalDescription = function () {
|
|||
|
||||
// Bind us as local SSRCs owner
|
||||
if (newssrcs.length > 0) {
|
||||
|
||||
if (config.advertiseSSRCsInPresence) {
|
||||
// This is only for backward compatibility with clients which
|
||||
// don't support getting sources from Jingle (i.e. jirecon).
|
||||
this.connection.emuc.clearPresenceMedia();
|
||||
}
|
||||
|
||||
for (i = 0; i < newssrcs.length; i++) {
|
||||
var ssrc = newssrcs[i].ssrc;
|
||||
var myJid = self.connection.emuc.myroomjid;
|
||||
self.ssrcOwners[ssrc] = myJid;
|
||||
|
||||
if (config.advertiseSSRCsInPresence) {
|
||||
// This is only for backward compatibility with clients which
|
||||
// don't support getting sources from Jingle (i.e. jirecon).
|
||||
this.connection.emuc.addMediaToPresence(
|
||||
i+1, newssrcs[i].type, ssrc, newssrcs[i].direction);
|
||||
}
|
||||
}
|
||||
|
||||
if (config.advertiseSSRCsInPresence) {
|
||||
this.connection.emuc.sendPresence();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -529,6 +529,31 @@ module.exports = function(XMPP, eventEmitter) {
|
|||
.c('current').t(this.presMap['prezicurrent']).up().up();
|
||||
}
|
||||
|
||||
// This is only for backward compatibility with clients which
|
||||
// don't support getting sources from Jingle (i.e. jirecon).
|
||||
if (this.presMap['medians']) {
|
||||
pres.c('media', {xmlns: this.presMap['medians']});
|
||||
var sourceNumber = 0;
|
||||
Object.keys(this.presMap).forEach(function (key) {
|
||||
if (key.indexOf('source') >= 0) {
|
||||
sourceNumber++;
|
||||
}
|
||||
});
|
||||
if (sourceNumber > 0) {
|
||||
for (var i = 1; i <= sourceNumber / 3; i++) {
|
||||
pres.c('source',
|
||||
{
|
||||
type: this.presMap['source' + i + '_type'],
|
||||
ssrc: this.presMap['source' + i + '_ssrc'],
|
||||
direction: this.presMap['source' + i + '_direction']
|
||||
|| 'sendrecv'
|
||||
}
|
||||
).up();
|
||||
}
|
||||
}
|
||||
pres.up();
|
||||
}
|
||||
|
||||
if(this.presMap["startMuted"] !== undefined)
|
||||
{
|
||||
pres.c("startmuted", {audio: this.presMap["startMuted"].audio,
|
||||
|
@ -543,6 +568,26 @@ module.exports = function(XMPP, eventEmitter) {
|
|||
addDisplayNameToPresence: function (displayName) {
|
||||
this.presMap['displayName'] = displayName;
|
||||
},
|
||||
// This is only for backward compatibility with clients which
|
||||
// don't support getting sources from Jingle (i.e. jirecon).
|
||||
addMediaToPresence: function (sourceNumber, mtype, ssrcs, direction) {
|
||||
if (!this.presMap['medians'])
|
||||
this.presMap['medians'] = 'http://estos.de/ns/mjs';
|
||||
|
||||
this.presMap['source' + sourceNumber + '_type'] = mtype;
|
||||
this.presMap['source' + sourceNumber + '_ssrc'] = ssrcs;
|
||||
this.presMap['source' + sourceNumber + '_direction'] = direction;
|
||||
},
|
||||
// This is only for backward compatibility with clients which
|
||||
// don't support getting sources from Jingle (i.e. jirecon).
|
||||
clearPresenceMedia: function () {
|
||||
var self = this;
|
||||
Object.keys(this.presMap).forEach(function (key) {
|
||||
if (key.indexOf('source') != -1) {
|
||||
delete self.presMap[key];
|
||||
}
|
||||
});
|
||||
},
|
||||
addDevicesToPresence: function (devices) {
|
||||
this.presMap['devices'] = devices;
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue