send SwitchDisplay using the same channel with VideoFrame
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
2b8a98da06
commit
ca7487350f
@ -165,18 +165,23 @@ impl Subscriber for ConnInner {
|
||||
|
||||
#[inline]
|
||||
fn send(&mut self, msg: Arc<Message>) {
|
||||
match &msg.union {
|
||||
Some(message::Union::VideoFrame(_)) => {
|
||||
self.tx_video.as_mut().map(|tx| {
|
||||
allow_err!(tx.send((Instant::now(), msg)));
|
||||
});
|
||||
}
|
||||
_ => {
|
||||
self.tx.as_mut().map(|tx| {
|
||||
allow_err!(tx.send((Instant::now(), msg)));
|
||||
});
|
||||
}
|
||||
}
|
||||
// Send SwitchDisplay on the same channel as VideoFrame to avoid send order problems.
|
||||
let tx_by_video = match &msg.union {
|
||||
Some(message::Union::VideoFrame(_)) => true,
|
||||
Some(message::Union::Misc(misc)) => match &misc.union {
|
||||
Some(misc::Union::SwitchDisplay(_)) => true,
|
||||
_ => false,
|
||||
},
|
||||
_ => false,
|
||||
};
|
||||
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)));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user