Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

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

tudordan752ee9b5151a0
diff --git a/react/features/virtual-background/middleware.js b/react/features/virtual-background/middleware.js
index 100156d2fa..1d81079044 100644
--- a/react/features/virtual-background/middleware.js
+++ b/react/features/virtual-background/middleware.js
@@ -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);
}