add snapshot before sending SwitchDisplay (#6760)

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2023-12-28 21:34:54 +08:00
committed by GitHub
parent 20b4ce3213
commit 3e78aacc7e

View File

@@ -741,6 +741,14 @@ fn try_broadcast_display_changed(
) {
log::info!("Display {} changed", 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.snapshot(|sps| {
// so that new sub and old sub share the same encoder after switch
if sps.has_subscribes() {
bail!("SWITCH");
}
Ok(())
})?;
sp.send(msg_out);
bail!("SWITCH");
}