Moves ssrc2jid global variable to the xmpp module.
This commit is contained in:
parent
51277270fe
commit
248d7a3173
1
app.js
1
app.js
|
@ -1,7 +1,6 @@
|
|||
/* jshint -W117 */
|
||||
/* application specific logic */
|
||||
var nickname = null;
|
||||
var ssrc2jid = {};
|
||||
|
||||
function init() {
|
||||
|
||||
|
|
10
index.html
10
index.html
|
@ -25,15 +25,15 @@
|
|||
<script src="service/RTC/MediaStreamTypes.js?v=1"></script>
|
||||
<script src="service/xmpp/XMPPEvents.js?v=1"></script>
|
||||
<script src="service/desktopsharing/DesktopSharingEventTypes.js?v=1"></script>
|
||||
<script src="libs/modules/simulcast.bundle.js?v=4"></script>
|
||||
<script src="libs/modules/simulcast.bundle.js?v=5"></script>
|
||||
<script src="libs/modules/connectionquality.bundle.js?v=2"></script>
|
||||
<script src="libs/modules/UI.bundle.js?v=7"></script>
|
||||
<script src="libs/modules/statistics.bundle.js?v=3"></script>
|
||||
<script src="libs/modules/UI.bundle.js?v=8"></script>
|
||||
<script src="libs/modules/statistics.bundle.js?v=4"></script>
|
||||
<script src="libs/modules/RTC.bundle.js?v=6"></script>
|
||||
<script src="libs/modules/desktopsharing.bundle.js?v=3"></script><!-- desktop sharing -->
|
||||
<script src="util.js?v=7"></script><!-- utility functions -->
|
||||
<script src="libs/modules/xmpp.bundle.js?v=3"></script>
|
||||
<script src="app.js?v=28"></script><!-- application logic -->
|
||||
<script src="libs/modules/xmpp.bundle.js?v=4"></script>
|
||||
<script src="app.js?v=29"></script><!-- application logic -->
|
||||
<script src="libs/modules/API.bundle.js?v=1"></script>
|
||||
|
||||
<script src="analytics.js?v=1"></script><!-- google analytics plugin -->
|
||||
|
|
|
@ -6385,7 +6385,7 @@ var VideoLayout = (function (my) {
|
|||
|
||||
var msidParts = msid.split(' ');
|
||||
|
||||
var preload = (Strophe.getResourceFromJid(ssrc2jid[primarySSRC]) == largeVideoState.userResourceJid);
|
||||
var preload = (Strophe.getResourceFromJid(xmpp.getJidFromSSRC(primarySSRC)) == largeVideoState.userResourceJid);
|
||||
|
||||
if (preload) {
|
||||
if (largeVideoState.preload)
|
||||
|
@ -6445,7 +6445,7 @@ var VideoLayout = (function (my) {
|
|||
var msidParts = msid.split(' ');
|
||||
var selRemoteVideo = $(['#', 'remoteVideo_', sid, '_', msidParts[0]].join(''));
|
||||
|
||||
var updateLargeVideo = (Strophe.getResourceFromJid(ssrc2jid[primarySSRC])
|
||||
var updateLargeVideo = (Strophe.getResourceFromJid(xmpp.getJidFromSSRC(primarySSRC))
|
||||
== largeVideoState.userResourceJid);
|
||||
var updateFocusedVideoSrc = (focusedVideoInfo && focusedVideoInfo.src && focusedVideoInfo.src != '' &&
|
||||
(RTC.getVideoSrc(selRemoteVideo[0]) == focusedVideoInfo.src));
|
||||
|
@ -6467,7 +6467,7 @@ var VideoLayout = (function (my) {
|
|||
RTC.attachMediaStream(selRemoteVideo, electedStream);
|
||||
}
|
||||
|
||||
var jid = ssrc2jid[primarySSRC];
|
||||
var jid = xmpp.getJidFromSSRC(primarySSRC);
|
||||
|
||||
if (updateLargeVideo) {
|
||||
VideoLayout.updateLargeVideo(RTC.getVideoSrc(selRemoteVideo[0]), null,
|
||||
|
|
|
@ -218,7 +218,7 @@ SimulcastReceiver.prototype.getReceivingVideoStreamBySSRC = function (ssrc)
|
|||
{
|
||||
var sid, electedStream;
|
||||
var i, j, k;
|
||||
var jid = ssrc2jid[ssrc];
|
||||
var jid = xmpp.getJidFromSSRC(ssrc);
|
||||
if(jid && RTC.remoteStreams[jid])
|
||||
{
|
||||
var remoteStreamObject = RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE];
|
||||
|
|
|
@ -576,7 +576,7 @@ StatsCollector.prototype.processStatsReport = function () {
|
|||
var ssrc = getStatValue(now, 'ssrc');
|
||||
if(!ssrc)
|
||||
continue;
|
||||
var jid = ssrc2jid[ssrc];
|
||||
var jid = xmpp.getJidFromSSRC(ssrc);
|
||||
if (!jid && (Date.now() - now.timestamp) < 3000) {
|
||||
console.warn("No jid for ssrc: " + ssrc);
|
||||
continue;
|
||||
|
@ -777,7 +777,7 @@ StatsCollector.prototype.processAudioLevelReport = function ()
|
|||
}
|
||||
|
||||
var ssrc = getStatValue(now, 'ssrc');
|
||||
var jid = ssrc2jid[ssrc];
|
||||
var jid = xmpp.getJidFromSSRC(ssrc);
|
||||
if (!jid && (Date.now() - now.timestamp) < 3000)
|
||||
{
|
||||
console.warn("No jid for ssrc: " + ssrc);
|
||||
|
|
|
@ -1313,6 +1313,7 @@ function sendKeyframe(pc) {
|
|||
JingleSession.prototype.remoteStreamAdded = function (data) {
|
||||
var self = this;
|
||||
var thessrc;
|
||||
var ssrc2jid = this.connection.emuc.ssrc2jid;
|
||||
|
||||
// look up an associated JID for a stream id
|
||||
if (data.stream.id && data.stream.id.indexOf('mixedmslabel') === -1) {
|
||||
|
@ -3234,6 +3235,7 @@ module.exports = function(XMPP, eventEmitter) {
|
|||
isOwner: false,
|
||||
role: null,
|
||||
focusMucJid: null,
|
||||
ssrc2jid: {},
|
||||
init: function (conn) {
|
||||
this.connection = conn;
|
||||
},
|
||||
|
@ -3779,10 +3781,11 @@ module.exports = function(XMPP, eventEmitter) {
|
|||
if(memeber.isFocus)
|
||||
return;
|
||||
|
||||
var self = this;
|
||||
// Remove old ssrcs coming from the jid
|
||||
Object.keys(ssrc2jid).forEach(function (ssrc) {
|
||||
if (ssrc2jid[ssrc] == jid) {
|
||||
delete ssrc2jid[ssrc];
|
||||
Object.keys(this.ssrc2jid).forEach(function (ssrc) {
|
||||
if (self.ssrc2jid[ssrc] == jid) {
|
||||
delete self.ssrc2jid[ssrc];
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -3790,7 +3793,7 @@ module.exports = function(XMPP, eventEmitter) {
|
|||
$(pres).find('>media[xmlns="http://estos.de/ns/mjs"]>source').each(function (idx, ssrc) {
|
||||
//console.log(jid, 'assoc ssrc', ssrc.getAttribute('type'), ssrc.getAttribute('ssrc'));
|
||||
var ssrcV = ssrc.getAttribute('ssrc');
|
||||
ssrc2jid[ssrcV] = from;
|
||||
self.ssrc2jid[ssrcV] = from;
|
||||
JingleSession.notReceivedSSRCs.push(ssrcV);
|
||||
|
||||
|
||||
|
@ -4806,6 +4809,11 @@ var XMPP = {
|
|||
},
|
||||
getMembers: function () {
|
||||
return connection.emuc.members;
|
||||
},
|
||||
getJidFromSSRC: function (ssrc) {
|
||||
if(!connection)
|
||||
return null;
|
||||
return connection.emuc.ssrc2jid[ssrc];
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -2006,7 +2006,7 @@ var VideoLayout = (function (my) {
|
|||
|
||||
var msidParts = msid.split(' ');
|
||||
|
||||
var preload = (Strophe.getResourceFromJid(ssrc2jid[primarySSRC]) == largeVideoState.userResourceJid);
|
||||
var preload = (Strophe.getResourceFromJid(xmpp.getJidFromSSRC(primarySSRC)) == largeVideoState.userResourceJid);
|
||||
|
||||
if (preload) {
|
||||
if (largeVideoState.preload)
|
||||
|
@ -2066,7 +2066,7 @@ var VideoLayout = (function (my) {
|
|||
var msidParts = msid.split(' ');
|
||||
var selRemoteVideo = $(['#', 'remoteVideo_', sid, '_', msidParts[0]].join(''));
|
||||
|
||||
var updateLargeVideo = (Strophe.getResourceFromJid(ssrc2jid[primarySSRC])
|
||||
var updateLargeVideo = (Strophe.getResourceFromJid(xmpp.getJidFromSSRC(primarySSRC))
|
||||
== largeVideoState.userResourceJid);
|
||||
var updateFocusedVideoSrc = (focusedVideoInfo && focusedVideoInfo.src && focusedVideoInfo.src != '' &&
|
||||
(RTC.getVideoSrc(selRemoteVideo[0]) == focusedVideoInfo.src));
|
||||
|
@ -2088,7 +2088,7 @@ var VideoLayout = (function (my) {
|
|||
RTC.attachMediaStream(selRemoteVideo, electedStream);
|
||||
}
|
||||
|
||||
var jid = ssrc2jid[primarySSRC];
|
||||
var jid = xmpp.getJidFromSSRC(primarySSRC);
|
||||
|
||||
if (updateLargeVideo) {
|
||||
VideoLayout.updateLargeVideo(RTC.getVideoSrc(selRemoteVideo[0]), null,
|
||||
|
|
|
@ -184,7 +184,7 @@ SimulcastReceiver.prototype.getReceivingVideoStreamBySSRC = function (ssrc)
|
|||
{
|
||||
var sid, electedStream;
|
||||
var i, j, k;
|
||||
var jid = ssrc2jid[ssrc];
|
||||
var jid = xmpp.getJidFromSSRC(ssrc);
|
||||
if(jid && RTC.remoteStreams[jid])
|
||||
{
|
||||
var remoteStreamObject = RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE];
|
||||
|
|
|
@ -444,7 +444,7 @@ StatsCollector.prototype.processStatsReport = function () {
|
|||
var ssrc = getStatValue(now, 'ssrc');
|
||||
if(!ssrc)
|
||||
continue;
|
||||
var jid = ssrc2jid[ssrc];
|
||||
var jid = xmpp.getJidFromSSRC(ssrc);
|
||||
if (!jid && (Date.now() - now.timestamp) < 3000) {
|
||||
console.warn("No jid for ssrc: " + ssrc);
|
||||
continue;
|
||||
|
@ -645,7 +645,7 @@ StatsCollector.prototype.processAudioLevelReport = function ()
|
|||
}
|
||||
|
||||
var ssrc = getStatValue(now, 'ssrc');
|
||||
var jid = ssrc2jid[ssrc];
|
||||
var jid = xmpp.getJidFromSSRC(ssrc);
|
||||
if (!jid && (Date.now() - now.timestamp) < 3000)
|
||||
{
|
||||
console.warn("No jid for ssrc: " + ssrc);
|
||||
|
|
|
@ -1312,6 +1312,7 @@ function sendKeyframe(pc) {
|
|||
JingleSession.prototype.remoteStreamAdded = function (data) {
|
||||
var self = this;
|
||||
var thessrc;
|
||||
var ssrc2jid = this.connection.emuc.ssrc2jid;
|
||||
|
||||
// look up an associated JID for a stream id
|
||||
if (data.stream.id && data.stream.id.indexOf('mixedmslabel') === -1) {
|
||||
|
|
|
@ -21,6 +21,7 @@ module.exports = function(XMPP, eventEmitter) {
|
|||
isOwner: false,
|
||||
role: null,
|
||||
focusMucJid: null,
|
||||
ssrc2jid: {},
|
||||
init: function (conn) {
|
||||
this.connection = conn;
|
||||
},
|
||||
|
@ -566,10 +567,11 @@ module.exports = function(XMPP, eventEmitter) {
|
|||
if(memeber.isFocus)
|
||||
return;
|
||||
|
||||
var self = this;
|
||||
// Remove old ssrcs coming from the jid
|
||||
Object.keys(ssrc2jid).forEach(function (ssrc) {
|
||||
if (ssrc2jid[ssrc] == jid) {
|
||||
delete ssrc2jid[ssrc];
|
||||
Object.keys(this.ssrc2jid).forEach(function (ssrc) {
|
||||
if (self.ssrc2jid[ssrc] == jid) {
|
||||
delete self.ssrc2jid[ssrc];
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -577,7 +579,7 @@ module.exports = function(XMPP, eventEmitter) {
|
|||
$(pres).find('>media[xmlns="http://estos.de/ns/mjs"]>source').each(function (idx, ssrc) {
|
||||
//console.log(jid, 'assoc ssrc', ssrc.getAttribute('type'), ssrc.getAttribute('ssrc'));
|
||||
var ssrcV = ssrc.getAttribute('ssrc');
|
||||
ssrc2jid[ssrcV] = from;
|
||||
self.ssrc2jid[ssrcV] = from;
|
||||
JingleSession.notReceivedSSRCs.push(ssrcV);
|
||||
|
||||
|
||||
|
|
|
@ -417,6 +417,11 @@ var XMPP = {
|
|||
},
|
||||
getMembers: function () {
|
||||
return connection.emuc.members;
|
||||
},
|
||||
getJidFromSSRC: function (ssrc) {
|
||||
if(!connection)
|
||||
return null;
|
||||
return connection.emuc.ssrc2jid[ssrc];
|
||||
}
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue