From 920a3c0a4f7fcbac2ba0d7ba28364626f5705618 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Fri, 20 May 2022 00:22:43 +0800 Subject: [PATCH] refactor --- src/client/helper.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/client/helper.rs b/src/client/helper.rs index 03da3aebe..abd20d312 100644 --- a/src/client/helper.rs +++ b/src/client/helper.rs @@ -41,8 +41,7 @@ impl LatencyController { // second, compute audio latency // set MAX and MIN, avoid fixing too frequently. pub fn check_audio(&mut self, timestamp: i64) -> bool { - let expected = - (Instant::now() - self.update_time).as_millis() as i64 + self.last_video_remote_ts; + let expected = self.update_time.elapsed().as_millis() as i64 + self.last_video_remote_ts; let latency = expected - timestamp; if self.allow_audio { if latency.abs() > MAX_LATENCY {