mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
Merge branch 'hwcodec' into hwcodec
This commit is contained in:
28
src/ipc.rs
28
src/ipc.rs
@@ -1,8 +1,6 @@
|
||||
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,
|
||||
@@ -129,8 +127,6 @@ pub enum Data {
|
||||
ClipbaordFile(ClipbaordFile),
|
||||
ClipboardFileEnabled(bool),
|
||||
PrivacyModeState((i32, PrivacyModeState)),
|
||||
#[cfg(feature = "hwcodec")]
|
||||
HwCodecConfig(Option<HashMap<String, String>>),
|
||||
}
|
||||
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
@@ -340,12 +336,7 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
@@ -645,20 +636,3 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
17
src/main.rs
17
src/main.rs
@@ -70,15 +70,6 @@ fn main() {
|
||||
}
|
||||
if args.is_empty() {
|
||||
std::thread::spawn(move || start_server(false));
|
||||
#[cfg(feature = "hwcodec")]
|
||||
if let Ok(exe) = std::env::current_exe() {
|
||||
std::thread::spawn(move || {
|
||||
std::process::Command::new(exe)
|
||||
.arg("--check-hwcodec-config")
|
||||
.status()
|
||||
.ok()
|
||||
});
|
||||
}
|
||||
} else {
|
||||
#[cfg(windows)]
|
||||
{
|
||||
@@ -117,10 +108,6 @@ fn main() {
|
||||
args.len() > 1,
|
||||
));
|
||||
return;
|
||||
} else if args[0] == "--check-hwcodec-config" {
|
||||
#[cfg(feature = "hwcodec")]
|
||||
ipc::check_hwcodec_config();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if args[0] == "--remove" {
|
||||
@@ -164,6 +151,10 @@ fn main() {
|
||||
ipc::set_password(args[1].to_owned()).unwrap();
|
||||
}
|
||||
return;
|
||||
} else if args[0] == "--check-hwcodec-config" {
|
||||
#[cfg(feature = "hwcodec")]
|
||||
scrap::hwcodec::check_config();
|
||||
return;
|
||||
}
|
||||
}
|
||||
ui::start(&mut args[..]);
|
||||
|
||||
@@ -321,6 +321,15 @@ pub async fn start_server(is_server: bool) {
|
||||
std::process::exit(-1);
|
||||
}
|
||||
});
|
||||
#[cfg(feature = "hwcodec")]
|
||||
if let Ok(exe) = std::env::current_exe() {
|
||||
std::thread::spawn(move || {
|
||||
std::process::Command::new(exe)
|
||||
.arg("--check-hwcodec-config")
|
||||
.status()
|
||||
.ok()
|
||||
});
|
||||
}
|
||||
#[cfg(windows)]
|
||||
crate::platform::windows::bootstrap();
|
||||
input_service::fix_key_down_timeout_loop();
|
||||
|
||||
@@ -573,10 +573,10 @@ fn check_privacy_mode_changed(sp: &GenericService, privacy_mode_id: i32) -> Resu
|
||||
|
||||
#[inline]
|
||||
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||
fn create_msg(vp9s: Vec<VP9>) -> Message {
|
||||
fn create_msg(vp9s: Vec<EncodedVideoFrame>) -> Message {
|
||||
let mut msg_out = Message::new();
|
||||
let mut vf = VideoFrame::new();
|
||||
vf.set_vp9s(VP9s {
|
||||
vf.set_vp9s(EncodedVideoFrames {
|
||||
frames: vp9s.into(),
|
||||
..Default::default()
|
||||
});
|
||||
@@ -622,7 +622,7 @@ pub fn handle_one_frame_encoded(
|
||||
Ok(())
|
||||
})?;
|
||||
let mut send_conn_ids: HashSet<i32> = Default::default();
|
||||
let vp9_frame = VP9 {
|
||||
let vp9_frame = EncodedVideoFrame {
|
||||
data: frame.to_vec(),
|
||||
key: true,
|
||||
pts: ms,
|
||||
|
||||
Reference in New Issue
Block a user