mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-04-09 15:01:28 +03:00
hwcodec, only process that start ipc server start check process (#8325)
check process send config to ipc server, other process get config from ipc server. Process will save config to toml, and the toml will be used if the config is none. when start check process: ipc server process start or option changed from disable to enable when get config: main window start or option changed from disable to enable, start_video_audio_threads. Only windows implements signature, which is used to mark whether the gpu software and hardware information changes. After reboot, the signature doesn't change. https://asawicki.info/news_1773_how_to_programmatically_check_graphics_driver_version, use dxgi way to get software version, it's not consistent with the visible driver version, after updating intel driver with small version change, the signature doesn't change. Linux doesn't use toml file. Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
@@ -1553,40 +1553,6 @@ impl LanPeers {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Serialize, Deserialize, Clone)]
|
||||
pub struct HwCodecConfig {
|
||||
#[serde(default, deserialize_with = "deserialize_string")]
|
||||
pub ram: String,
|
||||
#[serde(default, deserialize_with = "deserialize_string")]
|
||||
pub vram: String,
|
||||
}
|
||||
|
||||
impl HwCodecConfig {
|
||||
pub fn load() -> HwCodecConfig {
|
||||
Config::load_::<HwCodecConfig>("_hwcodec")
|
||||
}
|
||||
|
||||
pub fn store(&self) {
|
||||
Config::store_(self, "_hwcodec");
|
||||
}
|
||||
|
||||
pub fn clear() {
|
||||
HwCodecConfig::default().store();
|
||||
}
|
||||
|
||||
pub fn clear_ram() {
|
||||
let mut c = Self::load();
|
||||
c.ram = Default::default();
|
||||
c.store();
|
||||
}
|
||||
|
||||
pub fn clear_vram() {
|
||||
let mut c = Self::load();
|
||||
c.vram = Default::default();
|
||||
c.store();
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Serialize, Deserialize, Clone)]
|
||||
pub struct UserDefaultConfig {
|
||||
#[serde(default, deserialize_with = "deserialize_hashmap_string_string")]
|
||||
@@ -2238,6 +2204,18 @@ pub mod keys {
|
||||
];
|
||||
}
|
||||
|
||||
pub fn common_load<
|
||||
T: serde::Serialize + serde::de::DeserializeOwned + Default + std::fmt::Debug,
|
||||
>(
|
||||
suffix: &str,
|
||||
) -> T {
|
||||
Config::load_::<T>(suffix)
|
||||
}
|
||||
|
||||
pub fn common_store<T: serde::Serialize>(config: &T, suffix: &str) {
|
||||
Config::store_(config, suffix);
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user