fix(video-quality): set lastN to 1 when screenshare is added to call in audio-only mode.

This fixes an issue where lastN is not bumped to 1 on an audio-only client when a screenshare source is added to the call.
This commit is contained in:
Jaya Allamsetty 2020-10-23 16:41:13 -04:00 committed by Jaya Allamsetty
parent 007183c151
commit 3657c19e60
1 changed files with 4 additions and 3 deletions

View File

@ -4,7 +4,6 @@ import { SET_FILMSTRIP_ENABLED } from '../../filmstrip/actionTypes';
import { SELECT_LARGE_VIDEO_PARTICIPANT } from '../../large-video/actionTypes'; import { SELECT_LARGE_VIDEO_PARTICIPANT } from '../../large-video/actionTypes';
import { APP_STATE_CHANGED } from '../../mobile/background/actionTypes'; import { APP_STATE_CHANGED } from '../../mobile/background/actionTypes';
import { SCREEN_SHARE_PARTICIPANTS_UPDATED, SET_TILE_VIEW } from '../../video-layout/actionTypes'; import { SCREEN_SHARE_PARTICIPANTS_UPDATED, SET_TILE_VIEW } from '../../video-layout/actionTypes';
import { shouldDisplayTileView } from '../../video-layout/functions';
import { SET_AUDIO_ONLY } from '../audio-only/actionTypes'; import { SET_AUDIO_ONLY } from '../audio-only/actionTypes';
import { CONFERENCE_JOINED } from '../conference/actionTypes'; import { CONFERENCE_JOINED } from '../conference/actionTypes';
import { import {
@ -81,12 +80,14 @@ function _updateLastN({ getState }) {
if (typeof appState !== 'undefined' && appState !== 'active') { if (typeof appState !== 'undefined' && appState !== 'active') {
lastN = 0; lastN = 0;
} else if (audioOnly) { } else if (audioOnly) {
const { screenShares } = state['features/video-layout']; const { screenShares, tileViewEnabled } = state['features/video-layout'];
const tileViewEnabled = shouldDisplayTileView(state);
const largeVideoParticipantId = state['features/large-video'].participantId; const largeVideoParticipantId = state['features/large-video'].participantId;
const largeVideoParticipant const largeVideoParticipant
= largeVideoParticipantId ? getParticipantById(state, largeVideoParticipantId) : undefined; = largeVideoParticipantId ? getParticipantById(state, largeVideoParticipantId) : undefined;
// Use tileViewEnabled state from redux here instead of determining if client should be in tile
// view since we make an exception only for screenshare when in audio-only mode. If the user unpins
// the screenshare, lastN will be set to 0 here. It will be set to 1 if screenshare has been auto pinned.
if (!tileViewEnabled && largeVideoParticipant && !largeVideoParticipant.local) { if (!tileViewEnabled && largeVideoParticipant && !largeVideoParticipant.local) {
lastN = (screenShares || []).includes(largeVideoParticipantId) ? 1 : 0; lastN = (screenShares || []).includes(largeVideoParticipantId) ? 1 : 0;
} else { } else {