ANSCV test: pump GUI messages while waiting for frames

The empty-frame path slept 1 s without calling cv::waitKey, so the
HighGUI window stopped pumping Windows messages and went "Not
Responding" whenever the RTSP stream stalled for a few seconds.
Wait via cv::waitKey(1000) instead (ESC still exits). Same fix in
all three test loops that shared the pattern.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-06 21:39:39 +10:00
co-authored by Claude Fable 5
parent 005f3bc3d5
commit 044fedd344
+12 -3
View File
@@ -887,7 +887,10 @@ int RSTPTestCVClient() {
// ✅ Check if the image is valid BEFORE accessing it
if (!image || image->empty()) {
ANSCV_ReleaseImage_S(&image);
std::this_thread::sleep_for(std::chrono::seconds(1));
// Wait via waitKey (not sleep) so the HighGUI window keeps pumping
// Windows messages — a raw sleep here makes the "Image" window go
// "Not Responding" whenever the stream stalls for a few seconds.
if (cv::waitKey(1000) == 27) break;
continue; // Skip processing if the image is empty
}
@@ -1060,7 +1063,10 @@ int FPTestCVClient() {
// ✅ Check if the image is valid BEFORE accessing it
if (!image || image->empty()) {
ANSCV_ReleaseImage_S(&image);
std::this_thread::sleep_for(std::chrono::seconds(1));
// Wait via waitKey (not sleep) so the HighGUI window keeps pumping
// Windows messages — a raw sleep here makes the "Image" window go
// "Not Responding" whenever the stream stalls for a few seconds.
if (cv::waitKey(1000) == 27) break;
continue; // Skip processing if the image is empty
}
@@ -1549,7 +1555,10 @@ int VideoPlayerClientTest() {
// ✅ Check if the image is valid BEFORE accessing it
if (!image || image->empty()) {
ANSCV_ReleaseImage_S(&image);
std::this_thread::sleep_for(std::chrono::seconds(1));
// Wait via waitKey (not sleep) so the HighGUI window keeps pumping
// Windows messages — a raw sleep here makes the "Image" window go
// "Not Responding" whenever the stream stalls for a few seconds.
if (cv::waitKey(1000) == 27) break;
continue; // Skip processing if the image is empty
}