Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Adds an option to advertise our SSRCs in presence to the MUC (as well as Jingle) for backward compatibility with jirecon. Partially reverts a1b0677442e04c12f275431be380f06a8f4a3959

Boris Grozev932af962b2bd
diff --git a/modules/xmpp/JingleSessionPC.js b/modules/xmpp/JingleSessionPC.js
index 6fa0fcdf7c..6253096d8a 100644
--- a/modules/xmpp/JingleSessionPC.js
+++ b/modules/xmpp/JingleSessionPC.js
@@ -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();
}
}
};
diff --git a/modules/xmpp/strophe.emuc.js b/modules/xmpp/strophe.emuc.js
index b37918e0da..2b83c049bf 100644
--- a/modules/xmpp/strophe.emuc.js
+++ b/modules/xmpp/strophe.emuc.js
@@ -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;
},