mirror of https://github.com/jetkvm/kvm.git
fix based on copilot suggestions
This commit is contained in:
parent
3f9280cec5
commit
0fac7f4116
|
|
@ -729,11 +729,13 @@ bool wait_for_streaming_stopped()
|
||||||
int attempts = 0;
|
int attempts = 0;
|
||||||
while (attempts < 30) {
|
while (attempts < 30) {
|
||||||
if (get_streaming_stopped() == true) {
|
if (get_streaming_stopped() == true) {
|
||||||
|
log_info("video streaming stopped after %d attempts", attempts);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
usleep(100000); // 100ms
|
usleep(100000); // 100ms
|
||||||
attempts++;
|
attempts++;
|
||||||
}
|
}
|
||||||
|
log_error("video streaming did not stop after 3s");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -748,9 +750,7 @@ void video_stop_streaming()
|
||||||
set_streaming_flag(false);
|
set_streaming_flag(false);
|
||||||
|
|
||||||
log_info("waiting for video streaming thread to exit");
|
log_info("waiting for video streaming thread to exit");
|
||||||
if (!wait_for_streaming_stopped()) {
|
wait_for_streaming_stopped();
|
||||||
log_error("video streaming thread did not exit after 30s");
|
|
||||||
}
|
|
||||||
|
|
||||||
pthread_join(*streaming_thread, NULL);
|
pthread_join(*streaming_thread, NULL);
|
||||||
free(streaming_thread);
|
free(streaming_thread);
|
||||||
|
|
@ -763,7 +763,7 @@ uint8_t video_get_streaming_status() {
|
||||||
// streaming flag can be false when stopping streaming
|
// streaming flag can be false when stopping streaming
|
||||||
if (get_streaming_flag() == true) return 1;
|
if (get_streaming_flag() == true) return 1;
|
||||||
// streaming_stopped isn't protected by a mutex, but we won't care about race conditions here
|
// streaming_stopped isn't protected by a mutex, but we won't care about race conditions here
|
||||||
if (streaming_stopped == false) return 2;
|
if (get_streaming_stopped() == false) return 2;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -781,7 +781,6 @@ void video_restart_streaming()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wait_for_streaming_stopped()) {
|
if (!wait_for_streaming_stopped()) {
|
||||||
log_error("video streaming did not stop after 30s");
|
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -855,7 +854,7 @@ void *run_detect_format(void *arg)
|
||||||
|
|
||||||
if (should_restart) {
|
if (should_restart) {
|
||||||
log_info("restarting video streaming due to format change");
|
log_info("restarting video streaming due to format change");
|
||||||
video_restart_streaming(false);
|
video_restart_streaming();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue