From 5f3a3dd5cfa006ccdad76dffd483be1c71a87ac3 Mon Sep 17 00:00:00 2001 From: WarmUpTill Date: Mon, 30 Jan 2023 20:56:39 +0100 Subject: [PATCH] Dynamically increase delay between screenshots up to one second Otherwise users with a very low switcher interval might not be able to use the preview dialog at all --- src/macro-external/opencv/preview-dialog.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/macro-external/opencv/preview-dialog.cpp b/src/macro-external/opencv/preview-dialog.cpp index 2d336ffc..5c32d123 100644 --- a/src/macro-external/opencv/preview-dialog.cpp +++ b/src/macro-external/opencv/preview-dialog.cpp @@ -198,12 +198,21 @@ void PreviewDialog::CheckForMatchLoop() if (_stop || isHidden()) { return; } - if (!screenshot.done || !_video.ValidSelection()) { + if (!_video.ValidSelection()) { _statusLabel->setText(obs_module_text( "AdvSceneSwitcher.condition.video.screenshotFail")); _imageLabel->setPixmap(QPixmap()); continue; } + if (!screenshot.done) { + _statusLabel->setText(obs_module_text( + "AdvSceneSwitcher.condition.video.screenshotFail")); + _imageLabel->setPixmap(QPixmap()); + if (_delay < 1000) { + _delay += 50; + } + continue; + } if (screenshot.image.width() == 0 || screenshot.image.height() == 0) { _statusLabel->setText(obs_module_text( @@ -220,6 +229,8 @@ void PreviewDialog::CheckForMatchLoop() _areaParams.area.height); } MarkMatch(screenshot.image); + } else { + _statusLabel->setText(""); } _imageLabel->setPixmap(QPixmap::fromImage(screenshot.image)); }