()
| 572 | } |
| 573 | |
| 574 | fn 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 | |
| 590 | fn realtime_stream_enabled() -> bool { |
| 591 | std::env::var("SIMDECK_REALTIME_STREAM") |
no test coverage detected