fix(virtual-background): Prevent memory leak when desktop share as a virtual background is applied.

This commit is contained in:
tudordan7 2021-07-13 16:47:23 +03:00 committed by Дамян Минков
parent d5f379a97c
commit 52ee9b5151
1 changed files with 2 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import { VIDEO_TYPE } from '../base/media';
import { MiddlewareRegistry } from '../base/redux';
import { getLocalVideoTrack } from '../base/tracks';
import { SET_VIRTUAL_BACKGROUND } from './actionTypes';
import { localTrackStopped } from './functions';
/**
@ -19,7 +20,7 @@ MiddlewareRegistry.register(store => next => action => {
const virtualSource = getState()['features/virtual-background'].virtualSource;
const currentLocalTrack = getLocalVideoTrack(getState()['features/base/tracks']);
if (virtualSource?.videoType === VIDEO_TYPE.DESKTOP) {
if (virtualSource?.videoType === VIDEO_TYPE.DESKTOP && action.type === SET_VIRTUAL_BACKGROUND) {
localTrackStopped(dispatch, virtualSource, currentLocalTrack?.jitsiTrack);
}