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:
@@ -616,7 +616,11 @@ export function useLiveKit() {
|
|||||||
// Codec changed mid-stream — must restart (codec is baked into SDP negotiation)
|
// Codec changed mid-stream — must restart (codec is baked into SDP negotiation)
|
||||||
if (_publishedScreenShareCodec && _publishedScreenShareCodec !== opts.publish.videoCodec) {
|
if (_publishedScreenShareCodec && _publishedScreenShareCodec !== opts.publish.videoCodec) {
|
||||||
_publishedScreenShareCodec = null;
|
_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);
|
await stopScreenShare(room);
|
||||||
|
if (preserveHwOverdrive) useVoiceStore.setState({ hwOverdrive: true });
|
||||||
setTimeout(() => startScreenShare(room).catch(() => {}), 200);
|
setTimeout(() => startScreenShare(room).catch(() => {}), 200);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user