fix(participants-pane): Get the correct participantCount for multi-stream.

Do not add virtual screenshare participants to participantCount.
This commit is contained in:
Jaya Allamsetty 2022-08-01 11:31:38 -04:00
parent 5505f01cd9
commit 9b9fbc0bc9
2 changed files with 5 additions and 13 deletions

View File

@ -244,7 +244,7 @@ export function getParticipantCount(stateful: Object | Function) {
sortedRemoteVirtualScreenshareParticipants sortedRemoteVirtualScreenshareParticipants
} = state['features/base/participants']; } = state['features/base/participants'];
if (getSourceNameSignalingFeatureFlag(state)) { if (getMultipleVideoSupportFeatureFlag(state)) {
return remote.size - fakeParticipants.size - sortedRemoteVirtualScreenshareParticipants.size + (local ? 1 : 0); return remote.size - fakeParticipants.size - sortedRemoteVirtualScreenshareParticipants.size + (local ? 1 : 0);
} }
@ -286,7 +286,7 @@ export function getFakeParticipants(stateful: Object | Function) {
export function getRemoteParticipantCount(stateful: Object | Function) { export function getRemoteParticipantCount(stateful: Object | Function) {
const state = toState(stateful)['features/base/participants']; const state = toState(stateful)['features/base/participants'];
if (getSourceNameSignalingFeatureFlag(state)) { if (getMultipleVideoSupportFeatureFlag(state)) {
return state.remote.size - state.sortedRemoteVirtualScreenshareParticipants.size; return state.remote.size - state.sortedRemoteVirtualScreenshareParticipants.size;
} }
@ -306,7 +306,7 @@ export function getParticipantCountWithFake(stateful: Object | Function) {
const state = toState(stateful); const state = toState(stateful);
const { local, localScreenShare, remote } = state['features/base/participants']; const { local, localScreenShare, remote } = state['features/base/participants'];
if (getSourceNameSignalingFeatureFlag(state)) { if (getMultipleVideoSupportFeatureFlag(state)) {
return remote.size + (local ? 1 : 0) + (localScreenShare ? 1 : 0); return remote.size + (local ? 1 : 0) + (localScreenShare ? 1 : 0);
} }

View File

@ -10,10 +10,7 @@ import useContextMenu from '../../../base/components/context-menu/useContextMenu
import participantsPaneTheme from '../../../base/components/themes/participantsPaneTheme.json'; import participantsPaneTheme from '../../../base/components/themes/participantsPaneTheme.json';
import { isToolbarButtonEnabled } from '../../../base/config/functions.web'; import { isToolbarButtonEnabled } from '../../../base/config/functions.web';
import { MEDIA_TYPE } from '../../../base/media'; import { MEDIA_TYPE } from '../../../base/media';
import { import { getParticipantById } from '../../../base/participants';
getParticipantById,
getParticipantCountWithFake
} from '../../../base/participants';
import { connect } from '../../../base/redux'; import { connect } from '../../../base/redux';
import Input from '../../../base/ui/components/web/Input'; import Input from '../../../base/ui/components/web/Input';
import { normalizeAccents } from '../../../base/util/strings'; import { normalizeAccents } from '../../../base/util/strings';
@ -170,14 +167,9 @@ function _mapStateToProps(state): Object {
return !participant.isVirtualScreenshareParticipant; return !participant.isVirtualScreenshareParticipant;
}); });
// This is very important as getRemoteParticipants is not changing its reference object const participantsCount = sortedParticipantIds.length;
// and we will not re-render on change, but if count changes we will do
const participantsCount = getParticipantCountWithFake(state);
const showInviteButton = shouldRenderInviteButton(state) && isToolbarButtonEnabled('invite', state); const showInviteButton = shouldRenderInviteButton(state) && isToolbarButtonEnabled('invite', state);
const overflowDrawer = showOverflowDrawer(state); const overflowDrawer = showOverflowDrawer(state);
const currentRoomId = getCurrentRoomId(state); const currentRoomId = getCurrentRoomId(state);
const currentRoom = getBreakoutRooms(state)[currentRoomId]; const currentRoom = getBreakoutRooms(state)[currentRoomId];