improve video, ignore same image

This commit is contained in:
rustdesk
2022-04-24 02:50:28 +08:00
parent 264db496ff
commit 4d5d0a4c62
6 changed files with 37 additions and 8 deletions

View File

@@ -49,6 +49,7 @@ pub struct Capturer {
rotated: Vec<u8>,
gdi_capturer: Option<CapturerGDI>,
gdi_buffer: Vec<u8>,
saved_raw_data: Vec<u128>, // for faster compare and copy
}
impl Capturer {
@@ -150,6 +151,7 @@ impl Capturer {
rotated: Vec::new(),
gdi_capturer,
gdi_buffer: Vec::new(),
saved_raw_data: Vec::new(),
})
}
@@ -233,7 +235,13 @@ impl Capturer {
let result = {
if let Some(gdi_capturer) = &self.gdi_capturer {
match gdi_capturer.frame(&mut self.gdi_buffer) {
Ok(_) => &self.gdi_buffer,
Ok(_) => {
crate::would_block_if_equal(
&mut self.saved_raw_data,
&self.gdi_buffer,
)?;
&self.gdi_buffer
}
Err(err) => {
return Err(io::Error::new(io::ErrorKind::Other, err.to_string()));
}