android wait 3s for isStart flag (#10053)
The normal process is that `startCapture` and `VideoService::run` run in parallel, the `run` function waits for startCapture to complete, then sets the scale, and subsequently calls `stopCapture` and `startCapture`. If the `run` function does not wait long enough, `startCapture` initializes the surface with the original width and height, but the `start` flag is still false, meaning it can't call `stopCapture` and `startCapture`. This results in only capturing the upper-left portion of the virtual display. Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
parent
9d2bdfefb1
commit
30a11bfe0a
@ -845,14 +845,15 @@ fn check_change_scale(hardware: bool) -> ResultType<()> {
|
||||
use hbb_common::config::keys::OPTION_ENABLE_ANDROID_SOFTWARE_ENCODING_HALF_SCALE as SCALE_SOFT;
|
||||
|
||||
// isStart flag is set at the end of startCapture() in Android, wait it to be set.
|
||||
for i in 0..6 {
|
||||
let n = 60; // 3s
|
||||
for i in 0..n {
|
||||
if scrap::is_start() == Some(true) {
|
||||
log::info!("start flag is set");
|
||||
break;
|
||||
}
|
||||
log::info!("wait for start, {i}");
|
||||
std::thread::sleep(Duration::from_millis(50));
|
||||
if i == 5 {
|
||||
if i == n - 1 {
|
||||
log::error!("wait for start timeout");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user