fix last commit, snapshot for sending to new subscribers (#6762)
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
3e78aacc7e
commit
6953efc2d8
@ -741,15 +741,12 @@ fn try_broadcast_display_changed(
|
|||||||
) {
|
) {
|
||||||
log::info!("Display {} changed", display);
|
log::info!("Display {} changed", display);
|
||||||
if let Some(msg_out) = make_display_changed_msg(display_idx, Some(display)) {
|
if let Some(msg_out) = make_display_changed_msg(display_idx, Some(display)) {
|
||||||
// switch display may occur before the first video frame, add snapshot to ensure successful send
|
sp.send(msg_out.clone());
|
||||||
sp.snapshot(|sps| {
|
// switch display may occur before the first video frame, add snapshot to send to new subscribers
|
||||||
// so that new sub and old sub share the same encoder after switch
|
sp.snapshot(move |sps| {
|
||||||
if sps.has_subscribes() {
|
sps.send(msg_out.clone());
|
||||||
bail!("SWITCH");
|
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
})?;
|
})?;
|
||||||
sp.send(msg_out);
|
|
||||||
bail!("SWITCH");
|
bail!("SWITCH");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user