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) use tighter edge smoothing

Saúl Ibarra Corretgé31ace267ce8e
diff --git a/react/features/stream-effects/virtual-background/JitsiStreamBackgroundEffect.js b/react/features/stream-effects/virtual-background/JitsiStreamBackgroundEffect.js
index bf79b209e4..ac55860814 100644
--- a/react/features/stream-effects/virtual-background/JitsiStreamBackgroundEffect.js
+++ b/react/features/stream-effects/virtual-background/JitsiStreamBackgroundEffect.js
@@ -80,7 +80,15 @@ export default class JitsiStreamBackgroundEffect {
this._outputCanvasCtx.globalCompositeOperation = 'copy';
// Draw segmentation mask.
- this._outputCanvasCtx.filter = `blur(${blurValue})`;
+ //
+
+ // Smooth out the edges.
+ if (this._options.virtualBackground.isVirtualBackground) {
+ this._outputCanvasCtx.filter = 'blur(4px)';
+ } else {
+ this._outputCanvasCtx.filter = 'blur(8px)';
+ }
+
this._outputCanvasCtx.drawImage(
this._segmentationMaskCanvas,
0,
@@ -92,11 +100,17 @@ export default class JitsiStreamBackgroundEffect {
this._inputVideoElement.width,
this._inputVideoElement.height
);
-
this._outputCanvasCtx.globalCompositeOperation = 'source-in';
this._outputCanvasCtx.filter = 'none';
+
+ // Draw the foreground video.
+ //
+
this._outputCanvasCtx.drawImage(this._inputVideoElement, 0, 0);
+ // Draw the background.
+ //
+
this._outputCanvasCtx.globalCompositeOperation = 'destination-over';
if (this._options.virtualBackground.isVirtualBackground) {
this._outputCanvasCtx.drawImage(this.virtualImage, 0, 0);