diff --git a/crates/ironrdp-client/Cargo.toml b/crates/ironrdp-client/Cargo.toml index 946d3a07d..7c80be8e8 100644 --- a/crates/ironrdp-client/Cargo.toml +++ b/crates/ironrdp-client/Cargo.toml @@ -24,9 +24,10 @@ name = "ironrdp-client" test = false [features] -default = ["rustls"] +default = ["rustls", "native-rdpsnd"] rustls = ["ironrdp-tls/rustls", "tokio-tungstenite/rustls-tls-native-roots", "ironrdp-mstsgu/rustls"] native-tls = ["ironrdp-tls/native-tls", "tokio-tungstenite/native-tls", "ironrdp-mstsgu/native-tls"] +native-rdpsnd = ["dep:ironrdp-rdpsnd-native"] qoi = ["ironrdp/qoi"] qoiz = ["ironrdp/qoiz"] @@ -47,7 +48,7 @@ ironrdp = { path = "../ironrdp", version = "0.14", features = [ ] } ironrdp-core = { path = "../ironrdp-core", version = "0.1", features = ["alloc"] } ironrdp-cliprdr-native = { path = "../ironrdp-cliprdr-native", version = "0.5" } -ironrdp-rdpsnd-native = { path = "../ironrdp-rdpsnd-native", version = "0.5" } +ironrdp-rdpsnd-native = { path = "../ironrdp-rdpsnd-native", version = "0.5", optional = true } ironrdp-tls = { path = "../ironrdp-tls", version = "0.2" } ironrdp-mstsgu = { path = "../ironrdp-mstsgu" } ironrdp-tokio = { path = "../ironrdp-tokio", version = "0.8", features = ["reqwest"] } diff --git a/crates/ironrdp-client/src/rdp.rs b/crates/ironrdp-client/src/rdp.rs index 9900f0331..dd1ae6aa4 100644 --- a/crates/ironrdp-client/src/rdp.rs +++ b/crates/ironrdp-client/src/rdp.rs @@ -16,11 +16,12 @@ use ironrdp::pdu::{PduResult, pdu_other_err}; use ironrdp::session::image::DecodedImage; use ironrdp::session::{ActiveStage, ActiveStageOutput, GracefulDisconnectReason, SessionResult, fast_path}; use ironrdp::svc::SvcMessage; -use ironrdp::{cliprdr, connector, rdpdr, rdpsnd, session}; +use ironrdp::{cliprdr, connector, rdpdr, session}; use ironrdp_core::WriteBuf; #[cfg(windows)] use ironrdp_dvc_com_plugin::load_dvc_plugin; use ironrdp_dvc_pipe_proxy::DvcNamedPipeProxy; +#[cfg(feature = "native-rdpsnd")] use ironrdp_rdpsnd_native::cpal; use ironrdp_tokio::reqwest::ReqwestNetworkClient; use ironrdp_tokio::{FramedWrite, single_sequence_step_read, split_tokio_framed}; @@ -252,9 +253,13 @@ async fn connect( let mut connector = connector::ClientConnector::new(config.connector.clone(), client_addr) .with_static_channel(drdynvc) - .with_static_channel(rdpsnd::client::Rdpsnd::new(Box::new(cpal::RdpsndBackend::new()))) .with_static_channel(rdpdr::Rdpdr::new(Box::new(NoopRdpdrBackend {}), "IronRDP".to_owned()).with_smartcard(0)); + #[cfg(feature = "native-rdpsnd")] + connector.attach_static_channel(ironrdp::rdpsnd::client::Rdpsnd::new(Box::new( + cpal::RdpsndBackend::new(), + ))); + if let Some(builder) = cliprdr_factory { let backend = builder.build_cliprdr_backend(); @@ -376,9 +381,13 @@ async fn connect_ws( let mut connector = connector::ClientConnector::new(config.connector.clone(), client_addr) .with_static_channel(drdynvc) - .with_static_channel(rdpsnd::client::Rdpsnd::new(Box::new(cpal::RdpsndBackend::new()))) .with_static_channel(rdpdr::Rdpdr::new(Box::new(NoopRdpdrBackend {}), "IronRDP".to_owned()).with_smartcard(0)); + #[cfg(feature = "native-rdpsnd")] + connector.attach_static_channel(ironrdp::rdpsnd::client::Rdpsnd::new(Box::new( + cpal::RdpsndBackend::new(), + ))); + if let Some(builder) = cliprdr_factory { let backend = builder.build_cliprdr_backend();