more for cli

This commit is contained in:
rustdesk 2022-12-29 13:00:57 +08:00
parent 8c7bc08776
commit 45072a4de1
3 changed files with 8 additions and 0 deletions

View File

@ -50,6 +50,7 @@ lazy_static::lazy_static! {
} }
pub fn global_init() -> bool { pub fn global_init() -> bool {
#[cfg(not(feature = "cli"))]
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
{ {
if !scrap::is_x11() { if !scrap::is_x11() {

View File

@ -31,6 +31,7 @@ pub mod audio_service;
cfg_if::cfg_if! { cfg_if::cfg_if! {
if #[cfg(not(any(target_os = "android", target_os = "ios")))] { if #[cfg(not(any(target_os = "android", target_os = "ios")))] {
mod clipboard_service; mod clipboard_service;
#[cfg(not(feature = "cli"))]
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
pub(crate) mod wayland; pub(crate) mod wayland;
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
@ -318,6 +319,7 @@ impl Drop for Server {
for s in self.services.values() { for s in self.services.values() {
s.join(); s.join();
} }
#[cfg(not(feature = "cli"))]
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
wayland::clear(); wayland::clear();
} }

View File

@ -500,6 +500,7 @@ impl Connection {
let _ = privacy_mode::turn_off_privacy(0); let _ = privacy_mode::turn_off_privacy(0);
} }
video_service::notify_video_frame_feched(id, None); video_service::notify_video_frame_feched(id, None);
#[cfg(not(feature = "cli"))]
scrap::codec::Encoder::update_video_encoder(id, scrap::codec::EncoderUpdate::Remove); scrap::codec::Encoder::update_video_encoder(id, scrap::codec::EncoderUpdate::Remove);
video_service::VIDEO_QOS.lock().unwrap().reset(); video_service::VIDEO_QOS.lock().unwrap().reset();
if conn.authorized { if conn.authorized {
@ -1076,17 +1077,20 @@ impl Connection {
if let Some(o) = lr.option.as_ref() { if let Some(o) = lr.option.as_ref() {
self.update_option(o).await; self.update_option(o).await;
if let Some(q) = o.video_codec_state.clone().take() { if let Some(q) = o.video_codec_state.clone().take() {
#[cfg(not(feature = "cli"))]
scrap::codec::Encoder::update_video_encoder( scrap::codec::Encoder::update_video_encoder(
self.inner.id(), self.inner.id(),
scrap::codec::EncoderUpdate::State(q), scrap::codec::EncoderUpdate::State(q),
); );
} else { } else {
#[cfg(not(feature = "cli"))]
scrap::codec::Encoder::update_video_encoder( scrap::codec::Encoder::update_video_encoder(
self.inner.id(), self.inner.id(),
scrap::codec::EncoderUpdate::DisableHwIfNotExist, scrap::codec::EncoderUpdate::DisableHwIfNotExist,
); );
} }
} else { } else {
#[cfg(not(feature = "cli"))]
scrap::codec::Encoder::update_video_encoder( scrap::codec::Encoder::update_video_encoder(
self.inner.id(), self.inner.id(),
scrap::codec::EncoderUpdate::DisableHwIfNotExist, scrap::codec::EncoderUpdate::DisableHwIfNotExist,
@ -1645,6 +1649,7 @@ impl Connection {
} }
} }
if let Some(q) = o.video_codec_state.clone().take() { if let Some(q) = o.video_codec_state.clone().take() {
#[cfg(not(feature = "cli"))]
scrap::codec::Encoder::update_video_encoder( scrap::codec::Encoder::update_video_encoder(
self.inner.id(), self.inner.id(),
scrap::codec::EncoderUpdate::State(q), scrap::codec::EncoderUpdate::State(q),