From 4d3383c620e01d3fa1a48a51a84198beccdaf03e Mon Sep 17 00:00:00 2001 From: Leonard Kim Date: Mon, 23 Jul 2018 15:42:57 -0700 Subject: [PATCH] ref(video-quality): rename receiveVideoQuality to preferredReceiverVideoQuality - "preferred" is being appended because in tile view there is a concept of what the user prefers to be the maximum video quality but there is also a maximum respected internall. For example, the user may prefer HD, but in tile view the tiles may be small so internall the preferred would be set to LD. - "receive" is being renamed to "receiver" to be consistent with the naming in lib-jitsi-meet. --- react/features/base/conference/actionTypes.js | 7 +++--- react/features/base/conference/actions.js | 16 ++++++------ react/features/base/conference/middleware.js | 25 ++++++++++++------- react/features/base/conference/reducer.js | 23 +++++++++-------- react/features/conference/middleware.js | 4 +-- .../OverflowMenuVideoQualityItem.web.js | 14 +++++------ .../components/VideoQualitySlider.web.js | 24 +++++++++--------- 7 files changed, 63 insertions(+), 50 deletions(-) diff --git a/react/features/base/conference/actionTypes.js b/react/features/base/conference/actionTypes.js index bfa14208b..fbc03d59b 100644 --- a/react/features/base/conference/actionTypes.js +++ b/react/features/base/conference/actionTypes.js @@ -181,11 +181,12 @@ export const SET_PASSWORD_FAILED = Symbol('SET_PASSWORD_FAILED'); * received from remote participants. * * { - * type: SET_RECEIVE_VIDEO_QUALITY, - * receiveVideoQuality: number + * type: SET_PREFERRED_RECEIVER_VIDEO_QUALITY, + * preferredReceiverVideoQuality: number * } */ -export const SET_RECEIVE_VIDEO_QUALITY = Symbol('SET_RECEIVE_VIDEO_QUALITY'); +export const SET_PREFERRED_RECEIVER_VIDEO_QUALITY + = Symbol('SET_PREFERRED_RECEIVER_VIDEO_QUALITY'); /** * The type of (redux) action which sets the name of the room of the diff --git a/react/features/base/conference/actions.js b/react/features/base/conference/actions.js index 5a537e05b..ddbc75c6c 100644 --- a/react/features/base/conference/actions.js +++ b/react/features/base/conference/actions.js @@ -39,7 +39,7 @@ import { SET_LASTN, SET_PASSWORD, SET_PASSWORD_FAILED, - SET_RECEIVE_VIDEO_QUALITY, + SET_PREFERRED_RECEIVER_VIDEO_QUALITY, SET_ROOM, SET_START_MUTED_POLICY } from './actionTypes'; @@ -643,16 +643,18 @@ export function setPassword( /** * Sets the max frame height to receive from remote participant videos. * - * @param {number} receiveVideoQuality - The max video resolution to receive. + * @param {number} preferredReceiverVideoQuality - The max video resolution to + * receive. * @returns {{ - * type: SET_RECEIVE_VIDEO_QUALITY, - * receiveVideoQuality: number + * type: SET_PREFERRED_RECEIVER_VIDEO_QUALITY, + * preferredReceiverVideoQuality: number * }} */ -export function setReceiveVideoQuality(receiveVideoQuality: number) { +export function setPreferredReceiverVideoQuality( + preferredReceiverVideoQuality: number) { return { - type: SET_RECEIVE_VIDEO_QUALITY, - receiveVideoQuality + type: SET_PREFERRED_RECEIVER_VIDEO_QUALITY, + preferredReceiverVideoQuality }; } diff --git a/react/features/base/conference/middleware.js b/react/features/base/conference/middleware.js index 6b76681e0..742458e62 100644 --- a/react/features/base/conference/middleware.js +++ b/react/features/base/conference/middleware.js @@ -34,7 +34,7 @@ import { DATA_CHANNEL_OPENED, SET_AUDIO_ONLY, SET_LASTN, - SET_RECEIVE_VIDEO_QUALITY, + SET_PREFERRED_RECEIVER_VIDEO_QUALITY, SET_ROOM } from './actionTypes'; import { @@ -80,8 +80,8 @@ MiddlewareRegistry.register(store => next => action => { case SET_LASTN: return _setLastN(store, next, action); - case SET_RECEIVE_VIDEO_QUALITY: - return _setReceiveVideoQuality(store, next, action); + case SET_PREFERRED_RECEIVER_VIDEO_QUALITY: + return _setPreferredReceiverVideoQuality(store, next, action); case SET_ROOM: return _setRoom(store, next, action); @@ -441,16 +441,22 @@ function _setLastN({ getState }, next, action) { * is being dispatched. * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the * specified {@code action} to the specified {@code store}. - * @param {Action} action - The redux action {@code SET_RECEIVE_VIDEO_QUALITY} - * which is being dispatched in the specified {@code store}. + * @param {Action} action - The redux action + * {@code SET_PREFERRED_RECEIVER_VIDEO_QUALITY} which is being dispatched in the + * specified {@code store}. * @private * @returns {Object} The value returned by {@code next(action)}. */ -function _setReceiveVideoQuality({ dispatch, getState }, next, action) { - const { audioOnly, conference } = getState()['features/base/conference']; +function _setPreferredReceiverVideoQuality( + { dispatch, getState }, + next, + action) { + const { audioOnly, conference } + = getState()['features/base/conference']; if (conference) { - conference.setReceiverVideoConstraint(action.receiveVideoQuality); + conference.setReceiverVideoConstraint( + action.preferredReceiverVideoQuality); audioOnly && dispatch(toggleAudioOnly()); } @@ -546,7 +552,8 @@ function _syncConferenceLocalTracksWithState({ getState }, action) { function _syncReceiveVideoQuality({ getState }, next, action) { const state = getState()['features/base/conference']; - state.conference.setReceiverVideoConstraint(state.receiveVideoQuality); + state.conference.setReceiverVideoConstraint( + state.preferredReceiverVideoQuality); return next(action); } diff --git a/react/features/base/conference/reducer.js b/react/features/base/conference/reducer.js index e3beaec72..3578d8df2 100644 --- a/react/features/base/conference/reducer.js +++ b/react/features/base/conference/reducer.js @@ -18,7 +18,7 @@ import { SET_DESKTOP_SHARING_ENABLED, SET_FOLLOW_ME, SET_PASSWORD, - SET_RECEIVE_VIDEO_QUALITY, + SET_PREFERRED_RECEIVER_VIDEO_QUALITY, SET_ROOM, SET_SIP_GATEWAY_ENABLED, SET_START_MUTED_POLICY @@ -72,8 +72,8 @@ ReducerRegistry.register('features/base/conference', (state = {}, action) => { case SET_PASSWORD: return _setPassword(state, action); - case SET_RECEIVE_VIDEO_QUALITY: - return _setReceiveVideoQuality(state, action); + case SET_PREFERRED_RECEIVER_VIDEO_QUALITY: + return _setPreferredReceiverVideoQuality(state, action); case SET_ROOM: return _setRoom(state, action); @@ -211,7 +211,7 @@ function _conferenceJoined(state, { conference }) { * * @type number */ - receiveVideoQuality: VIDEO_QUALITY_LEVELS.HIGH + preferredReceiverVideoQuality: VIDEO_QUALITY_LEVELS.HIGH }); } @@ -403,18 +403,21 @@ function _setPassword(state, { conference, method, password }) { } /** - * Reduces a specific Redux action SET_RECEIVE_VIDEO_QUALITY of the feature - * base/conference. + * Reduces a specific Redux action {@code SET_PREFERRED_RECEIVER_VIDEO_QUALITY} + * of the feature base/conference. * * @param {Object} state - The Redux state of the feature base/conference. - * @param {Action} action - The Redux action SET_RECEIVE_VIDEO_QUALITY to - * reduce. + * @param {Action} action - The Redux action of type + * {@code SET_PREFERRED_RECEIVER_VIDEO_QUALITY} to reduce. * @private * @returns {Object} The new state of the feature base/conference after the * reduction of the specified action. */ -function _setReceiveVideoQuality(state, action) { - return set(state, 'receiveVideoQuality', action.receiveVideoQuality); +function _setPreferredReceiverVideoQuality(state, action) { + return set( + state, + 'preferredReceiverVideoQuality', + action.preferredReceiverVideoQuality); } /** diff --git a/react/features/conference/middleware.js b/react/features/conference/middleware.js index 54699f506..c667b8c25 100644 --- a/react/features/conference/middleware.js +++ b/react/features/conference/middleware.js @@ -6,7 +6,7 @@ import { KICKED_OUT, VIDEO_QUALITY_LEVELS, conferenceFailed, - setReceiveVideoQuality + setPreferredReceiverVideoQuality } from '../base/conference'; import { JitsiConferenceEvents } from '../base/lib-jitsi-meet'; import { SET_REDUCED_UI } from '../base/responsive-ui'; @@ -32,7 +32,7 @@ MiddlewareRegistry.register(store => next => action => { // audio-only mode if engaged, that's why we check for it here. audioOnly || dispatch( - setReceiveVideoQuality( + setPreferredReceiverVideoQuality( reducedUI ? VIDEO_QUALITY_LEVELS.LOW : VIDEO_QUALITY_LEVELS.HIGH)); diff --git a/react/features/video-quality/components/OverflowMenuVideoQualityItem.web.js b/react/features/video-quality/components/OverflowMenuVideoQualityItem.web.js index bbc78f42c..e9a157c13 100644 --- a/react/features/video-quality/components/OverflowMenuVideoQualityItem.web.js +++ b/react/features/video-quality/components/OverflowMenuVideoQualityItem.web.js @@ -33,7 +33,7 @@ type Props = { * The currently configured maximum quality resolution to be received from * remote participants. */ - _receiveVideoQuality: number, + _receiverVideoQuality: number, /** * Callback to invoke when {@link OverflowMenuVideoQualityItem} is clicked. @@ -61,10 +61,10 @@ class OverflowMenuVideoQualityItem extends Component { * @returns {ReactElement} */ render() { - const { _audioOnly, _receiveVideoQuality } = this.props; - const icon = _audioOnly || !_receiveVideoQuality + const { _audioOnly, _receiverVideoQuality } = this.props; + const icon = _audioOnly || !_receiverVideoQuality ? 'icon-AUD' - : VIDEO_QUALITY_TO_ICON[_receiveVideoQuality]; + : VIDEO_QUALITY_TO_ICON[_receiverVideoQuality]; return (
  • { * @private * @returns {{ * _audioOnly: boolean, - * _receiveVideoQuality: number + * _receiverVideoQuality: number * }} */ function _mapStateToProps(state) { return { _audioOnly: state['features/base/conference'].audioOnly, - _receiveVideoQuality: - state['features/base/conference'].receiveVideoQuality + _receiverVideoQuality: + state['features/base/conference'].preferredReceiverVideoQuality }; } diff --git a/react/features/video-quality/components/VideoQualitySlider.web.js b/react/features/video-quality/components/VideoQualitySlider.web.js index 9a39586c0..12d14aa72 100644 --- a/react/features/video-quality/components/VideoQualitySlider.web.js +++ b/react/features/video-quality/components/VideoQualitySlider.web.js @@ -10,7 +10,7 @@ import { import { VIDEO_QUALITY_LEVELS, setAudioOnly, - setReceiveVideoQuality + setPreferredReceiverVideoQuality } from '../../base/conference'; import { translate } from '../../base/i18n'; import JitsiMeetJS from '../../base/lib-jitsi-meet'; @@ -66,7 +66,7 @@ class VideoQualitySlider extends Component { * The currently configured maximum quality resolution to be received * from remote participants. */ - _receiveVideoQuality: PropTypes.number, + _receiverVideoQuality: PropTypes.number, /** * Whether or not displaying video is supported in the current @@ -284,7 +284,7 @@ class VideoQualitySlider extends Component { _enableHighDefinition() { sendAnalytics(createEvent('high')); logger.log('Video quality: high enabled'); - this.props.dispatch(setReceiveVideoQuality(HIGH)); + this.props.dispatch(setPreferredReceiverVideoQuality(HIGH)); } /** @@ -297,7 +297,7 @@ class VideoQualitySlider extends Component { _enableLowDefinition() { sendAnalytics(createEvent('low')); logger.log('Video quality: low enabled'); - this.props.dispatch(setReceiveVideoQuality(LOW)); + this.props.dispatch(setPreferredReceiverVideoQuality(LOW)); } /** @@ -310,7 +310,7 @@ class VideoQualitySlider extends Component { _enableStandardDefinition() { sendAnalytics(createEvent('standard')); logger.log('Video quality: standard enabled'); - this.props.dispatch(setReceiveVideoQuality(STANDARD)); + this.props.dispatch(setPreferredReceiverVideoQuality(STANDARD)); } /** @@ -321,7 +321,7 @@ class VideoQualitySlider extends Component { * @returns {void} */ _mapCurrentQualityToSliderValue() { - const { _audioOnly, _receiveVideoQuality } = this.props; + const { _audioOnly, _receiverVideoQuality } = this.props; const { _sliderOptions } = this; if (_audioOnly) { @@ -332,7 +332,7 @@ class VideoQualitySlider extends Component { } const matchingOption = _sliderOptions.find( - ({ videoQuality }) => videoQuality === _receiveVideoQuality); + ({ videoQuality }) => videoQuality === _receiverVideoQuality); return _sliderOptions.indexOf(matchingOption); } @@ -345,7 +345,7 @@ class VideoQualitySlider extends Component { * @returns {void} */ _onSliderChange(event) { - const { _audioOnly, _receiveVideoQuality } = this.props; + const { _audioOnly, _receiverVideoQuality } = this.props; const { audioOnly, onSelect, @@ -355,7 +355,7 @@ class VideoQualitySlider extends Component { // Take no action if the newly chosen option does not change audio only // or video quality state. if ((_audioOnly && audioOnly) - || (!_audioOnly && videoQuality === _receiveVideoQuality)) { + || (!_audioOnly && videoQuality === _receiverVideoQuality)) { return; } @@ -372,20 +372,20 @@ class VideoQualitySlider extends Component { * @returns {{ * _audioOnly: boolean, * _p2p: boolean, - * _receiveVideoQuality: boolean + * _receiverVideoQuality: boolean * }} */ function _mapStateToProps(state) { const { audioOnly, p2p, - receiveVideoQuality + preferredReceiverVideoQuality } = state['features/base/conference']; return { _audioOnly: audioOnly, _p2p: p2p, - _receiveVideoQuality: receiveVideoQuality, + _receiverVideoQuality: preferredReceiverVideoQuality, _videoSupported: JitsiMeetJS.mediaDevices.supportsVideo() }; }