Stores info from last presence received for participant and dispatch it if any on creating remote streams to reflect video muted state. Race condition detected by tests where we miss presence info cause stream was not created when we receive presence packet.
This commit is contained in:
parent
59b26fdf07
commit
6b94d3fe47
|
@ -20,7 +20,7 @@
|
||||||
<script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
|
<script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
|
||||||
<script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
|
<script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
|
||||||
<script src="interface_config.js?v=5"></script>
|
<script src="interface_config.js?v=5"></script>
|
||||||
<script src="libs/app.bundle.js?v=133"></script>
|
<script src="libs/app.bundle.js?v=134"></script>
|
||||||
<script src="analytics.js?v=1"></script><!-- google analytics plugin -->
|
<script src="analytics.js?v=1"></script><!-- google analytics plugin -->
|
||||||
<link rel="stylesheet" href="css/font.css?v=7"/>
|
<link rel="stylesheet" href="css/font.css?v=7"/>
|
||||||
<link rel="stylesheet" href="css/toastr.css?v=1">
|
<link rel="stylesheet" href="css/toastr.css?v=1">
|
||||||
|
|
1228
libs/app.bundle.js
1228
libs/app.bundle.js
File diff suppressed because it is too large
Load Diff
|
@ -8,10 +8,11 @@ var MediaStreamType = require("../../service/RTC/MediaStreamTypes");
|
||||||
* the peerjid, etc.
|
* the peerjid, etc.
|
||||||
* @param sid the session id
|
* @param sid the session id
|
||||||
* @param ssrc the ssrc corresponding to this MediaStream
|
* @param ssrc the ssrc corresponding to this MediaStream
|
||||||
|
* @param mute the whether this MediaStream is muted
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function MediaStream(data, sid, ssrc, browser, eventEmitter) {
|
function MediaStream(data, sid, ssrc, browser, eventEmitter, mute) {
|
||||||
|
|
||||||
// XXX(gp) to minimize headaches in the future, we should build our
|
// XXX(gp) to minimize headaches in the future, we should build our
|
||||||
// abstractions around tracks and not streams. ORTC is track based API.
|
// abstractions around tracks and not streams. ORTC is track based API.
|
||||||
|
@ -30,7 +31,7 @@ function MediaStream(data, sid, ssrc, browser, eventEmitter) {
|
||||||
this.ssrc = ssrc;
|
this.ssrc = ssrc;
|
||||||
this.type = (this.stream.getVideoTracks().length > 0)?
|
this.type = (this.stream.getVideoTracks().length > 0)?
|
||||||
MediaStreamType.VIDEO_TYPE : MediaStreamType.AUDIO_TYPE;
|
MediaStreamType.VIDEO_TYPE : MediaStreamType.AUDIO_TYPE;
|
||||||
this.muted = false;
|
this.muted = mute;
|
||||||
this.eventEmitter = eventEmitter;
|
this.eventEmitter = eventEmitter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,9 +96,18 @@ var RTC = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
createRemoteStream: function (data, sid, thessrc) {
|
createRemoteStream: function (data, sid, thessrc) {
|
||||||
var remoteStream = new MediaStream(data, sid, thessrc,
|
|
||||||
RTCBrowserType.getBrowserType(), eventEmitter);
|
|
||||||
var jid = data.peerjid || APP.xmpp.myJid();
|
var jid = data.peerjid || APP.xmpp.myJid();
|
||||||
|
|
||||||
|
// check the video muted state from last stored presence if any
|
||||||
|
var muted = false;
|
||||||
|
var pres = APP.xmpp.getLastPresence(jid);
|
||||||
|
if(pres != null && pres.videoMuted) {
|
||||||
|
muted = pres.videoMuted;
|
||||||
|
}
|
||||||
|
|
||||||
|
var remoteStream = new MediaStream(data, sid, thessrc,
|
||||||
|
RTCBrowserType.getBrowserType(), eventEmitter, muted);
|
||||||
|
|
||||||
if(!this.remoteStreams[jid]) {
|
if(!this.remoteStreams[jid]) {
|
||||||
this.remoteStreams[jid] = {};
|
this.remoteStreams[jid] = {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ module.exports = function(XMPP, eventEmitter) {
|
||||||
list_members: [], // so we can elect a new focus
|
list_members: [], // so we can elect a new focus
|
||||||
presMap: {},
|
presMap: {},
|
||||||
preziMap: {},
|
preziMap: {},
|
||||||
|
lastPresenceMap: {},
|
||||||
joined: false,
|
joined: false,
|
||||||
isOwner: false,
|
isOwner: false,
|
||||||
role: null,
|
role: null,
|
||||||
|
@ -135,6 +136,9 @@ module.exports = function(XMPP, eventEmitter) {
|
||||||
$(document).trigger('presentationremoved.muc', [from, url]);
|
$(document).trigger('presentationremoved.muc', [from, url]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// store the last presence for participant
|
||||||
|
this.lastPresenceMap[from] = {};
|
||||||
|
|
||||||
// Parse audio info tag.
|
// Parse audio info tag.
|
||||||
var audioMuted = $(pres).find('>audiomuted');
|
var audioMuted = $(pres).find('>audiomuted');
|
||||||
if (audioMuted.length) {
|
if (audioMuted.length) {
|
||||||
|
@ -145,8 +149,9 @@ module.exports = function(XMPP, eventEmitter) {
|
||||||
// Parse video info tag.
|
// Parse video info tag.
|
||||||
var videoMuted = $(pres).find('>videomuted');
|
var videoMuted = $(pres).find('>videomuted');
|
||||||
if (videoMuted.length) {
|
if (videoMuted.length) {
|
||||||
eventEmitter.emit(XMPPEvents.PARTICIPANT_VIDEO_MUTED,
|
var value = (videoMuted.text() === "true");
|
||||||
from, (videoMuted.text() === "true"));
|
this.lastPresenceMap[from].videoMuted = value;
|
||||||
|
eventEmitter.emit(XMPPEvents.PARTICIPANT_VIDEO_MUTED, from, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
var startMuted = $(pres).find('>startmuted');
|
var startMuted = $(pres).find('>startmuted');
|
||||||
|
@ -309,6 +314,11 @@ module.exports = function(XMPP, eventEmitter) {
|
||||||
eventEmitter.emit(XMPPEvents.KICKED);
|
eventEmitter.emit(XMPPEvents.KICKED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.lastPresenceMap[from] != null) {
|
||||||
|
delete this.lastPresenceMap[from];
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
onPresenceError: function (pres) {
|
onPresenceError: function (pres) {
|
||||||
|
|
|
@ -336,6 +336,11 @@ var XMPP = {
|
||||||
return null;
|
return null;
|
||||||
return Strophe.getResourceFromJid(connection.emuc.myroomjid);
|
return Strophe.getResourceFromJid(connection.emuc.myroomjid);
|
||||||
},
|
},
|
||||||
|
getLastPresence: function (from) {
|
||||||
|
if(!connection)
|
||||||
|
return null;
|
||||||
|
return connection.emuc.lastPresenceMap[from];
|
||||||
|
},
|
||||||
disposeConference: function (onUnload) {
|
disposeConference: function (onUnload) {
|
||||||
var handler = connection.jingle.activecall;
|
var handler = connection.jingle.activecall;
|
||||||
if (handler && handler.peerconnection) {
|
if (handler && handler.peerconnection) {
|
||||||
|
|
Loading…
Reference in New Issue