portable-service: add yuv set flag to fix start splash

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2022-11-13 16:33:22 +08:00
parent 4d492cb2c6
commit 8c529a1159

View File

@ -261,7 +261,13 @@ pub mod server {
let para = para_ptr as *const CapturerPara; let para = para_ptr as *const CapturerPara;
let current_display = (*para).current_display; let current_display = (*para).current_display;
let use_yuv = (*para).use_yuv; let use_yuv = (*para).use_yuv;
let use_yuv_set = (*para).use_yuv_set;
let timeout_ms = (*para).timeout_ms; let timeout_ms = (*para).timeout_ms;
if !use_yuv_set {
c = None;
std::thread::sleep(spf);
continue;
}
if c.is_none() { if c.is_none() {
*crate::video_service::CURRENT_DISPLAY.lock().unwrap() = current_display; *crate::video_service::CURRENT_DISPLAY.lock().unwrap() = current_display;
let (_, _current, display) = get_current_display().unwrap(); let (_, _current, display) = get_current_display().unwrap();
@ -476,6 +482,7 @@ pub mod client {
CapturerPara { CapturerPara {
current_display, current_display,
use_yuv, use_yuv,
use_yuv_set: false,
timeout_ms: 33, timeout_ms: 33,
}, },
); );
@ -499,18 +506,17 @@ pub mod client {
unsafe { unsafe {
let para_ptr = shmem.as_ptr().add(ADDR_CAPTURER_PARA); let para_ptr = shmem.as_ptr().add(ADDR_CAPTURER_PARA);
let para = para_ptr as *const CapturerPara; let para = para_ptr as *const CapturerPara;
if use_yuv != (*para).use_yuv {
Self::set_para( Self::set_para(
shmem, shmem,
CapturerPara { CapturerPara {
current_display: (*para).current_display, current_display: (*para).current_display,
use_yuv, use_yuv,
use_yuv_set: true,
timeout_ms: (*para).timeout_ms, timeout_ms: (*para).timeout_ms,
}, },
); );
} }
} }
}
fn frame<'a>(&'a mut self, timeout: Duration) -> std::io::Result<Frame<'a>> { fn frame<'a>(&'a mut self, timeout: Duration) -> std::io::Result<Frame<'a>> {
let mut option = SHMEM.lock().unwrap(); let mut option = SHMEM.lock().unwrap();
@ -525,6 +531,7 @@ pub mod client {
CapturerPara { CapturerPara {
current_display: (*para).current_display, current_display: (*para).current_display,
use_yuv: (*para).use_yuv, use_yuv: (*para).use_yuv,
use_yuv_set: (*para).use_yuv_set,
timeout_ms: timeout.as_millis() as _, timeout_ms: timeout.as_millis() as _,
}, },
); );
@ -732,5 +739,6 @@ pub mod client {
struct CapturerPara { struct CapturerPara {
current_display: usize, current_display: usize,
use_yuv: bool, use_yuv: bool,
use_yuv_set: bool,
timeout_ms: i32, timeout_ms: i32,
} }