From 4e7152bd70645b37a3abb9ffef60a3fea85e9530 Mon Sep 17 00:00:00 2001 From: jcm <6864788+jcm93@users.noreply.github.com> Date: Tue, 25 Feb 2025 10:49:41 -0600 Subject: [PATCH] mac-capture: Set minimum frame interval in capture initialization --- plugins/mac-capture/mac-sck-video-capture.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/mac-capture/mac-sck-video-capture.m b/plugins/mac-capture/mac-sck-video-capture.m index ebafb252f..3f5c403c6 100644 --- a/plugins/mac-capture/mac-sck-video-capture.m +++ b/plugins/mac-capture/mac-sck-video-capture.m @@ -194,11 +194,21 @@ API_AVAILABLE(macos(12.5)) static bool init_screen_stream(struct screen_capture } os_sem_post(sc->shareable_content_available); + struct obs_video_info video_info; + bool hasVideoInfo = obs_get_video_info(&video_info); + CGColorRef background = CGColorGetConstantColor(kCGColorClear); [sc->stream_properties setQueueDepth:8]; [sc->stream_properties setShowsCursor:!sc->hide_cursor]; [sc->stream_properties setColorSpaceName:kCGColorSpaceDisplayP3]; [sc->stream_properties setBackgroundColor:background]; + if (hasVideoInfo) { + CMTime frameTimeInterval = CMTimeMake((int64_t) video_info.fps_den, video_info.fps_num); + CMTime minimumUpdateTime = CMTimeMultiplyByFloat64(frameTimeInterval, 0.9); + [sc->stream_properties setMinimumFrameInterval:minimumUpdateTime]; + } else { + blog(LOG_WARNING, "Unable to retrieve OBS output FPS when initializing macOS Screen Capture"); + } FourCharCode l10r_type = 0; l10r_type = ('l' << 24) | ('1' << 16) | ('0' << 8) | 'r'; [sc->stream_properties setPixelFormat:l10r_type];