Browse Source

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

j8
tudordan7 4 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
 import { MiddlewareRegistry } from '../base/redux';
4
 import { MiddlewareRegistry } from '../base/redux';
5
 import { getLocalVideoTrack } from '../base/tracks';
5
 import { getLocalVideoTrack } from '../base/tracks';
6
 
6
 
7
+import { SET_VIRTUAL_BACKGROUND } from './actionTypes';
7
 import { localTrackStopped } from './functions';
8
 import { localTrackStopped } from './functions';
8
 
9
 
9
 /**
10
 /**
19
     const virtualSource = getState()['features/virtual-background'].virtualSource;
20
     const virtualSource = getState()['features/virtual-background'].virtualSource;
20
     const currentLocalTrack = getLocalVideoTrack(getState()['features/base/tracks']);
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
         localTrackStopped(dispatch, virtualSource, currentLocalTrack?.jitsiTrack);
24
         localTrackStopped(dispatch, virtualSource, currentLocalTrack?.jitsiTrack);
24
     }
25
     }
25
 
26
 

Loading…
Cancel
Save