commit
e0fad4eaa5
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:flutter_hbb/common.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
import '../consts.dart';
|
import '../consts.dart';
|
||||||
@ -318,6 +319,7 @@ initSharedStates(String id) {
|
|||||||
FingerprintState.init(id);
|
FingerprintState.init(id);
|
||||||
PeerBoolOption.init(id, 'zoom-cursor', () => false);
|
PeerBoolOption.init(id, 'zoom-cursor', () => false);
|
||||||
UnreadChatCountState.init(id);
|
UnreadChatCountState.init(id);
|
||||||
|
if (isMobile) ConnectionTypeState.init(id); // desktop in other places
|
||||||
}
|
}
|
||||||
|
|
||||||
removeSharedStates(String id) {
|
removeSharedStates(String id) {
|
||||||
@ -330,4 +332,5 @@ removeSharedStates(String id) {
|
|||||||
FingerprintState.delete(id);
|
FingerprintState.delete(id);
|
||||||
PeerBoolOption.delete(id, 'zoom-cursor');
|
PeerBoolOption.delete(id, 'zoom-cursor');
|
||||||
UnreadChatCountState.delete(id);
|
UnreadChatCountState.delete(id);
|
||||||
|
if (isMobile) ConnectionTypeState.delete(id);
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ use hbb_common::{
|
|||||||
supported_decoding::PreferCodec, video_frame, Chroma, CodecAbility, EncodedVideoFrames,
|
supported_decoding::PreferCodec, video_frame, Chroma, CodecAbility, EncodedVideoFrames,
|
||||||
SupportedDecoding, SupportedEncoding, VideoFrame,
|
SupportedDecoding, SupportedEncoding, VideoFrame,
|
||||||
},
|
},
|
||||||
sysinfo::{System},
|
sysinfo::System,
|
||||||
tokio::time::Instant,
|
tokio::time::Instant,
|
||||||
ResultType,
|
ResultType,
|
||||||
};
|
};
|
||||||
@ -198,7 +198,9 @@ impl Encoder {
|
|||||||
if av1_useable {
|
if av1_useable {
|
||||||
auto_codec = CodecName::AV1;
|
auto_codec = CodecName::AV1;
|
||||||
}
|
}
|
||||||
if vp8_useable && System::new_all().total_memory() <= 4 * 1024 * 1024 * 1024 {
|
let mut system = System::new();
|
||||||
|
system.refresh_memory();
|
||||||
|
if vp8_useable && system.total_memory() <= 4 * 1024 * 1024 * 1024 {
|
||||||
// 4 Gb
|
// 4 Gb
|
||||||
auto_codec = CodecName::VP8
|
auto_codec = CodecName::VP8
|
||||||
}
|
}
|
||||||
@ -581,7 +583,8 @@ pub fn codec_thread_num() -> usize {
|
|||||||
}
|
}
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
{
|
{
|
||||||
let s = System::new_all();
|
let mut s = System::new();
|
||||||
|
s.refresh_cpu_usage();
|
||||||
// https://man7.org/linux/man-pages/man3/getloadavg.3.html
|
// https://man7.org/linux/man-pages/man3/getloadavg.3.html
|
||||||
let avg = s.load_average();
|
let avg = s.load_average();
|
||||||
info = format!("cpu loadavg:{}", avg.one);
|
info = format!("cpu loadavg:{}", avg.one);
|
||||||
|
@ -877,8 +877,10 @@ pub fn hostname() -> String {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn get_sysinfo() -> serde_json::Value {
|
pub fn get_sysinfo() -> serde_json::Value {
|
||||||
use hbb_common::sysinfo::{System};
|
use hbb_common::sysinfo::System;
|
||||||
let system = System::new_all();
|
let mut system = System::new();
|
||||||
|
system.refresh_memory();
|
||||||
|
system.refresh_cpu();
|
||||||
let memory = system.total_memory();
|
let memory = system.total_memory();
|
||||||
let memory = (memory as f64 / 1024. / 1024. / 1024. * 100.).round() / 100.;
|
let memory = (memory as f64 / 1024. / 1024. / 1024. * 100.).round() / 100.;
|
||||||
let cpus = system.cpus();
|
let cpus = system.cpus();
|
||||||
@ -1086,7 +1088,11 @@ pub fn make_privacy_mode_msg(state: back_notification::PrivacyModeState) -> Mess
|
|||||||
make_privacy_mode_msg_with_details(state, "".to_owned())
|
make_privacy_mode_msg_with_details(state, "".to_owned())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_keyboard_mode_supported(keyboard_mode: &KeyboardMode, version_number: i64, peer_platform: &str) -> bool {
|
pub fn is_keyboard_mode_supported(
|
||||||
|
keyboard_mode: &KeyboardMode,
|
||||||
|
version_number: i64,
|
||||||
|
peer_platform: &str,
|
||||||
|
) -> bool {
|
||||||
match keyboard_mode {
|
match keyboard_mode {
|
||||||
KeyboardMode::Legacy => true,
|
KeyboardMode::Legacy => true,
|
||||||
KeyboardMode::Map => {
|
KeyboardMode::Map => {
|
||||||
@ -1213,7 +1219,7 @@ pub async fn get_next_nonkeyexchange_msg(
|
|||||||
|
|
||||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||||
pub fn check_process(arg: &str, same_uid: bool) -> bool {
|
pub fn check_process(arg: &str, same_uid: bool) -> bool {
|
||||||
use hbb_common::sysinfo::{System};
|
use hbb_common::sysinfo::System;
|
||||||
let mut sys = System::new();
|
let mut sys = System::new();
|
||||||
sys.refresh_processes();
|
sys.refresh_processes();
|
||||||
let mut path = std::env::current_exe().unwrap_or_default();
|
let mut path = std::env::current_exe().unwrap_or_default();
|
||||||
|
@ -603,7 +603,7 @@ async fn check_pid(postfix: &str) {
|
|||||||
file.read_to_string(&mut content).ok();
|
file.read_to_string(&mut content).ok();
|
||||||
let pid = content.parse::<usize>().unwrap_or(0);
|
let pid = content.parse::<usize>().unwrap_or(0);
|
||||||
if pid > 0 {
|
if pid > 0 {
|
||||||
use hbb_common::sysinfo::{System};
|
use hbb_common::sysinfo::System;
|
||||||
let mut sys = System::new();
|
let mut sys = System::new();
|
||||||
sys.refresh_processes();
|
sys.refresh_processes();
|
||||||
if let Some(p) = sys.process(pid.into()) {
|
if let Some(p) = sys.process(pid.into()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user