perf: enable adaptiveStream and camera simulcast for SFU bandwidth optimization

- adaptiveStream: true — SFU adjusts quality per subscriber viewport size
- Camera simulcast: true — publisher encodes 3 quality layers, SFU picks per viewer
- Screen share keeps simulcast: false (text readability)
- Server-side: livekit.yaml updated with 40 Mbps bandwidth cap, room cleanup,
  playout delay, and A/V sync (applied directly to Pi, not in this commit)
This commit is contained in:
Jannis Braun
2026-02-26 01:09:05 +01:00
parent 2186235d65
commit 33e9198de6
2 changed files with 3 additions and 3 deletions
@@ -65,7 +65,7 @@ export function VoiceControlBar() {
{ {
videoCodec: CAMERA_PRESET.codec, videoCodec: CAMERA_PRESET.codec,
videoEncoding: CAMERA_PRESET.encoding, videoEncoding: CAMERA_PRESET.encoding,
simulcast: false, simulcast: true,
} }
); );
} else { } else {
+2 -2
View File
@@ -331,7 +331,7 @@ export function useLiveKit() {
try { try {
const { token, url } = isDm ? await api.livekit.dmToken(channelId) : await api.livekit.token(channelId); const { token, url } = isDm ? await api.livekit.dmToken(channelId) : await api.livekit.token(channelId);
if (gen !== _connectGeneration) return; if (gen !== _connectGeneration) return;
const newRoom = new Room({ adaptiveStream: false, dynacast: true, publishDefaults: { videoCodec: 'h264', simulcast: false } }); const newRoom = new Room({ adaptiveStream: true, dynacast: true, publishDefaults: { videoCodec: 'h264', simulcast: true } });
roomRef.current = newRoom; roomRef.current = newRoom;
const guardedUpdate = () => { if (roomRef.current === newRoom) updateParticipants(); }; const guardedUpdate = () => { if (roomRef.current === newRoom) updateParticipants(); };
@@ -495,7 +495,7 @@ export function useLiveKit() {
const toggleCamera = useCallback(async () => { const toggleCamera = useCallback(async () => {
if (roomRef.current) { if (roomRef.current) {
if (!isCameraOn) { if (!isCameraOn) {
await roomRef.current.localParticipant.setCameraEnabled(true, { resolution: CAMERA_PRESET.resolution, frameRate: CAMERA_PRESET.encoding.maxFramerate }, { videoCodec: CAMERA_PRESET.codec, videoEncoding: CAMERA_PRESET.encoding, simulcast: false }); await roomRef.current.localParticipant.setCameraEnabled(true, { resolution: CAMERA_PRESET.resolution, frameRate: CAMERA_PRESET.encoding.maxFramerate }, { videoCodec: CAMERA_PRESET.codec, videoEncoding: CAMERA_PRESET.encoding, simulcast: true });
setTimeout(() => { if (roomRef.current) applyOverdrive(roomRef.current, Track.Source.Camera, CAMERA_OVERDRIVE); }, 2000); setTimeout(() => { if (roomRef.current) applyOverdrive(roomRef.current, Track.Source.Camera, CAMERA_OVERDRIVE); }, 2000);
} else { await roomRef.current.localParticipant.setCameraEnabled(false); } } else { await roomRef.current.localParticipant.setCameraEnabled(false); }
updateParticipants(); updateParticipants();