mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
Merge branch 'hwcodec' into master
This commit is contained in:
29
src/ipc.rs
29
src/ipc.rs
@@ -1,6 +1,8 @@
|
||||
use crate::rendezvous_mediator::RendezvousMediator;
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
pub use clipboard::ClipbaordFile;
|
||||
#[cfg(feature = "hwcodec")]
|
||||
use hbb_common::config::HwCodecConfig;
|
||||
use hbb_common::{
|
||||
allow_err, bail, bytes,
|
||||
bytes_codec::BytesCodec,
|
||||
@@ -73,7 +75,7 @@ pub enum FS {
|
||||
WriteOffset {
|
||||
id: i32,
|
||||
file_num: i32,
|
||||
offset_blk: u32
|
||||
offset_blk: u32,
|
||||
},
|
||||
CheckDigest {
|
||||
id: i32,
|
||||
@@ -127,6 +129,8 @@ pub enum Data {
|
||||
ClipbaordFile(ClipbaordFile),
|
||||
ClipboardFileEnabled(bool),
|
||||
PrivacyModeState((i32, PrivacyModeState)),
|
||||
#[cfg(feature = "hwcodec")]
|
||||
HwCodecConfig(Option<HashMap<String, String>>),
|
||||
}
|
||||
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
@@ -336,6 +340,12 @@ async fn handle(data: Data, stream: &mut Connection) {
|
||||
.await
|
||||
);
|
||||
}
|
||||
#[cfg(feature = "hwcodec")]
|
||||
Data::HwCodecConfig(Some(config)) => {
|
||||
for (k, v) in config {
|
||||
HwCodecConfig::set_option(k, v);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
@@ -635,3 +645,20 @@ pub async fn set_socks(value: config::Socks5Server) -> ResultType<()> {
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(feature = "hwcodec")]
|
||||
#[tokio::main]
|
||||
pub async fn check_hwcodec_config() {
|
||||
if let Some(config) = scrap::hwcodec::check_config() {
|
||||
match connect(1000, "").await {
|
||||
Ok(mut conn) => {
|
||||
if conn.send(&Data::HwCodecConfig(Some(config))).await.is_err() {
|
||||
log::error!("Failed to send hwcodec config by ipc");
|
||||
}
|
||||
}
|
||||
Err(err) => {
|
||||
log::info!("Failed to connect ipc: {:?}", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user