Merge pull request #519 from isymchych/lastn

Use overriden config.channelLastN property in VideoLayout
This commit is contained in:
yanas 2016-02-29 13:49:28 -06:00
commit c201de86cc
1 changed files with 11 additions and 8 deletions

View File

@ -20,7 +20,6 @@ var remoteVideoTypes = {};
var localVideoThumbnail = null; var localVideoThumbnail = null;
var currentDominantSpeaker = null; var currentDominantSpeaker = null;
var lastNCount = config.channelLastN;
var localLastNCount = config.channelLastN; var localLastNCount = config.channelLastN;
var localLastNSet = []; var localLastNSet = [];
var lastNEndpointsCache = []; var lastNEndpointsCache = [];
@ -96,6 +95,7 @@ var VideoLayout = {
localVideoThumbnail = new LocalVideo(VideoLayout, emitter); localVideoThumbnail = new LocalVideo(VideoLayout, emitter);
emitter.addListener(UIEvents.CONTACT_CLICKED, onContactClicked); emitter.addListener(UIEvents.CONTACT_CLICKED, onContactClicked);
this.lastNCount = config.channelLastN;
}, },
initLargeVideo (isSideBarVisible) { initLargeVideo (isSideBarVisible) {
@ -114,9 +114,9 @@ var VideoLayout = {
}, },
isInLastN (resource) { isInLastN (resource) {
return lastNCount < 0 || // lastN is disabled return this.lastNCount < 0 || // lastN is disabled
// lastNEndpoints cache not built yet // lastNEndpoints cache not built yet
(lastNCount > 0 && !lastNEndpointsCache.length) || (this.lastNCount > 0 && !lastNEndpointsCache.length) ||
(lastNEndpointsCache && (lastNEndpointsCache &&
lastNEndpointsCache.indexOf(resource) !== -1); lastNEndpointsCache.indexOf(resource) !== -1);
}, },
@ -268,7 +268,10 @@ var VideoLayout = {
onRemoteStreamRemoved (stream) { onRemoteStreamRemoved (stream) {
let id = stream.getParticipantId(); let id = stream.getParticipantId();
remoteVideos[id].removeRemoteStreamElement(stream); let remoteVideo = remoteVideos[id];
if (remoteVideo) { // remote stream may be removed after participant left the conference
remoteVideo.removeRemoteStreamElement(stream);
}
}, },
/** /**
@ -524,8 +527,8 @@ var VideoLayout = {
* endpoints * endpoints
*/ */
onLastNEndpointsChanged (lastNEndpoints, endpointsEnteringLastN) { onLastNEndpointsChanged (lastNEndpoints, endpointsEnteringLastN) {
if (lastNCount !== lastNEndpoints.length) if (this.lastNCount !== lastNEndpoints.length)
lastNCount = lastNEndpoints.length; this.lastNCount = lastNEndpoints.length;
lastNEndpointsCache = lastNEndpoints; lastNEndpointsCache = lastNEndpoints;
@ -540,8 +543,8 @@ var VideoLayout = {
// enters E's local LastN ejecting C. // enters E's local LastN ejecting C.
// Increase the local LastN set size, if necessary. // Increase the local LastN set size, if necessary.
if (lastNCount > localLastNCount) { if (this.lastNCount > localLastNCount) {
localLastNCount = lastNCount; localLastNCount = this.lastNCount;
} }
// Update the local LastN set preserving the order in which the // Update the local LastN set preserving the order in which the