Skip to content

Commit 205f299

Browse files
committed
max out queueDepth at 8 as instructed by apple docs
1 parent d11a1af commit 205f299

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

crates/recording/src/sources/screen_capture/macos.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,7 @@ impl ScreenCaptureConfig<CMSampleBufferCapture> {
129129

130130
debug!("size: {:?}", size);
131131

132-
// Calculate queue depth based on FPS to provide adequate buffering
133-
// Formula: (fps / 30.0 * 10.0).ceil() gives ~10 frames at 30fps, scaling with higher fps
134-
// Minimum of 8, maximum of 16 to balance memory usage and tolerance for processing delays
135-
let queue_depth = ((self.config.fps as f32 / 30.0 * 10.0).ceil() as isize).clamp(8, 16);
132+
let queue_depth = ((self.config.fps as f32 / 30.0 * 5.0).ceil() as isize).clamp(3, 8);
136133
debug!("Using queue depth: {}", queue_depth);
137134

138135
let mut settings = scap_screencapturekit::StreamCfgBuilder::default()

crates/scap-screencapturekit/src/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ impl StreamCfgBuilder {
3737

3838
/// Sets the queue depth (number of frames to buffer).
3939
/// Higher values provide more tolerance for processing delays but use more memory.
40-
/// Apple's default is 3. Recommended: 8-12 for 30fps, 12-16 for 60fps.
40+
/// Apple's default is 3. Maximum is 8.
4141
pub fn set_queue_depth(&mut self, depth: isize) {
42-
self.0.set_queue_depth(depth);
42+
self.0.set_queue_depth(depth.min(8));
4343
}
4444

4545
/// Logical width of the capture area

0 commit comments

Comments
 (0)