curved-bird-58364
12/10/2025, 11:56 PMtall-airline-16756
12/10/2025, 11:56 PMtall-airline-16756
12/10/2025, 11:57 PMLocalTrackCpuConstrained events.
Immediate fixes to try
• Reduce video resolution or frame rate when publishing (lower publish settings).
• Enable adaptive streaming in the Room options (adaptiveStream: true) so streams scale to device/network.
• Disable CPU‑heavy video effects (background blur, virtual backgrounds) and any extra audio processors during the call.
• Try different codecs or fewer simulcast layers if you have them enabled.
If you want, tell me:
• which browser and device you’re testing on,
• your published video resolution/frame rate and whether you use background effects or simulcast,
and I’ll suggest exact settings/代码 snippets for the React SDK to lower load.
Sources: Optimizing Video Calls for Low-Powered Devices in LiveKit (JS SDK ≥ v2.14.0... | Codecs and more | LiveKit docs | Debugging Audio/Video Sync Issues in LiveKit Publishing | Bringing Zoom's end-to-end optimizations to WebRTCcurved-bird-58364
12/11/2025, 9:41 PMcomponents/video-conference.tsx):
| Setting | Before | After |
|---------|--------|-------|
| Default Codec | VP9 | VP8 |
| Video Capture (HQ) | 4K (h2160) | 1080p (h1080) |
| DTX | Disabled | Enabled |
| Simulcast Layers (HQ) | [1080p, 720p] | [720p, 360p] |
| Simulcast Layers (Std) | [540p, 216p] | [360p, 180p] |
| Audio Processing | None | autoGainControl, echoCancellation, noiseSuppression |
Impact:
- ~4x reduction in video encoding workload (4K → 1080p)
- Lower CPU usage with VP8 vs VP9
- DTX reduces audio processing during silence
- Audio processing flags help stabilize capture quality
Note:
We already had a useLowCPUOptimizer hook that listens for LocalTrackCpuConstrained events and reacts by lowering quality. However, this is reactive—by the time it fires, audio degradation has already started. The changes above are preventative and should eliminate the issue before it occurs.
Next Steps:
- Test on lower-end devices to confirm fix
- Monitor for any user reports of reduced video quality (tradeoff for stability)
- If needed, can further reduce to 720p capture or add frame rate limits
---
[3 tools called]
## VideoConferenceComponent - LiveKit Summary
Core Setup:
- Creates a Room instance from livekit-client with configured RoomOptions
- Wraps children in RoomContext.Provider from @livekit/components-react
- Connects via room.connect(serverUrl, participantToken, connectOptions)
Room Configuration:
- Codec: VP8 (default), falls back for E2EE
- Video: 1080p capture (HQ) / 720p (standard), simulcast layers for adaptive quality
- Audio: DTX enabled, with autoGainControl, echoCancellation, noiseSuppression
- Features: adaptiveStream: true, dynacast: true, optional E2EE via ExternalE2EEKeyProvider
Event Handling:
- RoomEvent.Disconnected → cleanup & redirect
- RoomEvent.MediaDevicesError → device fallback logic
- RoomEvent.EncryptionError → error toast
Permissions:
- Parses canPublishSources to determine camera/mic/screen access
- Auto-enables devices on connect (non-hosts only)
- Hosts stay muted by default
CPU Optimization:
- useLowCPUOptimizer hook listens for LocalTrackCpuConstrained events
- Reduces video quality when CPU is stressed
Rendering:
- MainStage - primary video grid with pinned layout support
- RemoteAudioRenderer - renders remote audio tracks
- OverlayControls - mic/camera/screen controls
- LayoutSync - syncs host layout preferences to participants
- VideoTracksTracker - notifies parent of video track changes
Let me know if you want me to adjust the tone or add anything else! 🤙tall-airline-16756
12/11/2025, 9:41 PMcurved-bird-58364
12/11/2025, 9:44 PMvideo-conference.tsx has some pretty aggressive settings that are eating CPU for breakfast:
1. 4K Video Capture in HQ Mode
192:195:components/video-conference.tsx
const videoCaptureDefaults: VideoCaptureOptions = {
deviceId: props.userChoices.videoDeviceId || undefined,
resolution: props.options.hq ? VideoPresets.h2160 : VideoPresets.h720,
};
When hq=true (which is hardcoded in room-page-client.tsx), you're capturing at 2160p/4K resolution. That's a LOT of pixels to encode while also processing audio. The CPU contention causes audio buffer underruns → static/artifacts.
2. VP9 Codec
186:188:components/video-conference.tsx
let videoCodec: VideoCodec | undefined = props.options.codec
? props.options.codec
: "vp9";
VP9 is more CPU-intensive than VP8/H.264, especially without hardware encoding support.
3. DTX is Disabled
197:197:components/video-conference.tsx
dtx: false,
With DTX off, audio encoding runs continuously even during silence—more CPU overhead.
4. Multiple Simulcast Layers
198:200:components/video-conference.tsx
videoSimulcastLayers: props.options.hq
? [VideoPresets.h1080, VideoPresets.h720]
: [VideoPresets.h540, VideoPresets.h216],
Encoding multiple resolution layers simultaneously adds to the load.
---
## ✅ Recommended Fixes
Here's what I'd update in `components/video-conference.tsx`:
typescript
const videoCaptureDefaults: VideoCaptureOptions = {
deviceId: props.userChoices.videoDeviceId || undefined,
// Drop from 4K to 1080p max - still high quality, way less CPU
resolution: props.options.hq ? VideoPresets.h1080 : VideoPresets.h720,
};
const publishDefaults: TrackPublishDefaults = {
dtx: true, // Enable DTX - reduces CPU during silence
videoSimulcastLayers: props.options.hq
? [VideoPresets.h720, VideoPresets.h360] // Lower layers
: [VideoPresets.h360, VideoPresets.h180],
red: !e2eeEnabled,
videoCodec: "vp8", // Consider VP8 for better CPU efficiency
};
// Add audio processing hints
audioCaptureDefaults: {
deviceId: props.userChoices.audioDeviceId || undefined,
autoGainControl: true,
echoCancellation: true,
noiseSuppression: true,
},
You already have useLowCPUOptimizer hooked up which listens for LocalTrackCpuConstrained events—that's good! But by the time it fires, the damage (static) has already started. These changes are preventative.
---
[3 tools called]
## VideoConferenceComponent - LiveKit Summary
Core Setup:
- Creates a Room instance from livekit-client with configured RoomOptions
- Wraps children in RoomContext.Provider from @livekit/components-react
- Connects via room.connect(serverUrl, participantToken, connectOptions)
Room Configuration:
- Codec: VP8 (default), falls back for E2EE
- Video: 1080p capture (HQ) / 720p (standard), simulcast layers for adaptive quality
- Audio: DTX enabled, with autoGainControl, echoCancellation, noiseSuppression
- Features: adaptiveStream: true, dynacast: true, optional E2EE via ExternalE2EEKeyProvider
Event Handling:
- RoomEvent.Disconnected → cleanup & redirect
- RoomEvent.MediaDevicesError → device fallback logic
- RoomEvent.EncryptionError → error toast
Permissions:
- Parses canPublishSources to determine camera/mic/screen access
- Auto-enables devices on connect (non-hosts only)
- Hosts stay muted by default
CPU Optimization:
- useLowCPUOptimizer hook listens for LocalTrackCpuConstrained events
- Reduces video quality when CPU is stressed
Rendering:
- MainStage - primary video grid with pinned layout support
- RemoteAudioRenderer - renders remote audio tracks
- OverlayControls - mic/camera/screen controls
- LayoutSync - syncs host layout preferences to participants
- VideoTracksTracker - notifies parent of video track changes
---
do you have any extra context you could give otherwise I will report back is this doesn't fix the issue