mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
fix audio no sound, add missing VideoFrame timestamp
move get_time to hbb_common Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
// https://github.com/krruzic/pulsectl
|
||||
|
||||
use super::*;
|
||||
use hbb_common::get_time;
|
||||
use magnum_opus::{Application::*, Channels::*, Encoder};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
@@ -348,7 +349,7 @@ fn send_f32(data: &[f32], encoder: &mut Encoder, sp: &GenericService) {
|
||||
let mut msg_out = Message::new();
|
||||
msg_out.set_audio_frame(AudioFrame {
|
||||
data: data.into(),
|
||||
timestamp: crate::common::get_time(),
|
||||
timestamp: get_time(),
|
||||
..Default::default()
|
||||
});
|
||||
sp.send(msg_out);
|
||||
@@ -368,7 +369,7 @@ fn send_f32(data: &[f32], encoder: &mut Encoder, sp: &GenericService) {
|
||||
let mut msg_out = Message::new();
|
||||
msg_out.set_audio_frame(AudioFrame {
|
||||
data: data.into(),
|
||||
timestamp: crate::common::get_time(),
|
||||
timestamp: get_time(),
|
||||
..Default::default()
|
||||
});
|
||||
sp.send(msg_out);
|
||||
|
||||
@@ -12,7 +12,7 @@ use hbb_common::{
|
||||
fs,
|
||||
fs::can_enable_overwrite_detection,
|
||||
futures::{SinkExt, StreamExt},
|
||||
get_version_number,
|
||||
get_time, get_version_number,
|
||||
message_proto::{option_message::BoolOption, permission_info::Permission},
|
||||
password_security as password, sleep, timeout,
|
||||
tokio::{
|
||||
@@ -397,7 +397,7 @@ impl Connection {
|
||||
conn.on_close("Timeout", true).await;
|
||||
break;
|
||||
}
|
||||
let time = crate::get_time();
|
||||
let time = get_time();
|
||||
if time > 0 && conn.last_test_delay == 0 {
|
||||
conn.last_test_delay = time;
|
||||
let mut msg_out = Message::new();
|
||||
@@ -983,7 +983,7 @@ impl Connection {
|
||||
.get(&self.ip)
|
||||
.map(|x| x.clone())
|
||||
.unwrap_or((0, 0, 0));
|
||||
let time = (crate::get_time() / 60_000) as i32;
|
||||
let time = (get_time() / 60_000) as i32;
|
||||
if failure.2 > 30 {
|
||||
self.send_login_error("Too many wrong password attempts")
|
||||
.await;
|
||||
@@ -1022,7 +1022,7 @@ impl Connection {
|
||||
self.inner.send(msg_out.into());
|
||||
} else {
|
||||
self.last_test_delay = 0;
|
||||
let new_delay = (crate::get_time() - t.time) as u32;
|
||||
let new_delay = (get_time() - t.time) as u32;
|
||||
video_service::VIDEO_QOS
|
||||
.lock()
|
||||
.unwrap()
|
||||
@@ -1038,9 +1038,9 @@ impl Connection {
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
if self.keyboard {
|
||||
if is_left_up(&me) {
|
||||
CLICK_TIME.store(crate::get_time(), Ordering::SeqCst);
|
||||
CLICK_TIME.store(get_time(), Ordering::SeqCst);
|
||||
} else {
|
||||
MOUSE_MOVE_TIME.store(crate::get_time(), Ordering::SeqCst);
|
||||
MOUSE_MOVE_TIME.store(get_time(), Ordering::SeqCst);
|
||||
}
|
||||
self.input_mouse(me, self.inner.id());
|
||||
}
|
||||
@@ -1049,7 +1049,7 @@ impl Connection {
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
if self.keyboard {
|
||||
if is_enter(&me) {
|
||||
CLICK_TIME.store(crate::get_time(), Ordering::SeqCst);
|
||||
CLICK_TIME.store(get_time(), Ordering::SeqCst);
|
||||
}
|
||||
// handle all down as press
|
||||
// fix unexpected repeating key on remote linux, seems also fix abnormal alt/shift, which
|
||||
|
||||
@@ -3,7 +3,7 @@ use crate::common::IS_X11;
|
||||
#[cfg(target_os = "macos")]
|
||||
use dispatch::Queue;
|
||||
use enigo::{Enigo, Key, KeyboardControllable, MouseButton, MouseControllable};
|
||||
use hbb_common::{config::COMPRESS_LEVEL, protobuf::EnumOrUnknown};
|
||||
use hbb_common::{config::COMPRESS_LEVEL, get_time, protobuf::EnumOrUnknown};
|
||||
use rdev::{simulate, EventType, Key as RdevKey};
|
||||
use std::{
|
||||
convert::TryFrom,
|
||||
@@ -111,7 +111,7 @@ fn run_pos(sp: GenericService, state: &mut StatePos) -> ResultType<()> {
|
||||
..Default::default()
|
||||
});
|
||||
let exclude = {
|
||||
let now = crate::get_time();
|
||||
let now = get_time();
|
||||
let lock = LATEST_INPUT.lock().unwrap();
|
||||
if now - lock.time < 300 {
|
||||
lock.conn
|
||||
@@ -365,7 +365,7 @@ fn handle_mouse_(evt: &MouseEvent, conn: i32) {
|
||||
let buttons = evt.mask >> 3;
|
||||
let evt_type = evt.mask & 0x7;
|
||||
if evt_type == 0 {
|
||||
let time = crate::get_time();
|
||||
let time = get_time();
|
||||
*LATEST_INPUT.lock().unwrap() = Input { time, conn };
|
||||
}
|
||||
let mut en = ENIGO.lock().unwrap();
|
||||
|
||||
@@ -601,7 +601,7 @@ fn create_msg(vp9s: Vec<EncodedVideoFrame>) -> Message {
|
||||
frames: vp9s.into(),
|
||||
..Default::default()
|
||||
});
|
||||
vf.timestamp = crate::common::get_time();
|
||||
vf.timestamp = hbb_common::get_time();
|
||||
msg_out.set_video_frame(vf);
|
||||
msg_out
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user