fix(voice): prefer vp9 over software h264 for screen shares (#3106)

This commit is contained in:
Hampus
2026-10-02 13:29:29 +02:00
committed by GitHub
parent 632067b552
commit ee2d11ee0a
@@ -4,6 +4,7 @@ import type {CodecPreference, ScreenShareEncoderMode} from '@app/features/voice/
import type {VideoCodec} from 'livekit-client';
export const CODEC_PREFERENCE: ReadonlyArray<VideoCodec> = ['av1', 'h265', 'h264', 'vp9', 'vp8'];
const SOFTWARE_H264_CODEC_PREFERENCE: ReadonlyArray<VideoCodec> = ['av1', 'h265', 'vp9', 'h264', 'vp8'];
const COMPATIBILITY_CODECS: ReadonlySet<VideoCodec> = new Set(['h264', 'vp9', 'vp8']);
export const LAST_RESORT_VIDEO_CODEC: VideoCodec = 'vp8';
const BASELINE_BROWSER_CODECS: ReadonlySet<VideoCodec> = new Set(['h264', 'vp8']);
@@ -103,7 +104,8 @@ export function rankScreenShareCodecs(input: ScreenShareCodecRankingInput): Scre
if (codec === 'h265') return pin === 'h265' || (input.encoderModeSetting !== 'software' && isHardware('h265'));
return true;
};
const survivors = CODEC_PREFERENCE.filter(survives);
const preference = isHardware('h264') ? CODEC_PREFERENCE : SOFTWARE_H264_CODEC_PREFERENCE;
const survivors = preference.filter(survives);
const ranked =
input.encoderModeSetting === 'software'
? survivors