fix: video service (#8812)
1. Unset refresh flag if just refreshed. 2. Reduce the scope of the lock. Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
parent
39dbd89287
commit
d73e0e1e5a
@ -1063,7 +1063,7 @@ impl FlutterHandler {
|
|||||||
}
|
}
|
||||||
// We need `is_sent` here. Because we use texture render for multi-displays session.
|
// We need `is_sent` here. Because we use texture render for multi-displays session.
|
||||||
//
|
//
|
||||||
// Eg. We have to windows, one is display 1, the other is displays 0&1.
|
// Eg. We have two windows, one is display 1, the other is displays 0&1.
|
||||||
// When image of display 0 is received, we will not send the event.
|
// When image of display 0 is received, we will not send the event.
|
||||||
//
|
//
|
||||||
// 1. "display 1" will not send the event.
|
// 1. "display 1" will not send the event.
|
||||||
|
@ -517,16 +517,22 @@ fn run(vs: VideoService) -> ResultType<()> {
|
|||||||
drop(video_qos);
|
drop(video_qos);
|
||||||
|
|
||||||
if sp.is_option_true(OPTION_REFRESH) {
|
if sp.is_option_true(OPTION_REFRESH) {
|
||||||
let mut last_refresh_lock = LAST_REFRESH_TIME.lock().unwrap();
|
if LAST_REFRESH_TIME
|
||||||
if last_refresh_lock
|
.lock()
|
||||||
|
.unwrap()
|
||||||
.get(&vs.idx)
|
.get(&vs.idx)
|
||||||
.map(|x| x.elapsed().as_millis() > REFRESH_MIN_INTERVAL_MILLIS)
|
.map(|x| x.elapsed().as_millis() > REFRESH_MIN_INTERVAL_MILLIS)
|
||||||
.unwrap_or(true)
|
.unwrap_or(true)
|
||||||
{
|
{
|
||||||
let _ = try_broadcast_display_changed(&sp, display_idx, &c, true);
|
let _ = try_broadcast_display_changed(&sp, display_idx, &c, true);
|
||||||
last_refresh_lock.insert(vs.idx, Instant::now());
|
LAST_REFRESH_TIME
|
||||||
|
.lock()
|
||||||
|
.unwrap()
|
||||||
|
.insert(vs.idx, Instant::now());
|
||||||
log::info!("switch to refresh");
|
log::info!("switch to refresh");
|
||||||
bail!("SWITCH");
|
bail!("SWITCH");
|
||||||
|
} else {
|
||||||
|
sp.set_option_bool(OPTION_REFRESH, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if codec_format != Encoder::negotiated_codec() {
|
if codec_format != Encoder::negotiated_codec() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user