From 6efa4f2475b93e4ed980c5c17dfcb2ba23d27142 Mon Sep 17 00:00:00 2001 From: Jaya Allamsetty <54324652+jallamsetty1@users.noreply.github.com> Date: Mon, 3 Apr 2023 15:49:06 -0400 Subject: [PATCH] fix(config) Remove the code related to lastN limits which is not used anymore. --- config.js | 16 ------- react/features/base/config/configType.ts | 3 -- react/features/base/lastn/functions.ts | 57 ------------------------ react/features/base/lastn/middleware.ts | 15 +------ react/features/base/lastn/reducer.ts | 21 --------- 5 files changed, 1 insertion(+), 111 deletions(-) diff --git a/config.js b/config.js index 3c7ce8a0d1..83d6b58341 100644 --- a/config.js +++ b/config.js @@ -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 diff --git a/react/features/base/config/configType.ts b/react/features/base/config/configType.ts index 9d7b01c99c..4a20a9ea0a 100644 --- a/react/features/base/config/configType.ts +++ b/react/features/base/config/configType.ts @@ -400,9 +400,6 @@ export interface IConfig { jaasActuatorUrl?: string; jaasFeedbackMetadataURL?: string; jaasTokenUrl?: string; - lastNLimits?: { - [key: number]: number; - }; legalUrls?: { helpCentre: string; privacy: string; diff --git a/react/features/base/lastn/functions.ts b/react/features/base/lastn/functions.ts index 2c770d303e..9098317d27 100644 --- a/react/features/base/lastn/functions.ts +++ b/react/features/base/lastn/functions.ts @@ -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} - */ -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} [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) { - 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; -} diff --git a/react/features/base/lastn/middleware.ts b/react/features/base/lastn/middleware.ts index 7f9e66ae12..0ffa8eaab0 100644 --- a/react/features/base/lastn/middleware.ts +++ b/react/features/base/lastn/middleware.ts @@ -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) { diff --git a/react/features/base/lastn/reducer.ts b/react/features/base/lastn/reducer.ts index 79699324c4..d34f3a5473 100644 --- a/react/features/base/lastn/reducer.ts +++ b/react/features/base/lastn/reducer.ts @@ -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; } ReducerRegistry.register('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('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)); -}