fix: preserve hwOverdrive across mid-stream codec restart

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.
This commit is contained in:
Jannis Braun
2026-03-24 04:35:33 +01:00
parent cc30080ba8
commit 69a16ccdd5
+4
View File
@@ -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;
}