From a8f1ee0530a6935fe72d9c81cee15530b4d42eb4 Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Tue, 2 Sep 2025 09:41:46 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F(frontend)=20simplify=20proce?= =?UTF-8?q?ssor=20factory=20for=20transformer=20unification?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Streamline processor factory logic to prepare for unified transformer class refactoring. Reduces complexity and establishes foundation for consolidated transformer approach. --- .../rooms/livekit/components/blur/index.ts | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/frontend/src/features/rooms/livekit/components/blur/index.ts b/src/frontend/src/features/rooms/livekit/components/blur/index.ts index 3d59ba84..fa74ae44 100644 --- a/src/frontend/src/features/rooms/livekit/components/blur/index.ts +++ b/src/frontend/src/features/rooms/livekit/components/blur/index.ts @@ -41,21 +41,21 @@ export class BackgroundProcessorFactory { type: ProcessorType, opts: BackgroundOptions ): BackgroundProcessorInterface | undefined { - if (type === ProcessorType.BLUR) { - if (ProcessorWrapper.isSupported) { - return new BackgroundBlurTrackProcessorJsWrapper(opts) - } - if (BackgroundCustomProcessor.isSupported) { - return new BackgroundCustomProcessor(opts) - } - } else if (type === ProcessorType.VIRTUAL) { - if (ProcessorWrapper.isSupported) { - return new BackgroundVirtualTrackProcessorJsWrapper(opts) - } - if (BackgroundCustomProcessor.isSupported) { - return new BackgroundCustomProcessor(opts) - } + const isBlur = type === ProcessorType.BLUR + const isVirtual = type === ProcessorType.VIRTUAL + + if (!isBlur && !isVirtual) return undefined + + if (ProcessorWrapper.isSupported) { + return isBlur + ? new BackgroundBlurTrackProcessorJsWrapper(opts) + : new BackgroundVirtualTrackProcessorJsWrapper(opts) } + + if (BackgroundCustomProcessor.isSupported) { + return new BackgroundCustomProcessor(opts) + } + return undefined }