feat: replace codec pills with VP9/H.264 HW, wire to hwOverdrive
This commit is contained in:
@@ -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) => {
|
||||||
<button
|
const isHw = c.value === 'hw';
|
||||||
key={c.value}
|
const isSelected = isHw ? hwOverdrive : !hwOverdrive;
|
||||||
onClick={() => setConfig({ codec: c.value })}
|
return (
|
||||||
className={`${pillBase} ${
|
<button
|
||||||
config.codec === c.value
|
key={c.value}
|
||||||
? (c.value === 'h264' ? 'bg-accent-amber/60 text-white' : pillSelected)
|
onClick={() => setHwOverdrive(isHw)}
|
||||||
: (c.value === 'h264' ? 'bg-surface-elevated/50 text-txt-tertiary hover:bg-interactive-hover' : pillUnselected)
|
className={`${pillBase} ${
|
||||||
}`}
|
isSelected
|
||||||
>
|
? (isHw ? 'bg-accent-amber/60 text-white' : pillSelected)
|
||||||
{c.label}
|
: (isHw ? 'bg-surface-elevated/50 text-txt-tertiary hover:bg-interactive-hover' : pillUnselected)
|
||||||
</button>
|
}`}
|
||||||
))}
|
>
|
||||||
|
{c.label}
|
||||||
|
</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>
|
||||||
|
|||||||
Reference in New Issue
Block a user