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

Function serve_with_appkit

packages/server/src/main.rs:5107–5185  ·  view source on GitHub ↗
(
    port: u16,
    bind: IpAddr,
    advertise_host: Option<String>,
    client_root: Option<PathBuf>,
    video_codec: VideoCodecMode,
    android_gpu: AndroidGpuMode,
    low_latency: bool,
    st

Source from the content-addressed store, hash-verified

5105
5106#[allow(clippy::too_many_arguments)]
5107fn serve_with_appkit(
5108 port: u16,
5109 bind: IpAddr,
5110 advertise_host: Option<String>,
5111 client_root: Option<PathBuf>,
5112 video_codec: VideoCodecMode,
5113 android_gpu: AndroidGpuMode,
5114 low_latency: bool,
5115 stream_quality_profile: Option<String>,
5116 local_stream_fps: Option<u32>,
5117 server_kind: ServerKind,
5118 access_token: Option<String>,
5119 pairing_code: Option<String>,
5120) -> anyhow::Result<()> {
5121 std::env::set_var("SIMDECK_VIDEO_CODEC", video_codec.as_env_value());
5122 std::env::set_var("SIMDECK_ANDROID_GPU", android_gpu.as_emulator_value());
5123 std::env::set_var("SIMDECK_LOW_LATENCY", if low_latency { "1" } else { "0" });
5124 if let Some(local_stream_fps) = local_stream_fps {
5125 std::env::set_var("SIMDECK_LOCAL_STREAM_FPS", local_stream_fps.to_string());
5126 } else {
5127 std::env::remove_var("SIMDECK_LOCAL_STREAM_FPS");
5128 }
5129 if let Some(profile) = stream_quality_profile.as_deref() {
5130 apply_stream_quality_environment(profile)?;
5131 }
5132 if let Some(local_stream_fps) = local_stream_fps {
5133 std::env::set_var("SIMDECK_REALTIME_FPS", local_stream_fps.to_string());
5134 }
5135 let stream_quality_realtime = stream_quality_profile.is_some();
5136 let inherited_realtime_stream = crate::transport::webrtc::realtime_stream_enabled();
5137 std::env::set_var(
5138 "SIMDECK_REALTIME_STREAM",
5139 if inherited_realtime_stream || low_latency || stream_quality_realtime {
5140 "1"
5141 } else {
5142 "0"
5143 },
5144 );
5145 std::env::set_var(RESTART_ON_CORE_SIMULATOR_MISMATCH_ENV, "1");
5146 start_fd_pressure_watchdog();
5147 unsafe {
5148 ffi::xcw_native_initialize_app();
5149 }
5150
5151 let (result_tx, result_rx) = mpsc::sync_channel(1);
5152 std::thread::spawn(move || {
5153 let runtime = tokio::runtime::Builder::new_multi_thread()
5154 .enable_all()
5155 .build()
5156 .context("build tokio runtime");
5157 let result = match runtime {
5158 Ok(runtime) => runtime.block_on(serve(
5159 port,
5160 bind,
5161 advertise_host,
5162 client_root,
5163 video_codec,
5164 low_latency,

Callers 1

mainFunction · 0.85

Calls 9

serveFunction · 0.85
as_env_valueMethod · 0.80
as_emulator_valueMethod · 0.80
sendMethod · 0.65
realtime_stream_enabledFunction · 0.50

Tested by

no test coverage detected