diff --git a/tests/ANSCV-UnitTest/ANSCV-UnitTest.cpp b/tests/ANSCV-UnitTest/ANSCV-UnitTest.cpp index 71d435d..39897f8 100644 --- a/tests/ANSCV-UnitTest/ANSCV-UnitTest.cpp +++ b/tests/ANSCV-UnitTest/ANSCV-UnitTest.cpp @@ -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 }