Skip to content

Commit

Permalink
fix: Make multi-stream mode the default mode.
Browse files Browse the repository at this point in the history
Since plan-b mode will no longer be supported, check for unified plan support is not needed anymore.
  • Loading branch information
jallamsetty1 committed Jan 9, 2024
1 parent 89dd85d commit dcc3924
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 85 deletions.
12 changes: 0 additions & 12 deletions react/features/base/config/functions.any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { safeJsonParse } from '@jitsi/js-utils/json';
import _ from 'lodash';

import { IReduxState } from '../../app/types';
import { browser } from '../lib-jitsi-meet';
import { IMediaState } from '../media/reducer';
import { parseURLParams } from '../util/parseURLParams';

import { IConfig } from './configType';
Expand Down Expand Up @@ -60,16 +58,6 @@ export function getMeetingRegion(state: IReduxState) {
return state['features/base/config']?.deploymentInfo?.region || '';
}

/**
* Selector for determining if sending multiple stream support is enabled.
*
* @param {Object} _state - The global state.
* @returns {boolean}
*/
export function getMultipleVideoSendingSupportFeatureFlag(_state: IReduxState | IMediaState) {
return browser.supportsUnifiedPlan();
}

/**
* Selector used to get the SSRC-rewriting feature flag.
*
Expand Down
8 changes: 2 additions & 6 deletions react/features/base/media/middleware.any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { SET_AUDIO_ONLY } from '../audio-only/actionTypes';
import { setAudioOnly } from '../audio-only/actions';
import { SET_ROOM } from '../conference/actionTypes';
import { isRoomValid } from '../conference/functions';
import { getMultipleVideoSendingSupportFeatureFlag } from '../config/functions.any';
import { getLocalParticipant } from '../participants/functions';
import MiddlewareRegistry from '../redux/MiddlewareRegistry';
import { getPropertyValue } from '../settings/functions.any';
Expand Down Expand Up @@ -186,17 +185,14 @@ function _appStateChanged({ dispatch, getState }: IStore, next: Function, action
* @private
* @returns {Object} The value returned by {@code next(action)}.
*/
function _setAudioOnly({ dispatch, getState }: IStore, next: Function, action: AnyAction) {
function _setAudioOnly({ dispatch }: IStore, next: Function, action: AnyAction) {
const { audioOnly } = action;
const state = getState();

sendAnalytics(createTrackMutedEvent('video', 'audio-only mode', audioOnly));

// Make sure we mute both the desktop and video tracks.
dispatch(setVideoMuted(audioOnly, VIDEO_MUTISM_AUTHORITY.AUDIO_ONLY));
if (getMultipleVideoSendingSupportFeatureFlag(state)) {
dispatch(setScreenshareMuted(audioOnly, SCREENSHARE_MUTISM_AUTHORITY.AUDIO_ONLY));
}
dispatch(setScreenshareMuted(audioOnly, SCREENSHARE_MUTISM_AUTHORITY.AUDIO_ONLY));

return next(action);
}
Expand Down
21 changes: 8 additions & 13 deletions react/features/base/participants/subscriber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import _ from 'lodash';

import { IStore } from '../../app/types';
import { getCurrentConference } from '../conference/functions';
import {
getMultipleVideoSendingSupportFeatureFlag,
getSsrcRewritingFeatureFlag
} from '../config/functions.any';
import { getSsrcRewritingFeatureFlag } from '../config/functions.any';
import { VIDEO_TYPE } from '../media/constants';
import StateListenerRegistry from '../redux/StateListenerRegistry';

Expand Down Expand Up @@ -92,16 +89,14 @@ function _updateScreenshareParticipants(store: IStore): void {
return acc;
}, []);

if (getMultipleVideoSendingSupportFeatureFlag(state)) {
if (!localScreenShare && newLocalSceenshareSourceName) {
dispatch(createVirtualScreenshareParticipant(newLocalSceenshareSourceName, true, conference));
}
if (!localScreenShare && newLocalSceenshareSourceName) {
dispatch(createVirtualScreenshareParticipant(newLocalSceenshareSourceName, true, conference));
}

if (localScreenShare && !newLocalSceenshareSourceName) {
dispatch(participantLeft(localScreenShare.id, conference, {
fakeParticipant: FakeParticipant.LocalScreenShare
}));
}
if (localScreenShare && !newLocalSceenshareSourceName) {
dispatch(participantLeft(localScreenShare.id, conference, {
fakeParticipant: FakeParticipant.LocalScreenShare
}));
}

if (getSsrcRewritingFeatureFlag(state)) {
Expand Down
12 changes: 4 additions & 8 deletions react/features/base/tracks/actions.any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { showErrorNotification, showNotification } from '../../notifications/act
import { NOTIFICATION_TIMEOUT, NOTIFICATION_TIMEOUT_TYPE } from '../../notifications/constants';
import { getCurrentConference } from '../conference/functions';
import { IJitsiConference } from '../conference/reducer';
import { getMultipleVideoSendingSupportFeatureFlag } from '../config/functions.any';
import { JitsiTrackErrors, JitsiTrackEvents } from '../lib-jitsi-meet';
import { createLocalTrack } from '../lib-jitsi-meet/functions.any';
import { setAudioMuted, setScreenshareMuted, setVideoMuted } from '../media/actions';
Expand Down Expand Up @@ -59,8 +58,7 @@ export function addLocalTrack(newTrack: any) {
}

const setMuted = newTrack.isVideoTrack()
? getMultipleVideoSendingSupportFeatureFlag(getState())
&& newTrack.getVideoType() === VIDEO_TYPE.DESKTOP
? newTrack.getVideoType() === VIDEO_TYPE.DESKTOP
? setScreenshareMuted
: setVideoMuted
: setAudioMuted;
Expand Down Expand Up @@ -337,7 +335,7 @@ export function replaceLocalTrack(oldTrack: any, newTrack: any, conference?: IJi
* @returns {Function}
*/
function replaceStoredTracks(oldTrack: any, newTrack: any) {
return async (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
return async (dispatch: IStore['dispatch']) => {
// We call dispose after doing the replace because dispose will
// try and do a new o/a after the track removes itself. Doing it
// after means the JitsiLocalTrack.conference is already
Expand All @@ -353,8 +351,7 @@ function replaceStoredTracks(oldTrack: any, newTrack: any) {
// state. If this is not done, the current mute state of the app will be reflected on the track,
// not vice-versa.
const setMuted = newTrack.isVideoTrack()
? getMultipleVideoSendingSupportFeatureFlag(getState())
&& newTrack.getVideoType() === VIDEO_TYPE.DESKTOP
? newTrack.getVideoType() === VIDEO_TYPE.DESKTOP
? setScreenshareMuted
: setVideoMuted
: setAudioMuted;
Expand Down Expand Up @@ -388,8 +385,7 @@ export function trackAdded(track: any) {
JitsiTrackEvents.TRACK_OWNER_CHANGED,
(owner: string) => dispatch(trackOwnerChanged(track, owner)));
const local = track.isLocal();
const isVirtualScreenshareParticipantCreated = !local || getMultipleVideoSendingSupportFeatureFlag(getState());
const mediaType = track.getVideoType() === VIDEO_TYPE.DESKTOP && isVirtualScreenshareParticipantCreated
const mediaType = track.getVideoType() === VIDEO_TYPE.DESKTOP
? MEDIA_TYPE.SCREENSHARE
: track.getType();
let isReceivingData, noDataFromSourceNotificationInfo, participantId;
Expand Down
6 changes: 1 addition & 5 deletions react/features/base/tracks/functions.any.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { IReduxState, IStore } from '../../app/types';
import {
getMultipleVideoSendingSupportFeatureFlag
} from '../config/functions.any';
import { JitsiTrackErrors, browser } from '../lib-jitsi-meet';
import { gumPending } from '../media/actions';
import { CAMERA_FACING_MODE, MEDIA_TYPE, MediaType, VIDEO_TYPE } from '../media/constants';
Expand Down Expand Up @@ -400,8 +397,7 @@ export function setTrackMuted(track: any, muted: boolean, state: IReduxState | I
// Ignore the check for desktop track muted operation. When the screenshare is terminated by clicking on the
// browser's 'Stop sharing' button, the local stream is stopped before the inactive stream handler is fired.
// We still need to proceed here and remove the track from the peerconnection.
if (track.isMuted() === muted
&& !(track.getVideoType() === VIDEO_TYPE.DESKTOP && getMultipleVideoSendingSupportFeatureFlag(state))) {
if (track.isMuted() === muted && track.getVideoType() !== VIDEO_TYPE.DESKTOP) {
return Promise.resolve();
}

Expand Down
23 changes: 6 additions & 17 deletions react/features/base/tracks/middleware.any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { IStore } from '../../app/types';
import { _RESET_BREAKOUT_ROOMS } from '../../breakout-rooms/actionTypes';
import { isPrejoinPageVisible } from '../../prejoin/functions';
import { getCurrentConference } from '../conference/functions';
import { getMultipleVideoSendingSupportFeatureFlag } from '../config/functions.any';
import {
SET_AUDIO_MUTED,
SET_CAMERA_FACING_MODE,
Expand All @@ -16,9 +15,7 @@ import { gumPending, toggleCameraFacingMode } from '../media/actions';
import {
CAMERA_FACING_MODE,
MEDIA_TYPE,
MediaType,
SCREENSHARE_MUTISM_AUTHORITY,
VIDEO_MUTISM_AUTHORITY
MediaType
} from '../media/constants';
import { IGUMPendingState } from '../media/types';
import MiddlewareRegistry from '../redux/MiddlewareRegistry';
Expand Down Expand Up @@ -186,15 +183,13 @@ function _getLocalTrack(
* @private
* @returns {void}
*/
async function _setMuted(store: IStore, { ensureTrack, authority, muted }: {
authority: number; ensureTrack: boolean; muted: boolean; }, mediaType: MediaType) {
async function _setMuted(store: IStore, { ensureTrack, muted }: {
ensureTrack: boolean; muted: boolean; }, mediaType: MediaType) {
const { dispatch, getState } = store;
const localTrack = _getLocalTrack(store, mediaType, /* includePending */ true);
const state = getState();

if (mediaType === MEDIA_TYPE.SCREENSHARE
&& getMultipleVideoSendingSupportFeatureFlag(state)
&& !muted) {
if (mediaType === MEDIA_TYPE.SCREENSHARE && !muted) {
return;
}

Expand All @@ -203,14 +198,8 @@ async function _setMuted(store: IStore, { ensureTrack, authority, muted }: {
// completed. If there's no `jitsiTrack`, then the `muted` state will be applied once the `jitsiTrack` is
// created.
const { jitsiTrack } = localTrack;
const isAudioOnly = (mediaType === MEDIA_TYPE.VIDEO && authority === VIDEO_MUTISM_AUTHORITY.AUDIO_ONLY)
|| (mediaType === MEDIA_TYPE.SCREENSHARE && authority === SCREENSHARE_MUTISM_AUTHORITY.AUDIO_ONLY);

// Screenshare cannot be unmuted using the video mute button unless it is muted by audioOnly in the legacy
// screensharing mode.
if (jitsiTrack && (
jitsiTrack.videoType !== 'desktop' || isAudioOnly || getMultipleVideoSendingSupportFeatureFlag(state))
) {

if (jitsiTrack) {
setTrackMuted(jitsiTrack, muted, state, dispatch)
.catch(() => dispatch(trackMuteUnmuteFailed(localTrack, muted)));
}
Expand Down
11 changes: 2 additions & 9 deletions react/features/screen-share/functions.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { IReduxState } from '../app/types';
import { getMultipleVideoSendingSupportFeatureFlag } from '../base/config/functions.any';
import { isWindows } from '../base/environment/environment';
import { isMobileBrowser } from '../base/environment/utils';
import { browser } from '../base/lib-jitsi-meet';
import { VIDEO_TYPE } from '../base/media/constants';
import { getLocalDesktopTrack, getLocalVideoTrack } from '../base/tracks/functions';
import { getLocalDesktopTrack } from '../base/tracks/functions';

/**
* Is the current screen sharing session audio only.
Expand Down Expand Up @@ -56,10 +54,5 @@ export function isScreenVideoShared(state: IReduxState) {
const tracks = state['features/base/tracks'];
const localScreenshare = getLocalDesktopTrack(tracks);

if (getMultipleVideoSendingSupportFeatureFlag(state)) {
return localScreenshare?.jitsiTrack && !localScreenshare.jitsiTrack.isMuted();
}
const localVideo = getLocalVideoTrack(tracks);

return localVideo?.jitsiTrack?.getVideoType() === VIDEO_TYPE.DESKTOP;
return localScreenshare?.jitsiTrack && !localScreenshare.jitsiTrack.isMuted();
}
7 changes: 2 additions & 5 deletions react/features/screenshot-capture/actions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { IStore } from '../app/types';
import { getMultipleVideoSendingSupportFeatureFlag } from '../base/config/functions';
import { getLocalJitsiDesktopTrack, getLocalJitsiVideoTrack } from '../base/tracks/functions';
import { getLocalJitsiDesktopTrack } from '../base/tracks/functions';

import { SET_SCREENSHOT_CAPTURE } from './actionTypes';
import { createScreenshotCaptureSummary } from './functions';
Expand Down Expand Up @@ -45,9 +44,7 @@ export function toggleScreenshotCaptureSummary(enabled: boolean) {

if (enabled) {
try {
const jitsiTrack = getMultipleVideoSendingSupportFeatureFlag(state)
? getLocalJitsiDesktopTrack(state)
: getLocalJitsiVideoTrack(state);
const jitsiTrack = getLocalJitsiDesktopTrack(state);

await screenshotSummary.start(jitsiTrack);
dispatch(setScreenshotCapture(enabled));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { connect } from 'react-redux';

import { IReduxState } from '../../app/types';
import { getMultipleVideoSendingSupportFeatureFlag } from '../../base/config/functions.any';
import { translate } from '../../base/i18n/functions';
import { IconImage } from '../../base/icons/svg';
import AbstractButton, { IProps as AbstractButtonProps } from '../../base/toolbox/components/AbstractButton';
Expand Down Expand Up @@ -70,7 +69,6 @@ function _mapStateToProps(state: IReduxState) {
return {
_isBackgroundEnabled: Boolean(state['features/virtual-background'].backgroundEffectEnabled),
visible: checkBlurSupport()
&& getMultipleVideoSendingSupportFeatureFlag(state)
&& !isScreenVideoShared(state)
&& checkVirtualBackgroundEnabled(state)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { connect } from 'react-redux';
import { makeStyles } from 'tss-react/mui';

import { IReduxState, IStore } from '../../app/types';
import { getMultipleVideoSendingSupportFeatureFlag } from '../../base/config/functions.any';
import { translate } from '../../base/i18n/functions';
import Icon from '../../base/icons/components/Icon';
import { IconCloseLarge } from '../../base/icons/svg';
Expand All @@ -32,11 +31,6 @@ interface IProps extends WithTranslation {
*/
_images: Array<Image>;

/**
* Whether or not multi-stream send support is enabled.
*/
_multiStreamModeEnabled: boolean;

/**
* If the upload button should be displayed or not.
*/
Expand Down Expand Up @@ -503,8 +497,7 @@ function _mapStateToProps(state: IReduxState) {

return {
_images: (hasBrandingImages && dynamicBrandingImages) || IMAGES,
_showUploadButton: !state['features/base/config'].disableAddingBackgroundImages,
_multiStreamModeEnabled: getMultipleVideoSendingSupportFeatureFlag(state)
_showUploadButton: !state['features/base/config'].disableAddingBackgroundImages
};
}

Expand Down

0 comments on commit dcc3924

Please sign in to comment.