From 835e199135b4a392fa427aa5985b946fcdb3342e Mon Sep 17 00:00:00 2001 From: hristoterezov Date: Wed, 27 May 2015 11:47:06 +0300 Subject: [PATCH] Fixes issue with not removed ssrcs after the participant left the room. --- index.html | 2 +- libs/app.bundle.js | 14 ++++++++++++-- modules/statistics/RTPStatsCollector.js | 5 +++-- modules/xmpp/strophe.emuc.js | 9 +++++++++ 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 91a41cf25..776881a24 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@ - + diff --git a/libs/app.bundle.js b/libs/app.bundle.js index d69a15d2d..e22ec7ee2 100644 --- a/libs/app.bundle.js +++ b/libs/app.bundle.js @@ -12457,9 +12457,10 @@ StatsCollector.prototype.processAudioLevelReport = function () var ssrc = getStatValue(now, 'ssrc'); var jid = APP.xmpp.getJidFromSSRC(ssrc); - if (!jid && (Date.now() - now.timestamp) < 3000) + if (!jid) { - console.warn("No jid for ssrc: " + ssrc); + if((Date.now() - now.timestamp) < 3000) + console.warn("No jid for ssrc: " + ssrc); continue; } @@ -16486,6 +16487,15 @@ module.exports = function(XMPP, eventEmitter) { eventEmitter.emit(XMPPEvents.MUC_DESTROYED, reason); return true; } + + var self = this; + // Remove old ssrcs coming from the jid + Object.keys(this.ssrc2jid).forEach(function (ssrc) { + if (self.ssrc2jid[ssrc] == from) { + delete self.ssrc2jid[ssrc]; + } + }); + // Status code 110 indicates that this notification is "self-presence". if (!$(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="110"]').length) { delete this.members[from]; diff --git a/modules/statistics/RTPStatsCollector.js b/modules/statistics/RTPStatsCollector.js index 056f8d994..481488e23 100644 --- a/modules/statistics/RTPStatsCollector.js +++ b/modules/statistics/RTPStatsCollector.js @@ -696,9 +696,10 @@ StatsCollector.prototype.processAudioLevelReport = function () var ssrc = getStatValue(now, 'ssrc'); var jid = APP.xmpp.getJidFromSSRC(ssrc); - if (!jid && (Date.now() - now.timestamp) < 3000) + if (!jid) { - console.warn("No jid for ssrc: " + ssrc); + if((Date.now() - now.timestamp) < 3000) + console.warn("No jid for ssrc: " + ssrc); continue; } diff --git a/modules/xmpp/strophe.emuc.js b/modules/xmpp/strophe.emuc.js index 6415e34c9..ea0a37f86 100644 --- a/modules/xmpp/strophe.emuc.js +++ b/modules/xmpp/strophe.emuc.js @@ -278,6 +278,15 @@ module.exports = function(XMPP, eventEmitter) { eventEmitter.emit(XMPPEvents.MUC_DESTROYED, reason); return true; } + + var self = this; + // Remove old ssrcs coming from the jid + Object.keys(this.ssrc2jid).forEach(function (ssrc) { + if (self.ssrc2jid[ssrc] == from) { + delete self.ssrc2jid[ssrc]; + } + }); + // Status code 110 indicates that this notification is "self-presence". if (!$(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="110"]').length) { delete this.members[from];