Bladeren bron

feat(blur): terminate blur web worker when disabled (#7347)

* feat(blur): terminate blur web worker when disabled
master
Tristian Flanagan 5 jaren geleden
bovenliggende
commit
9e7a477797
No account linked to committer's email address
1 gewijzigde bestanden met toevoegingen van 5 en 3 verwijderingen
  1. 5
    3
      react/features/stream-effects/blur/JitsiStreamBlurEffect.js

+ 5
- 3
react/features/stream-effects/blur/JitsiStreamBlurEffect.js Bestand weergeven

43
         this._outputCanvasElement = document.createElement('canvas');
43
         this._outputCanvasElement = document.createElement('canvas');
44
         this._outputCanvasElement.getContext('2d');
44
         this._outputCanvasElement.getContext('2d');
45
         this._inputVideoElement = document.createElement('video');
45
         this._inputVideoElement = document.createElement('video');
46
-
47
-        this._maskFrameTimerWorker = new Worker(timerWorkerScript, { name: 'Blur effect worker' });
48
-        this._maskFrameTimerWorker.onmessage = this._onMaskFrameTimer;
49
     }
46
     }
50
 
47
 
51
     /**
48
     /**
104
      * @returns {MediaStream} - The stream with the applied effect.
101
      * @returns {MediaStream} - The stream with the applied effect.
105
      */
102
      */
106
     startEffect(stream: MediaStream) {
103
     startEffect(stream: MediaStream) {
104
+        this._maskFrameTimerWorker = new Worker(timerWorkerScript, { name: 'Blur effect worker' });
105
+        this._maskFrameTimerWorker.onmessage = this._onMaskFrameTimer;
106
+
107
         const firstVideoTrack = stream.getVideoTracks()[0];
107
         const firstVideoTrack = stream.getVideoTracks()[0];
108
         const { height, frameRate, width }
108
         const { height, frameRate, width }
109
             = firstVideoTrack.getSettings ? firstVideoTrack.getSettings() : firstVideoTrack.getConstraints();
109
             = firstVideoTrack.getSettings ? firstVideoTrack.getSettings() : firstVideoTrack.getConstraints();
133
         this._maskFrameTimerWorker.postMessage({
133
         this._maskFrameTimerWorker.postMessage({
134
             id: CLEAR_INTERVAL
134
             id: CLEAR_INTERVAL
135
         });
135
         });
136
+
137
+        this._maskFrameTimerWorker.terminate();
136
     }
138
     }
137
 }
139
 }

Laden…
Annuleren
Opslaan