Skip to content

Commit 4c8e7de

Browse files
authored
feat(client): make rdpsnd-native an optional default-enabled dependency
Extract rdpsnd support from PR #1289 into a dedicated PR as suggested in review. The native-rdpsnd feature is default-enabled so rdpsnd is always included unless explicitly opted out (e.g. by headless/agent consumers using --no-default-features). Ref: #1289 (review)
1 parent 0bbffcd commit 4c8e7de

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

crates/ironrdp-client/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ name = "ironrdp-client"
2424
test = false
2525

2626
[features]
27-
default = ["rustls"]
27+
default = ["rustls", "native-rdpsnd"]
2828
rustls = ["ironrdp-tls/rustls", "tokio-tungstenite/rustls-tls-native-roots", "ironrdp-mstsgu/rustls"]
2929
native-tls = ["ironrdp-tls/native-tls", "tokio-tungstenite/native-tls", "ironrdp-mstsgu/native-tls"]
30+
native-rdpsnd = ["dep:ironrdp-rdpsnd-native"]
3031
qoi = ["ironrdp/qoi"]
3132
qoiz = ["ironrdp/qoiz"]
3233

@@ -47,7 +48,7 @@ ironrdp = { path = "../ironrdp", version = "0.14", features = [
4748
] }
4849
ironrdp-core = { path = "../ironrdp-core", version = "0.1", features = ["alloc"] }
4950
ironrdp-cliprdr-native = { path = "../ironrdp-cliprdr-native", version = "0.5" }
50-
ironrdp-rdpsnd-native = { path = "../ironrdp-rdpsnd-native", version = "0.5" }
51+
ironrdp-rdpsnd-native = { path = "../ironrdp-rdpsnd-native", version = "0.5", optional = true }
5152
ironrdp-tls = { path = "../ironrdp-tls", version = "0.2" }
5253
ironrdp-mstsgu = { path = "../ironrdp-mstsgu" }
5354
ironrdp-tokio = { path = "../ironrdp-tokio", version = "0.8", features = ["reqwest"] }

crates/ironrdp-client/src/rdp.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ use ironrdp::pdu::{PduResult, pdu_other_err};
1616
use ironrdp::session::image::DecodedImage;
1717
use ironrdp::session::{ActiveStage, ActiveStageOutput, GracefulDisconnectReason, SessionResult, fast_path};
1818
use ironrdp::svc::SvcMessage;
19-
use ironrdp::{cliprdr, connector, rdpdr, rdpsnd, session};
19+
use ironrdp::{cliprdr, connector, rdpdr, session};
2020
use ironrdp_core::WriteBuf;
2121
#[cfg(windows)]
2222
use ironrdp_dvc_com_plugin::load_dvc_plugin;
2323
use ironrdp_dvc_pipe_proxy::DvcNamedPipeProxy;
24+
#[cfg(feature = "native-rdpsnd")]
2425
use ironrdp_rdpsnd_native::cpal;
2526
use ironrdp_tokio::reqwest::ReqwestNetworkClient;
2627
use ironrdp_tokio::{FramedWrite, single_sequence_step_read, split_tokio_framed};
@@ -252,9 +253,13 @@ async fn connect(
252253

253254
let mut connector = connector::ClientConnector::new(config.connector.clone(), client_addr)
254255
.with_static_channel(drdynvc)
255-
.with_static_channel(rdpsnd::client::Rdpsnd::new(Box::new(cpal::RdpsndBackend::new())))
256256
.with_static_channel(rdpdr::Rdpdr::new(Box::new(NoopRdpdrBackend {}), "IronRDP".to_owned()).with_smartcard(0));
257257

258+
#[cfg(feature = "native-rdpsnd")]
259+
connector.attach_static_channel(ironrdp::rdpsnd::client::Rdpsnd::new(Box::new(
260+
cpal::RdpsndBackend::new(),
261+
)));
262+
258263
if let Some(builder) = cliprdr_factory {
259264
let backend = builder.build_cliprdr_backend();
260265

@@ -376,9 +381,13 @@ async fn connect_ws(
376381

377382
let mut connector = connector::ClientConnector::new(config.connector.clone(), client_addr)
378383
.with_static_channel(drdynvc)
379-
.with_static_channel(rdpsnd::client::Rdpsnd::new(Box::new(cpal::RdpsndBackend::new())))
380384
.with_static_channel(rdpdr::Rdpdr::new(Box::new(NoopRdpdrBackend {}), "IronRDP".to_owned()).with_smartcard(0));
381385

386+
#[cfg(feature = "native-rdpsnd")]
387+
connector.attach_static_channel(ironrdp::rdpsnd::client::Rdpsnd::new(Box::new(
388+
cpal::RdpsndBackend::new(),
389+
)));
390+
382391
if let Some(builder) = cliprdr_factory {
383392
let backend = builder.build_cliprdr_backend();
384393

0 commit comments

Comments
 (0)