fixes and gpu based blurring

This commit is contained in:
Timo
2024-11-27 21:00:09 +01:00
committed by Hugh Nimmo-Smith
parent c2b6518027
commit 7d8e9a7969
2 changed files with 10 additions and 8 deletions

View File

@@ -87,7 +87,7 @@ export function useLiveKit(
let b = undefined; let b = undefined;
try { try {
// eslint-disable-next-line new-cap // eslint-disable-next-line new-cap
b = BackgroundBlur(15); b = BackgroundBlur(15, { delegate: "GPU" });
} catch (e) { } catch (e) {
logger.error("disable background blur", e); logger.error("disable background blur", e);
} }
@@ -178,15 +178,17 @@ export function useLiveKit(
if (publishCallback) if (publishCallback)
room.off(RoomEvent.LocalTrackPublished, publishCallback); room.off(RoomEvent.LocalTrackPublished, publishCallback);
if ( if (videoTrack !== undefined) {
videoTrack !== undefined && if (
videoTrack.track?.getProcessor() === undefined showBackgroundBlur &&
) { videoTrack.track?.getProcessor()?.name !== "background-blur"
if (showBackgroundBlur) { ) {
logger.info("Blur: set blur"); logger.info("Blur: set blur");
void videoTrack.track?.setProcessor(blur); void videoTrack.track?.setProcessor(blur);
} else { } else if (
videoTrack.track?.getProcessor()?.name === "background-blur"
) {
void videoTrack.track?.stopProcessor(); void videoTrack.track?.stopProcessor();
} }
} }

View File

@@ -116,7 +116,7 @@ export const LobbyView: FC<Props> = ({
let b = undefined; let b = undefined;
try { try {
// eslint-disable-next-line new-cap // eslint-disable-next-line new-cap
b = BackgroundBlur(15); b = BackgroundBlur(15, { delegate: "GPU" });
} catch (e) { } catch (e) {
logger.error("disable background blur", e); logger.error("disable background blur", e);
} }