This commit is contained in:
rustdesk 2022-05-20 00:22:43 +08:00
parent a1a41bea06
commit 920a3c0a4f

View File

@ -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 {