feat: replace codec pills with VP9/H.264 HW, wire to hwOverdrive

This commit is contained in:
Jannis Braun
2026-03-24 03:51:22 +01:00
parent 23249be956
commit c6c44d1bdd
@@ -20,9 +20,9 @@ const MODES: { value: ScreenShareConfig['mode']; label: string }[] = [
{ value: 'text', label: 'Text' }, { value: 'text', label: 'Text' },
]; ];
const CODECS: { value: ScreenShareConfig['codec']; label: string }[] = [ const CODEC_OPTIONS = [
{ value: 'vp9', label: 'VP9' }, { value: 'vp9' as const, label: 'VP9' },
{ value: 'h264', label: 'H.264' }, { value: 'hw' as const, label: 'H.264 HW' },
]; ];
function formatBitrate(bps: number): string { function formatBitrate(bps: number): string {
@@ -48,6 +48,8 @@ export function ScreenShareSettingsPopover({ open, onClose, anchorRef }: ScreenS
const popoverRef = useRef<HTMLDivElement>(null); const popoverRef = useRef<HTMLDivElement>(null);
const config = useVoiceStore((s) => s.screenShareConfig); const config = useVoiceStore((s) => s.screenShareConfig);
const setConfig = useVoiceStore((s) => s.setScreenShareConfig); const setConfig = useVoiceStore((s) => s.setScreenShareConfig);
const hwOverdrive = useVoiceStore((s) => s.hwOverdrive);
const setHwOverdrive = useVoiceStore((s) => s.setHwOverdrive);
const limits = useSettingsStore((s) => s.streamingLimits); const limits = useSettingsStore((s) => s.streamingLimits);
const { style } = useFloatingPosition(anchorRef, popoverRef, { const { style } = useFloatingPosition(anchorRef, popoverRef, {
@@ -189,23 +191,27 @@ export function ScreenShareSettingsPopover({ open, onClose, anchorRef }: ScreenS
Codec Codec
</div> </div>
<div className="flex gap-1.5"> <div className="flex gap-1.5">
{CODECS.map((c) => ( {CODEC_OPTIONS.map((c) => {
const isHw = c.value === 'hw';
const isSelected = isHw ? hwOverdrive : !hwOverdrive;
return (
<button <button
key={c.value} key={c.value}
onClick={() => setConfig({ codec: c.value })} onClick={() => setHwOverdrive(isHw)}
className={`${pillBase} ${ className={`${pillBase} ${
config.codec === c.value isSelected
? (c.value === 'h264' ? 'bg-accent-amber/60 text-white' : pillSelected) ? (isHw ? 'bg-accent-amber/60 text-white' : pillSelected)
: (c.value === 'h264' ? 'bg-surface-elevated/50 text-txt-tertiary hover:bg-interactive-hover' : pillUnselected) : (isHw ? 'bg-surface-elevated/50 text-txt-tertiary hover:bg-interactive-hover' : pillUnselected)
}`} }`}
> >
{c.label} {c.label}
</button> </button>
))} );
})}
</div> </div>
{config.codec !== 'vp9' && ( {hwOverdrive && (
<div className="text-[10px] text-accent-amber/80 mt-1"> <div className="text-[10px] text-accent-amber/80 mt-1">
Not recommended uses slower software encoder GPU hardware encoder · resets when stream ends
</div> </div>
)} )}
</div> </div>