Skip to content

Commit

Permalink
Refactor input task into dedicated thread
Browse files Browse the repository at this point in the history
  • Loading branch information
korejan committed Feb 25, 2024
1 parent e580af9 commit be88b99
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 40 deletions.
28 changes: 14 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion alvr/openxr-client/alxr-android-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "alxr-android-client"
version = "0.27.0"
version = "0.28.0"
authors = ["korejan <[email protected]>"]
edition = "2021"
description = "An OpenXR based ALVR client for android platorms"
Expand Down
2 changes: 1 addition & 1 deletion alvr/openxr-client/alxr-android-client/lynx/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "alxr-client-lynx"
version = "0.27.0"
version = "0.28.0"
authors = ["korejan <[email protected]>"]
edition = "2021"
description = "An OpenXR based ALVR client for android platorms"
Expand Down
2 changes: 1 addition & 1 deletion alvr/openxr-client/alxr-android-client/pico-v4/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "alxr-client-pico-v4"
version = "0.27.0"
version = "0.28.0"
authors = ["korejan <[email protected]>"]
edition = "2021"
description = "An OpenXR based ALVR client for Pico 4/Neo 3, pre PUI v5.2.x"
Expand Down
2 changes: 1 addition & 1 deletion alvr/openxr-client/alxr-android-client/pico/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "alxr-client-pico"
version = "0.27.0"
version = "0.28.0"
authors = ["korejan <[email protected]>"]
edition = "2021"
description = "An OpenXR based ALVR client for Pico 4/Neo 3, PUI >= v5.2.x"
Expand Down
2 changes: 1 addition & 1 deletion alvr/openxr-client/alxr-android-client/quest/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "alxr-client-quest"
version = "0.27.0"
version = "0.28.0"
authors = ["korejan <[email protected]>"]
edition = "2021"
description = "An OpenXR based ALVR client for Oculus Quest 1/2"
Expand Down
2 changes: 1 addition & 1 deletion alvr/openxr-client/alxr-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "alxr-client"
version = "0.27.0"
version = "0.28.0"
authors = ["korejan <[email protected]>"]
edition = "2021"
description = "An OpenXR based ALVR client for non-android platorms"
Expand Down
2 changes: 1 addition & 1 deletion alvr/openxr-client/alxr-client/uwp/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "alxr-client-uwp"
version = "1.27.0"
version = "1.28.0"
authors = ["korejan <[email protected]>"]
edition = "2021"
build = ".build/main.rs"
Expand Down
2 changes: 1 addition & 1 deletion alvr/openxr-client/alxr-common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "alxr-common"
version = "0.27.0"
version = "0.28.0"
authors = ["korejan <[email protected]>"]
edition = "2021"

Expand Down
23 changes: 7 additions & 16 deletions alvr/openxr-client/alxr-common/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,12 @@ async fn connection_pipeline(
config_packet.eye_resolution_width, config_packet.eye_resolution_height
);
//println!("setting display refresh to {0}Hz", config_packet.fps);

let tracking_clientside_prediction = match &settings.headset.controllers {
Switch::Enabled(controllers) => controllers.clientside_prediction,
Switch::Disabled => false,
};

unsafe {
crate::alxr_set_stream_config(crate::ALXRStreamConfig {
trackingSpaceType: ALXRTrackingSpace_StageRefSpace,
Expand Down Expand Up @@ -338,6 +344,7 @@ async fn connection_pipeline(
enableFEC: settings.connection.enable_fec,
realtimePriority: settings.video.client_request_realtime_decoder,
},
clientPrediction: tracking_clientside_prediction,
});
}

Expand All @@ -355,11 +362,6 @@ async fn connection_pipeline(
// ],
// ))?;

let tracking_clientside_prediction = match &settings.headset.controllers {
Switch::Enabled(controllers) => controllers.clientside_prediction,
Switch::Disabled => false,
};

// setup stream loops

let input_send_loop = {
Expand Down Expand Up @@ -512,16 +514,6 @@ async fn connection_pipeline(
}
};

let tracking_interval = Duration::from_secs_f32(1_f32 / (config_packet.fps * 3_f32)); // Duration::from_secs_f32(1_f32 / 360_f32);//
let tracking_loop = async move {
let mut deadline = Instant::now();
loop {
unsafe { crate::alxr_on_tracking_update(tracking_clientside_prediction) };
deadline += tracking_interval;
time::sleep_until(deadline).await;
}
};

let playspace_sync_loop = {
let control_sender = Arc::clone(&control_sender);
async move {
Expand Down Expand Up @@ -701,7 +693,6 @@ async fn connection_pipeline(
},
res = spawn_cancelable(game_audio_loop) => res,
res = spawn_cancelable(microphone_loop) => res,
res = spawn_cancelable(tracking_loop) => res,
res = spawn_cancelable(playspace_sync_loop) => res,
res = spawn_cancelable(input_send_loop) => res,
res = spawn_cancelable(time_sync_send_loop) => res,
Expand Down
2 changes: 1 addition & 1 deletion alvr/openxr-client/alxr-engine-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "alxr-engine-sys"
version = "0.27.0"
version = "0.28.0"
authors = ["korejan <[email protected]>"]
edition = "2021"
links = "alxr_engine"
Expand Down

0 comments on commit be88b99

Please sign in to comment.