Skip to content

Commit

Permalink
refactor: 🚨 Fix some lints
Browse files Browse the repository at this point in the history
  • Loading branch information
zmerp committed Sep 19, 2024
1 parent c3ca794 commit f26c79f
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 20 deletions.
2 changes: 2 additions & 0 deletions alvr/client_core/src/c_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,11 @@ pub extern "C" fn alvr_send_button(path_id: u64, value: AlvrButtonValue) {

/// view_params:
/// * array of 2;
///
/// hand_skeleton:
/// * outer ptr: array of 2 (can be null);
/// * inner ptr: array of 26 (can be null if hand is absent)
///
/// eye_gazes:
/// * outer ptr: array of 2 (can be null);
/// * inner ptr: pose (can be null if eye gaze is absent)
Expand Down
7 changes: 3 additions & 4 deletions alvr/client_core/src/graphics/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,8 @@ impl StreamRenderer {

let mut view_objects = vec![];
let mut staging_textures_gl = vec![];
for i in 0..2 {
let staging_texture =
super::create_texture(&device, view_resolution, target_format);
for target_swapchain in &swapchain_textures {
let staging_texture = super::create_texture(device, view_resolution, target_format);

let staging_texture_gl = unsafe {
staging_texture.as_hal::<api::Gles, _, _>(|tex| {
Expand Down Expand Up @@ -193,7 +192,7 @@ impl StreamRenderer {

let render_target = super::create_gl_swapchain(
device,
&swapchain_textures[i],
target_swapchain,
view_resolution,
target_format,
);
Expand Down
7 changes: 5 additions & 2 deletions alvr/client_openxr/src/extra_extensions/multimodal_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
// https://github.com/meta-quest/Meta-OpenXR-SDK/blob/main/OpenXR/meta_openxr_preview/meta_simultaneous_hands_and_controllers.h

use alvr_common::{anyhow::Result, once_cell::sync::Lazy, ToAny};
use openxr::{self as xr, sys};
use openxr::{
self as xr,
sys::{self, pfn::VoidFunction},
};
use std::{ffi::c_void, mem, ptr};

pub const META_SIMULTANEOUS_HANDS_AND_CONTROLLERS_EXTENSION_NAME: &str =
Expand Down Expand Up @@ -35,7 +38,7 @@ pub fn resume_simultaneous_hands_and_controllers_tracking<G>(
&mut resume_simultaneous_hands_and_controllers_tracking_meta,
);

mem::transmute::<_, ResumeSimultaneousHandsAndControllersTrackingMETA>(
mem::transmute::<VoidFunction, ResumeSimultaneousHandsAndControllersTrackingMETA>(
resume_simultaneous_hands_and_controllers_tracking_meta.to_any()?,
)
};
Expand Down
2 changes: 1 addition & 1 deletion alvr/client_openxr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ pub fn entry_point() {
lobby.update_hud_message(&message);
}
ClientCoreEvent::StreamingStarted(config) => {
let new_config = ParsedStreamConfig::new(&*config);
let new_config = ParsedStreamConfig::new(&config);

// combined_eye_gaze is a setting that needs to be enabled at session
// creation. Since HTC headsets don't support session reinitialization, skip
Expand Down
26 changes: 13 additions & 13 deletions alvr/dashboard/src/dashboard/components/statistics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ impl StatisticsTab {
Grid::new("latency_tooltip").num_columns(2).show(ui, |ui| {
fn label(ui: &mut Ui, text: &str, value_s: f32, color: Color32) {
ui.colored_label(color, text);
ui.colored_label(color, &format!("{:.2}ms", value_s * 1000.0));
ui.colored_label(color, format!("{:.2}ms", value_s * 1000.0));
ui.end_row();
}

Expand Down Expand Up @@ -326,7 +326,7 @@ impl StatisticsTab {
color: Color32,
) {
if let Some(value) = maybe_value_bps {
ui.colored_label(color, &format!("{text}: {:.2} Mbps", value / 1e6));
ui.colored_label(color, format!("{text}: {:.2} Mbps", value / 1e6));
}
}

Expand Down Expand Up @@ -374,43 +374,43 @@ impl StatisticsTab {

ui.columns(2, |ui| {
ui[0].label("Total packets:");
ui[1].label(&format!(
ui[1].label(format!(
"{} packets ({} packets/s)",
statistics.video_packets_total, statistics.video_packets_per_sec
));

ui[0].label("Total sent:");
ui[1].label(&format!("{} MB", statistics.video_mbytes_total));
ui[1].label(format!("{} MB", statistics.video_mbytes_total));

ui[0].label("Bitrate:");
ui[1].label(&format!("{:.1} Mbps", statistics.video_mbits_per_sec));
ui[1].label(format!("{:.1} Mbps", statistics.video_mbits_per_sec));

ui[0].label("Total latency:");
ui[1].label(&format!("{:.0} ms", statistics.total_latency_ms));
ui[1].label(format!("{:.0} ms", statistics.total_latency_ms));

ui[0].label("Encoder latency:");
ui[1].label(&format!("{:.2} ms", statistics.encode_latency_ms));
ui[1].label(format!("{:.2} ms", statistics.encode_latency_ms));

ui[0].label("Transport latency:");
ui[1].label(&format!("{:.2} ms", statistics.network_latency_ms));
ui[1].label(format!("{:.2} ms", statistics.network_latency_ms));

ui[0].label("Decoder latency:");
ui[1].label(&format!("{:.2} ms", statistics.decode_latency_ms));
ui[1].label(format!("{:.2} ms", statistics.decode_latency_ms));

ui[0].label("Total packets lost:");
ui[1].label(&format!(
ui[1].label(format!(
"{} packets ({} packets/s)",
statistics.packets_lost_total, statistics.packets_lost_per_sec
));

ui[0].label("Client FPS:");
ui[1].label(&format!("{} FPS", statistics.client_fps));
ui[1].label(format!("{} FPS", statistics.client_fps));

ui[0].label("Streamer FPS:");
ui[1].label(&format!("{} FPS", statistics.server_fps));
ui[1].label(format!("{} FPS", statistics.server_fps));

ui[0].label("Headset battery");
ui[1].label(&format!(
ui[1].label(format!(
"{}% ({})",
statistics.battery_hmd,
if statistics.hmd_plugged {
Expand Down
2 changes: 2 additions & 0 deletions alvr/server_core/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,7 @@ fn connection_pipeline(
settings.video.preferred_codec
};

#[cfg_attr(target_os = "linux", allow(unused_variables))]
let game_audio_sample_rate =
if let Switch::Enabled(game_audio_config) = &settings.audio.game_audio {
#[cfg(not(target_os = "linux"))]
Expand Down Expand Up @@ -731,6 +732,7 @@ fn connection_pipeline(
}
});

#[cfg_attr(target_os = "linux", allow(unused_variables))]
let game_audio_thread = if let Switch::Enabled(config) = settings.audio.game_audio {
#[cfg(windows)]
let ctx = Arc::clone(&ctx);
Expand Down

0 comments on commit f26c79f

Please sign in to comment.