Browse Source

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

j8
tudordan7 3 years ago
parent
commit
52ee9b5151
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      react/features/virtual-background/middleware.js

+ 2
- 1
react/features/virtual-background/middleware.js View File

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

Loading…
Cancel
Save