fix(config) Remove the code related to lastN limits which is not used anymore.

pull/13168/head
Jaya Allamsetty 2 years ago
parent 3a2a129f44
commit 6efa4f2475
  1. 16
      config.js
  2. 3
      react/features/base/config/configType.ts
  3. 57
      react/features/base/lastn/functions.ts
  4. 15
      react/features/base/lastn/middleware.ts
  5. 21
      react/features/base/lastn/reducer.ts

@ -422,22 +422,6 @@ var config = {
// value will be used when the quality level is selected using "Manage Video Quality" slider.
// startLastN: 1,
// Provides a way to use different "last N" values based on the number of participants in the conference.
// The keys in an Object represent number of participants and the values are "last N" to be used when number of
// participants gets to or above the number.
//
// For the given example mapping, "last N" will be set to 20 as long as there are at least 5, but less than
// 29 participants in the call and it will be lowered to 15 when the 30th participant joins. The 'channelLastN'
// will be used as default until the first threshold is reached.
//
// lastNLimits: {
// 5: 20,
// 30: 15,
// 50: 10,
// 70: 5,
// 90: 2,
// },
// Specify the settings for video quality optimizations on the client.
// videoQuality: {
// // Provides a way to prevent a video codec from being negotiated on the JVB connection. The codec specified

@ -400,9 +400,6 @@ export interface IConfig {
jaasActuatorUrl?: string;
jaasFeedbackMetadataURL?: string;
jaasTokenUrl?: string;
lastNLimits?: {
[key: number]: number;
};
legalUrls?: {
helpCentre: string;
privacy: string;

@ -22,60 +22,3 @@ export function getLastNForQualityLevel(qualityLevel: number, channelLastN: numb
return lastN;
}
/**
* Checks if the given Object is a correct last N limit mapping, converts both keys and values to numbers and sorts
* the keys in ascending order.
*
* @param {Object} lastNLimits - The Object to be verified.
* @returns {undefined|Map<number, number>}
*/
export function validateLastNLimits(lastNLimits: any) {
// Checks if only numbers are used
if (typeof lastNLimits !== 'object'
|| !Object.keys(lastNLimits).length
|| Object.keys(lastNLimits)
.find(limit => limit === null || isNaN(Number(limit))
|| lastNLimits[limit] === null || isNaN(Number(lastNLimits[limit])))) {
return undefined;
}
// Converts to numbers and sorts the keys
const sortedMapping = new Map();
const orderedLimits = Object.keys(lastNLimits)
.map(n => Number(n))
.sort((n1, n2) => n1 - n2);
for (const limit of orderedLimits) {
sortedMapping.set(limit, Number(lastNLimits[limit]));
}
return sortedMapping;
}
/**
* Returns "last N" value which corresponds to a level defined in the {@code lastNLimits} mapping. See
* {@code config.js} for more detailed explanation on how the mapping is defined.
*
* @param {number} participantsCount - The current number of participants in the conference.
* @param {Map<number, number>} [lastNLimits] - The mapping of number of participants to "last N" values. NOTE that
* this function expects a Map that has been preprocessed by {@link validateLastNLimits}, because the keys must be
* sorted in ascending order and both keys and values should be numbers.
* @returns {number|undefined} - A "last N" number if there was a corresponding "last N" value matched with the number
* of participants or {@code undefined} otherwise.
*/
export function limitLastN(participantsCount: number, lastNLimits?: Map<number, number>) {
if (!lastNLimits || !lastNLimits.keys) {
return undefined;
}
let selectedLimit;
for (const participantsN of lastNLimits.keys()) {
if (participantsCount >= participantsN) {
selectedLimit = participantsN;
}
}
return selectedLimit ? lastNLimits.get(selectedLimit) : undefined;
}

@ -16,15 +16,11 @@ import {
PARTICIPANT_KICKED,
PARTICIPANT_LEFT
} from '../participants/actionTypes';
import {
getParticipantById,
getParticipantCount
} from '../participants/functions';
import { getParticipantById } from '../participants/functions';
import MiddlewareRegistry from '../redux/MiddlewareRegistry';
import { isLocalVideoTrackDesktop } from '../tracks/functions';
import { setLastN } from './actions';
import { limitLastN } from './functions';
import logger from './logger';
/**
@ -48,8 +44,6 @@ const _updateLastN = debounce(({ dispatch, getState }: IStore) => {
const { appState } = state['features/background'] || {};
const { enabled: filmStripEnabled } = state['features/filmstrip'];
const config = state['features/base/config'];
const { lastNLimits } = state['features/base/lastn'];
const participantCount = getParticipantCount(state);
const { carMode } = state['features/video-layout'];
// Select the (initial) lastN value based on the following preference order.
@ -58,13 +52,6 @@ const _updateLastN = debounce(({ dispatch, getState }: IStore) => {
// 3. -1 as the default value.
let lastNSelected = config.startLastN ?? (config.channelLastN ?? -1);
// Apply last N limit based on the # of participants and config settings.
const limitedLastN = limitLastN(participantCount, lastNLimits);
if (limitedLastN !== undefined) {
lastNSelected = lastNSelected === -1 ? limitedLastN : Math.min(limitedLastN, lastNSelected);
}
if (typeof appState !== 'undefined' && appState !== 'active') {
lastNSelected = isLocalVideoTrackDesktop(state) ? 1 : 0;
} else if (carMode) {

@ -1,22 +1,13 @@
import {
SET_CONFIG
} from '../config/actionTypes';
import { IConfig } from '../config/configType';
import ReducerRegistry from '../redux/ReducerRegistry';
import { set } from '../redux/functions';
import { SET_LAST_N } from './actionTypes';
import { validateLastNLimits } from './functions';
export interface ILastNState {
lastN?: number;
lastNLimits?: Map<number, number>;
}
ReducerRegistry.register<ILastNState>('features/base/lastn', (state = {}, action): ILastNState => {
switch (action.type) {
case SET_CONFIG:
return _setConfig(state, action);
case SET_LAST_N: {
const { lastN } = action;
@ -29,15 +20,3 @@ ReducerRegistry.register<ILastNState>('features/base/lastn', (state = {}, action
return state;
});
/**
* Reduces a specific Redux action SET_CONFIG.
*
* @param {Object} state - The Redux state of feature base/lastn.
* @param {Action} action - The Redux action SET_CONFIG to reduce.
* @private
* @returns {Object} The new state after the reduction of the specified action.
*/
function _setConfig(state: ILastNState, { config }: { config: IConfig; }) {
return set(state, 'lastNLimits', validateLastNLimits(config.lastNLimits));
}

Loading…
Cancel
Save