Merge pull request #4226 from 21pages/fix

send SwitchDisplay using the same channel with VideoFrame
This commit is contained in:
RustDesk 2023-04-28 17:20:17 +08:00 committed by GitHub
commit a674ab0603
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -165,18 +165,23 @@ impl Subscriber for ConnInner {
#[inline] #[inline]
fn send(&mut self, msg: Arc<Message>) { fn send(&mut self, msg: Arc<Message>) {
match &msg.union { // Send SwitchDisplay on the same channel as VideoFrame to avoid send order problems.
Some(message::Union::VideoFrame(_)) => { let tx_by_video = match &msg.union {
self.tx_video.as_mut().map(|tx| { Some(message::Union::VideoFrame(_)) => true,
allow_err!(tx.send((Instant::now(), msg))); Some(message::Union::Misc(misc)) => match &misc.union {
}); Some(misc::Union::SwitchDisplay(_)) => true,
} _ => false,
_ => { },
self.tx.as_mut().map(|tx| { _ => false,
allow_err!(tx.send((Instant::now(), msg))); };
}); let tx = if tx_by_video {
} self.tx_video.as_mut()
} } else {
self.tx.as_mut()
};
tx.map(|tx| {
allow_err!(tx.send((Instant::now(), msg)));
});
} }
} }