MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / shared_refresh_interval

Function shared_refresh_interval

packages/server/src/simulators/session.rs:574–588  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

572}
573
574fn shared_refresh_interval() -> Duration {
575 let target_fps = std::env::var("SIMDECK_REALTIME_FPS")
576 .or_else(|_| std::env::var("SIMDECK_LOCAL_STREAM_FPS"))
577 .ok()
578 .and_then(|value| value.parse::<u64>().ok())
579 .unwrap_or(DEFAULT_SHARED_REFRESH_FPS)
580 .clamp(MIN_SHARED_REFRESH_FPS, MAX_SHARED_REFRESH_FPS);
581 let fps = if realtime_stream_enabled() {
582 target_fps.saturating_mul(2)
583 } else {
584 target_fps
585 }
586 .clamp(MIN_SHARED_REFRESH_FPS, MAX_SHARED_REFRESH_FPS);
587 Duration::from_micros(1_000_000 / fps)
588}
589
590fn realtime_stream_enabled() -> bool {
591 std::env::var("SIMDECK_REALTIME_STREAM")

Callers 1

start_refresh_pumpMethod · 0.85

Calls 1

realtime_stream_enabledFunction · 0.70

Tested by

no test coverage detected