diff --git a/Cargo.lock b/Cargo.lock index 47c30254..4fa0162a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2673,6 +2673,7 @@ version = "0.5.0" dependencies = [ "anyhow", "async-trait", + "bytes", "ironrdp-acceptor", "ironrdp-ainput", "ironrdp-async", diff --git a/crates/ironrdp-bench/benches/bench.rs b/crates/ironrdp-bench/benches/bench.rs index 5781a6e4..8fabf29e 100644 --- a/crates/ironrdp-bench/benches/bench.rs +++ b/crates/ironrdp-bench/benches/bench.rs @@ -15,7 +15,7 @@ pub fn rfx_enc_tile_bench(c: &mut Criterion) { width: NonZero::new(64).unwrap(), height: NonZero::new(64).unwrap(), format: ironrdp_server::PixelFormat::ARgb32, - data: vec![0; 64 * 64 * 4], + data: vec![0; 64 * 64 * 4].into(), stride: 64 * 4, }; c.bench_function("rfx_enc_tile", |b| b.iter(|| rfx_enc_tile(&bitmap, &quant, algo, 0, 0))); @@ -30,7 +30,7 @@ pub fn rfx_enc_bench(c: &mut Criterion) { width: NonZero::new(2048).unwrap(), height: NonZero::new(2048).unwrap(), format: ironrdp_server::PixelFormat::ARgb32, - data: vec![0; 2048 * 2048 * 4], + data: vec![0; 2048 * 2048 * 4].into(), stride: 64 * 4, }; c.bench_function("rfx_enc", |b| b.iter(|| rfx_enc(&bitmap, &quant, algo))); diff --git a/crates/ironrdp-server/Cargo.toml b/crates/ironrdp-server/Cargo.toml index aba6e3d3..e2a26728 100644 --- a/crates/ironrdp-server/Cargo.toml +++ b/crates/ironrdp-server/Cargo.toml @@ -45,6 +45,7 @@ tracing = { version = "0.1", features = ["log"] } x509-cert = { version = "0.2.5", optional = true } rustls-pemfile = { version = "2.2.0", optional = true } rayon = { version = "1.10.0", optional = true } +bytes = "1" [dev-dependencies] tokio = { version = "1", features = ["sync"] } diff --git a/crates/ironrdp-server/src/display.rs b/crates/ironrdp-server/src/display.rs index 4eae9e66..5f0912f3 100644 --- a/crates/ironrdp-server/src/display.rs +++ b/crates/ironrdp-server/src/display.rs @@ -1,6 +1,7 @@ use core::num::NonZeroU16; use anyhow::Result; +use bytes::Bytes; use ironrdp_displaycontrol::pdu::DisplayControlMonitorLayout; use ironrdp_pdu::pointer::PointerPositionAttribute; @@ -67,7 +68,7 @@ pub struct BitmapUpdate { pub width: NonZeroU16, pub height: NonZeroU16, pub format: PixelFormat, - pub data: Vec, + pub data: Bytes, pub stride: usize, } diff --git a/crates/ironrdp/examples/server.rs b/crates/ironrdp/examples/server.rs index c881e122..30729686 100644 --- a/crates/ironrdp/examples/server.rs +++ b/crates/ironrdp/examples/server.rs @@ -183,7 +183,7 @@ impl RdpServerDisplayUpdates for DisplayUpdates { width, height, format: PixelFormat::BgrA32, - data, + data: data.into(), stride: usize::from(width.get()).checked_mul(4).unwrap(), }; Some(DisplayUpdate::Bitmap(bitmap))