Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

functions.ts 883B

123456789101112131415161718192021222324
  1. import { VIDEO_QUALITY_LEVELS } from '../../video-quality/constants';
  2. /**
  3. * Determines the lastN value to be used for the conference based on the video quality selected.
  4. *
  5. * @param {string} qualityLevel - Quality level (height) selected.
  6. * @param {number} channelLastN - LastN value set for the whole conference.
  7. * @returns {number} LastN value applicable to the quality level specified.
  8. */
  9. export function getLastNForQualityLevel(qualityLevel: number, channelLastN: number) {
  10. let lastN = channelLastN;
  11. const videoQualityLevels = Object.values(VIDEO_QUALITY_LEVELS);
  12. for (const lvl in videoQualityLevels) {
  13. if (videoQualityLevels.hasOwnProperty(lvl)
  14. && qualityLevel === videoQualityLevels[lvl]
  15. && Number(lvl) > 1) {
  16. lastN = Math.floor(channelLastN / Math.pow(2, Number(lvl) - 1));
  17. }
  18. }
  19. return lastN;
  20. }