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.
This commit is contained in:
Leonard Kim 2018-07-23 15:42:57 -07:00 committed by virtuacoplenny
parent fd78203ff8
commit 4d3383c620
7 changed files with 63 additions and 50 deletions

View File

@ -181,11 +181,12 @@ export const SET_PASSWORD_FAILED = Symbol('SET_PASSWORD_FAILED');
* received from remote participants. * received from remote participants.
* *
* { * {
* type: SET_RECEIVE_VIDEO_QUALITY, * type: SET_PREFERRED_RECEIVER_VIDEO_QUALITY,
* receiveVideoQuality: number * 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 * The type of (redux) action which sets the name of the room of the

View File

@ -39,7 +39,7 @@ import {
SET_LASTN, SET_LASTN,
SET_PASSWORD, SET_PASSWORD,
SET_PASSWORD_FAILED, SET_PASSWORD_FAILED,
SET_RECEIVE_VIDEO_QUALITY, SET_PREFERRED_RECEIVER_VIDEO_QUALITY,
SET_ROOM, SET_ROOM,
SET_START_MUTED_POLICY SET_START_MUTED_POLICY
} from './actionTypes'; } from './actionTypes';
@ -643,16 +643,18 @@ export function setPassword(
/** /**
* Sets the max frame height to receive from remote participant videos. * 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 {{ * @returns {{
* type: SET_RECEIVE_VIDEO_QUALITY, * type: SET_PREFERRED_RECEIVER_VIDEO_QUALITY,
* receiveVideoQuality: number * preferredReceiverVideoQuality: number
* }} * }}
*/ */
export function setReceiveVideoQuality(receiveVideoQuality: number) { export function setPreferredReceiverVideoQuality(
preferredReceiverVideoQuality: number) {
return { return {
type: SET_RECEIVE_VIDEO_QUALITY, type: SET_PREFERRED_RECEIVER_VIDEO_QUALITY,
receiveVideoQuality preferredReceiverVideoQuality
}; };
} }

View File

@ -34,7 +34,7 @@ import {
DATA_CHANNEL_OPENED, DATA_CHANNEL_OPENED,
SET_AUDIO_ONLY, SET_AUDIO_ONLY,
SET_LASTN, SET_LASTN,
SET_RECEIVE_VIDEO_QUALITY, SET_PREFERRED_RECEIVER_VIDEO_QUALITY,
SET_ROOM SET_ROOM
} from './actionTypes'; } from './actionTypes';
import { import {
@ -80,8 +80,8 @@ MiddlewareRegistry.register(store => next => action => {
case SET_LASTN: case SET_LASTN:
return _setLastN(store, next, action); return _setLastN(store, next, action);
case SET_RECEIVE_VIDEO_QUALITY: case SET_PREFERRED_RECEIVER_VIDEO_QUALITY:
return _setReceiveVideoQuality(store, next, action); return _setPreferredReceiverVideoQuality(store, next, action);
case SET_ROOM: case SET_ROOM:
return _setRoom(store, next, action); return _setRoom(store, next, action);
@ -441,16 +441,22 @@ function _setLastN({ getState }, next, action) {
* is being dispatched. * is being dispatched.
* @param {Dispatch} next - The redux {@code dispatch} function to dispatch the * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
* specified {@code action} to the specified {@code store}. * specified {@code action} to the specified {@code store}.
* @param {Action} action - The redux action {@code SET_RECEIVE_VIDEO_QUALITY} * @param {Action} action - The redux action
* which is being dispatched in the specified {@code store}. * {@code SET_PREFERRED_RECEIVER_VIDEO_QUALITY} which is being dispatched in the
* specified {@code store}.
* @private * @private
* @returns {Object} The value returned by {@code next(action)}. * @returns {Object} The value returned by {@code next(action)}.
*/ */
function _setReceiveVideoQuality({ dispatch, getState }, next, action) { function _setPreferredReceiverVideoQuality(
const { audioOnly, conference } = getState()['features/base/conference']; { dispatch, getState },
next,
action) {
const { audioOnly, conference }
= getState()['features/base/conference'];
if (conference) { if (conference) {
conference.setReceiverVideoConstraint(action.receiveVideoQuality); conference.setReceiverVideoConstraint(
action.preferredReceiverVideoQuality);
audioOnly && dispatch(toggleAudioOnly()); audioOnly && dispatch(toggleAudioOnly());
} }
@ -546,7 +552,8 @@ function _syncConferenceLocalTracksWithState({ getState }, action) {
function _syncReceiveVideoQuality({ getState }, next, action) { function _syncReceiveVideoQuality({ getState }, next, action) {
const state = getState()['features/base/conference']; const state = getState()['features/base/conference'];
state.conference.setReceiverVideoConstraint(state.receiveVideoQuality); state.conference.setReceiverVideoConstraint(
state.preferredReceiverVideoQuality);
return next(action); return next(action);
} }

View File

@ -18,7 +18,7 @@ import {
SET_DESKTOP_SHARING_ENABLED, SET_DESKTOP_SHARING_ENABLED,
SET_FOLLOW_ME, SET_FOLLOW_ME,
SET_PASSWORD, SET_PASSWORD,
SET_RECEIVE_VIDEO_QUALITY, SET_PREFERRED_RECEIVER_VIDEO_QUALITY,
SET_ROOM, SET_ROOM,
SET_SIP_GATEWAY_ENABLED, SET_SIP_GATEWAY_ENABLED,
SET_START_MUTED_POLICY SET_START_MUTED_POLICY
@ -72,8 +72,8 @@ ReducerRegistry.register('features/base/conference', (state = {}, action) => {
case SET_PASSWORD: case SET_PASSWORD:
return _setPassword(state, action); return _setPassword(state, action);
case SET_RECEIVE_VIDEO_QUALITY: case SET_PREFERRED_RECEIVER_VIDEO_QUALITY:
return _setReceiveVideoQuality(state, action); return _setPreferredReceiverVideoQuality(state, action);
case SET_ROOM: case SET_ROOM:
return _setRoom(state, action); return _setRoom(state, action);
@ -211,7 +211,7 @@ function _conferenceJoined(state, { conference }) {
* *
* @type number * @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 * Reduces a specific Redux action {@code SET_PREFERRED_RECEIVER_VIDEO_QUALITY}
* base/conference. * of the feature base/conference.
* *
* @param {Object} state - The Redux state 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 * @param {Action} action - The Redux action of type
* reduce. * {@code SET_PREFERRED_RECEIVER_VIDEO_QUALITY} to reduce.
* @private * @private
* @returns {Object} The new state of the feature base/conference after the * @returns {Object} The new state of the feature base/conference after the
* reduction of the specified action. * reduction of the specified action.
*/ */
function _setReceiveVideoQuality(state, action) { function _setPreferredReceiverVideoQuality(state, action) {
return set(state, 'receiveVideoQuality', action.receiveVideoQuality); return set(
state,
'preferredReceiverVideoQuality',
action.preferredReceiverVideoQuality);
} }
/** /**

View File

@ -6,7 +6,7 @@ import {
KICKED_OUT, KICKED_OUT,
VIDEO_QUALITY_LEVELS, VIDEO_QUALITY_LEVELS,
conferenceFailed, conferenceFailed,
setReceiveVideoQuality setPreferredReceiverVideoQuality
} from '../base/conference'; } from '../base/conference';
import { JitsiConferenceEvents } from '../base/lib-jitsi-meet'; import { JitsiConferenceEvents } from '../base/lib-jitsi-meet';
import { SET_REDUCED_UI } from '../base/responsive-ui'; 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. // audio-only mode if engaged, that's why we check for it here.
audioOnly audioOnly
|| dispatch( || dispatch(
setReceiveVideoQuality( setPreferredReceiverVideoQuality(
reducedUI reducedUI
? VIDEO_QUALITY_LEVELS.LOW ? VIDEO_QUALITY_LEVELS.LOW
: VIDEO_QUALITY_LEVELS.HIGH)); : VIDEO_QUALITY_LEVELS.HIGH));

View File

@ -33,7 +33,7 @@ type Props = {
* The currently configured maximum quality resolution to be received from * The currently configured maximum quality resolution to be received from
* remote participants. * remote participants.
*/ */
_receiveVideoQuality: number, _receiverVideoQuality: number,
/** /**
* Callback to invoke when {@link OverflowMenuVideoQualityItem} is clicked. * Callback to invoke when {@link OverflowMenuVideoQualityItem} is clicked.
@ -61,10 +61,10 @@ class OverflowMenuVideoQualityItem extends Component<Props> {
* @returns {ReactElement} * @returns {ReactElement}
*/ */
render() { render() {
const { _audioOnly, _receiveVideoQuality } = this.props; const { _audioOnly, _receiverVideoQuality } = this.props;
const icon = _audioOnly || !_receiveVideoQuality const icon = _audioOnly || !_receiverVideoQuality
? 'icon-AUD' ? 'icon-AUD'
: VIDEO_QUALITY_TO_ICON[_receiveVideoQuality]; : VIDEO_QUALITY_TO_ICON[_receiverVideoQuality];
return ( return (
<li <li
@ -91,14 +91,14 @@ class OverflowMenuVideoQualityItem extends Component<Props> {
* @private * @private
* @returns {{ * @returns {{
* _audioOnly: boolean, * _audioOnly: boolean,
* _receiveVideoQuality: number * _receiverVideoQuality: number
* }} * }}
*/ */
function _mapStateToProps(state) { function _mapStateToProps(state) {
return { return {
_audioOnly: state['features/base/conference'].audioOnly, _audioOnly: state['features/base/conference'].audioOnly,
_receiveVideoQuality: _receiverVideoQuality:
state['features/base/conference'].receiveVideoQuality state['features/base/conference'].preferredReceiverVideoQuality
}; };
} }

View File

@ -10,7 +10,7 @@ import {
import { import {
VIDEO_QUALITY_LEVELS, VIDEO_QUALITY_LEVELS,
setAudioOnly, setAudioOnly,
setReceiveVideoQuality setPreferredReceiverVideoQuality
} from '../../base/conference'; } from '../../base/conference';
import { translate } from '../../base/i18n'; import { translate } from '../../base/i18n';
import JitsiMeetJS from '../../base/lib-jitsi-meet'; import JitsiMeetJS from '../../base/lib-jitsi-meet';
@ -66,7 +66,7 @@ class VideoQualitySlider extends Component {
* The currently configured maximum quality resolution to be received * The currently configured maximum quality resolution to be received
* from remote participants. * from remote participants.
*/ */
_receiveVideoQuality: PropTypes.number, _receiverVideoQuality: PropTypes.number,
/** /**
* Whether or not displaying video is supported in the current * Whether or not displaying video is supported in the current
@ -284,7 +284,7 @@ class VideoQualitySlider extends Component {
_enableHighDefinition() { _enableHighDefinition() {
sendAnalytics(createEvent('high')); sendAnalytics(createEvent('high'));
logger.log('Video quality: high enabled'); 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() { _enableLowDefinition() {
sendAnalytics(createEvent('low')); sendAnalytics(createEvent('low'));
logger.log('Video quality: low enabled'); 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() { _enableStandardDefinition() {
sendAnalytics(createEvent('standard')); sendAnalytics(createEvent('standard'));
logger.log('Video quality: standard enabled'); 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} * @returns {void}
*/ */
_mapCurrentQualityToSliderValue() { _mapCurrentQualityToSliderValue() {
const { _audioOnly, _receiveVideoQuality } = this.props; const { _audioOnly, _receiverVideoQuality } = this.props;
const { _sliderOptions } = this; const { _sliderOptions } = this;
if (_audioOnly) { if (_audioOnly) {
@ -332,7 +332,7 @@ class VideoQualitySlider extends Component {
} }
const matchingOption = _sliderOptions.find( const matchingOption = _sliderOptions.find(
({ videoQuality }) => videoQuality === _receiveVideoQuality); ({ videoQuality }) => videoQuality === _receiverVideoQuality);
return _sliderOptions.indexOf(matchingOption); return _sliderOptions.indexOf(matchingOption);
} }
@ -345,7 +345,7 @@ class VideoQualitySlider extends Component {
* @returns {void} * @returns {void}
*/ */
_onSliderChange(event) { _onSliderChange(event) {
const { _audioOnly, _receiveVideoQuality } = this.props; const { _audioOnly, _receiverVideoQuality } = this.props;
const { const {
audioOnly, audioOnly,
onSelect, onSelect,
@ -355,7 +355,7 @@ class VideoQualitySlider extends Component {
// Take no action if the newly chosen option does not change audio only // Take no action if the newly chosen option does not change audio only
// or video quality state. // or video quality state.
if ((_audioOnly && audioOnly) if ((_audioOnly && audioOnly)
|| (!_audioOnly && videoQuality === _receiveVideoQuality)) { || (!_audioOnly && videoQuality === _receiverVideoQuality)) {
return; return;
} }
@ -372,20 +372,20 @@ class VideoQualitySlider extends Component {
* @returns {{ * @returns {{
* _audioOnly: boolean, * _audioOnly: boolean,
* _p2p: boolean, * _p2p: boolean,
* _receiveVideoQuality: boolean * _receiverVideoQuality: boolean
* }} * }}
*/ */
function _mapStateToProps(state) { function _mapStateToProps(state) {
const { const {
audioOnly, audioOnly,
p2p, p2p,
receiveVideoQuality preferredReceiverVideoQuality
} = state['features/base/conference']; } = state['features/base/conference'];
return { return {
_audioOnly: audioOnly, _audioOnly: audioOnly,
_p2p: p2p, _p2p: p2p,
_receiveVideoQuality: receiveVideoQuality, _receiverVideoQuality: preferredReceiverVideoQuality,
_videoSupported: JitsiMeetJS.mediaDevices.supportsVideo() _videoSupported: JitsiMeetJS.mediaDevices.supportsVideo()
}; };
} }