remove android build warns

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2023-03-27 19:13:29 +08:00
parent 3c69773e64
commit 8cb361c51e
15 changed files with 101 additions and 43 deletions

View File

@@ -64,6 +64,7 @@ mod pa_impl {
)))
.await
);
#[cfg(target_os = "linux")]
let zero_audio_frame: Vec<f32> = vec![0.; AUDIO_DATA_SIZE_U8 / 4];
while sp.ok() && !RESTARTING.load(Ordering::SeqCst) {
sp.snapshot(|sps| {

View File

@@ -64,7 +64,9 @@ pub struct ConnInner {
}
enum MessageInput {
#[cfg(not(any(target_os = "android", target_os = "ios")))]
Mouse((MouseEvent, i32)),
#[cfg(not(any(target_os = "android", target_os = "ios")))]
Key((KeyEvent, bool)),
BlockOn,
BlockOff,
@@ -125,6 +127,7 @@ pub struct Connection {
#[cfg(windows)]
portable: PortableState,
from_switch: bool,
#[cfg(not(any(target_os = "android", target_os = "ios")))]
origin_resolution: HashMap<String, Resolution>,
voice_call_request_timestamp: Option<NonZeroI64>,
audio_input_device_before_voice_call: Option<String>,
@@ -187,9 +190,10 @@ impl Connection {
let (tx_to_cm, rx_to_cm) = mpsc::unbounded_channel::<ipc::Data>();
let (tx, mut rx) = mpsc::unbounded_channel::<(Instant, Arc<Message>)>();
let (tx_video, mut rx_video) = mpsc::unbounded_channel::<(Instant, Arc<Message>)>();
let (tx_input, rx_input) = std_mpsc::channel();
let (tx_input, _rx_input) = std_mpsc::channel();
let mut hbbs_rx = crate::hbbs_http::sync::signal_receiver();
#[cfg(not(any(target_os = "android", target_os = "ios")))]
let tx_cloned = tx.clone();
let mut conn = Self {
inner: ConnInner {
@@ -233,6 +237,7 @@ impl Connection {
#[cfg(windows)]
portable: Default::default(),
from_switch: false,
#[cfg(not(any(target_os = "android", target_os = "ios")))]
origin_resolution: Default::default(),
audio_sender: None,
voice_call_request_timestamp: None,
@@ -282,7 +287,7 @@ impl Connection {
);
#[cfg(not(any(target_os = "android", target_os = "ios")))]
std::thread::spawn(move || Self::handle_input(rx_input, tx_cloned));
std::thread::spawn(move || Self::handle_input(_rx_input, tx_cloned));
let mut second_timer = time::interval(Duration::from_secs(1));
loop {
@@ -1042,11 +1047,13 @@ impl Connection {
}
#[inline]
#[cfg(not(any(target_os = "android", target_os = "ios")))]
fn input_mouse(&self, msg: MouseEvent, conn_id: i32) {
self.tx_input.send(MessageInput::Mouse((msg, conn_id))).ok();
}
#[inline]
#[cfg(not(any(target_os = "android", target_os = "ios")))]
fn input_key(&self, msg: KeyEvent, press: bool) {
self.tx_input.send(MessageInput::Key((msg, press))).ok();
}
@@ -1342,8 +1349,10 @@ impl Connection {
self.input_mouse(me, self.inner.id());
}
}
#[cfg(any(target_os = "android", target_os = "ios"))]
Some(message::Union::KeyEvent(..)) => {}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
Some(message::Union::KeyEvent(me)) => {
#[cfg(not(any(target_os = "android", target_os = "ios")))]
if self.peer_keyboard_enabled() {
if is_enter(&me) {
CLICK_TIME.store(get_time(), Ordering::SeqCst);
@@ -1371,11 +1380,11 @@ impl Connection {
}
}
}
Some(message::Union::Clipboard(cb)) =>
Some(message::Union::Clipboard(_cb)) =>
{
#[cfg(not(any(target_os = "android", target_os = "ios")))]
if self.clipboard {
update_clipboard(cb, None);
update_clipboard(_cb, None);
}
}
Some(message::Union::Cliprdr(_clip)) => {

View File

@@ -831,14 +831,13 @@ pub fn handle_one_frame_encoded(
}
Ok(())
})?;
let mut send_conn_ids: HashSet<i32> = Default::default();
let vp9_frame = EncodedVideoFrame {
data: frame.to_vec().into(),
key: true,
pts: ms,
..Default::default()
};
send_conn_ids = sp.send_video_frame(create_msg(vec![vp9_frame]));
let send_conn_ids = sp.send_video_frame(create_msg(vec![vp9_frame]));
Ok(send_conn_ids)
}