mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-05-10 14:12:33 +00:00
* feat: Change the screenshare capture fps from UI. Add the ability to change the capture frame rate for screenshare from the UI. The fps becomes effective only on screen shares that are started after the setting is changed. * squash: add missing JSDOCs and translations for frames-per-second.
58 lines
1.4 KiB
JavaScript
58 lines
1.4 KiB
JavaScript
// @flow
|
|
|
|
import { CONFERENCE_JOINED } from '../base/conference';
|
|
import { MiddlewareRegistry } from '../base/redux';
|
|
|
|
import { SET_SCREENSHARE_CAPTURE_FRAME_RATE } from './actionTypes';
|
|
import logger from './logger';
|
|
|
|
/**
|
|
* Implements the middleware of the feature screen-share.
|
|
*
|
|
* @param {Store} store - The redux store.
|
|
* @returns {Function}
|
|
*/
|
|
MiddlewareRegistry.register(store => next => action => {
|
|
const result = next(action);
|
|
|
|
switch (action.type) {
|
|
case CONFERENCE_JOINED: {
|
|
_setScreenshareCaptureFps(store);
|
|
break;
|
|
}
|
|
case SET_SCREENSHARE_CAPTURE_FRAME_RATE: {
|
|
const { captureFrameRate } = action;
|
|
|
|
_setScreenshareCaptureFps(store, captureFrameRate);
|
|
break;
|
|
}
|
|
}
|
|
|
|
return result;
|
|
});
|
|
|
|
/**
|
|
* Sets the capture frame rate for screenshare.
|
|
*
|
|
* @param {Store} store - The redux store.
|
|
* @param {number} frameRate - Frame rate to be configured.
|
|
* @private
|
|
* @returns {void}
|
|
*/
|
|
function _setScreenshareCaptureFps(store, frameRate) {
|
|
const state = store.getState();
|
|
const { conference } = state['features/base/conference'];
|
|
const { captureFrameRate } = state['features/screen-share'];
|
|
const screenShareFps = frameRate ?? captureFrameRate;
|
|
|
|
if (!conference) {
|
|
return;
|
|
}
|
|
|
|
if (screenShareFps) {
|
|
logger.debug(`Setting screenshare capture frame rate as ${screenShareFps}`);
|
|
conference.setDesktopSharingFrameRate(screenShareFps);
|
|
}
|
|
|
|
}
|