Skip to content

Commit dd76c35

Browse files
committed
过滤未变化的帧&网速计算
1 parent f2fd56f commit dd76c35

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

dsclient/src/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ fn draw(host: String, pwd: String) {
302302
yuv = d.reset(yuv).unwrap();
303303

304304
yuv.par_iter_mut().zip(_yuv.par_iter()).for_each(|(a, b)| {
305-
*a = b.wrapping_sub(*a);
305+
*a = *b ^ *a;
306306
});
307307

308308
if let Ok(mut _buf) = work_buf.write() {
@@ -317,7 +317,7 @@ fn draw(host: String, pwd: String) {
317317
last = cur;
318318
_length_all = _length_sum;
319319
if let Ok(mut a) = _tool_str.write() {
320-
*a = format!("FPS:{:2} | Rate:{:>6}kb/s", fps, _length_all * 8 / 1024);
320+
*a = format!("FPS:{:2} | Rate:{:>6}kb/s", fps, _length_all / 1024);
321321
}
322322
fps = fpscount;
323323
fpscount = 0;

dsserver/src/server.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,11 @@ fn screen_stream(mut stream: TcpStream) {
214214
yuv.set_len(0);
215215
}
216216
dscom::convert::bgra_to_i420(w, h, bgra, &mut yuv);
217+
if yuv[..w*h] == last[..w*h] {
218+
continue;
219+
}
217220
last.par_iter_mut().zip(yuv.par_iter()).for_each(|(a, b)|{
218-
*a = a.wrapping_sub(*b);
221+
*a = *a ^ *b;
219222
});
220223
// 压缩
221224
unsafe {

0 commit comments

Comments
 (0)