From 69a16ccdd53b4c3aae9b6a8e1957854f12aaf6ae Mon Sep 17 00:00:00 2001 From: Jannis Braun <151788261+TheZwiss@users.noreply.github.com> Date: Tue, 24 Mar 2026 04:35:33 +0100 Subject: [PATCH] fix: preserve hwOverdrive across mid-stream codec restart MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit stopScreenShare() resets hwOverdrive: false, which clobbers the user's intent when switching VP9 → H.264 HW mid-stream. Save and restore the flag around the restart. --- packages/web/src/hooks/useLiveKit.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/web/src/hooks/useLiveKit.ts b/packages/web/src/hooks/useLiveKit.ts index bc6f403a..adf17bea 100644 --- a/packages/web/src/hooks/useLiveKit.ts +++ b/packages/web/src/hooks/useLiveKit.ts @@ -616,7 +616,11 @@ export function useLiveKit() { // Codec changed mid-stream — must restart (codec is baked into SDP negotiation) if (_publishedScreenShareCodec && _publishedScreenShareCodec !== opts.publish.videoCodec) { _publishedScreenShareCodec = null; + // Preserve hwOverdrive across restart — stopScreenShare() resets it, + // but the user's intent (the pill they just clicked) must survive. + const preserveHwOverdrive = useVoiceStore.getState().hwOverdrive; await stopScreenShare(room); + if (preserveHwOverdrive) useVoiceStore.setState({ hwOverdrive: true }); setTimeout(() => startScreenShare(room).catch(() => {}), 200); return; }