From 089d016d12ffd0d21c5be620cd547d5fc969df36 Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Wed, 2 Sep 2026 18:26:12 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(frontend)=20cache=20supportsBackgr?= =?UTF-8?q?oundProcessors=20WebGL2=20probe=20result?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `supportsBackgroundProcessors()` creates a live WebGL2 context on every call and never releases it. The method is called from render paths (e.g. the Effects button on the join screen), so without caching, each re-render leaks a context until the browser hits its live-context limit. This is one of the ways MediaPipe later fails with: "emscripten_webgl_create_context() returned error 0" Support cannot change within a session, so probe once and cache the result. --- .../features/rooms/livekit/components/blur/index.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 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 385b1a5c..7405968f 100644 --- a/src/frontend/src/features/rooms/livekit/components/blur/index.ts +++ b/src/frontend/src/features/rooms/livekit/components/blur/index.ts @@ -32,14 +32,18 @@ export interface BackgroundProcessorInterface extends TrackProcessor } export class BackgroundProcessorFactory { + private static _isSupported?: boolean + static hasModernApiSupport() { return ProcessorWrapper.hasModernApiSupport } static isSupported() { - return ( - supportsBackgroundProcessors() || BackgroundCustomProcessor.isSupported - ) + if (this._isSupported === undefined) { + this._isSupported = + supportsBackgroundProcessors() || BackgroundCustomProcessor.isSupported + } + return this._isSupported } static getProcessor(