snapshot of https://github.com/jitsi/jitsi-meet.git @ fd1749dd28f4138aa80234fc7f311b19aaffa0e7 (2026-09-15)
This commit is contained in:
24
react/features/base/lastn/functions.ts
Normal file
24
react/features/base/lastn/functions.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { VIDEO_QUALITY_LEVELS } from '../../video-quality/constants';
|
||||
|
||||
/**
|
||||
* Determines the lastN value to be used for the conference based on the video quality selected.
|
||||
*
|
||||
* @param {string} qualityLevel - Quality level (height) selected.
|
||||
* @param {number} channelLastN - LastN value set for the whole conference.
|
||||
* @returns {number} LastN value applicable to the quality level specified.
|
||||
*/
|
||||
export function getLastNForQualityLevel(qualityLevel: number, channelLastN: number) {
|
||||
let lastN = channelLastN;
|
||||
|
||||
const videoQualityLevels = Object.values(VIDEO_QUALITY_LEVELS);
|
||||
|
||||
for (const lvl in videoQualityLevels) {
|
||||
if (videoQualityLevels.hasOwnProperty(lvl)
|
||||
&& qualityLevel === videoQualityLevels[lvl]
|
||||
&& Number(lvl) > 1) {
|
||||
lastN = Math.floor(channelLastN / Math.pow(2, Number(lvl) - 1));
|
||||
}
|
||||
}
|
||||
|
||||
return lastN;
|
||||
}
|
||||
Reference in New Issue
Block a user