diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2017-02-22 09:24:58 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-02-22 09:24:58 +0100 |
commit | 86e9c380bb033d4ffa36acf5883516727278c299 (patch) | |
tree | d222db1f49ec412fb023082593cf5ef80b9087e1 | |
parent | 9339632c619b689451d5f962c9a9b29b9ebd0c93 (diff) |
tracker/pt: don't busy loop when trying to get a frame
Reported-by: @MathijsG
Issue: #552
-rw-r--r-- | tracker-pt/camera.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tracker-pt/camera.cpp b/tracker-pt/camera.cpp index 220bcc8e..89854cc7 100644 --- a/tracker-pt/camera.cpp +++ b/tracker-pt/camera.cpp @@ -6,6 +6,7 @@ */ #include "camera.h" +#include "compat/sleep.hpp" namespace impl { @@ -124,8 +125,8 @@ DEFUN_WARN_UNUSED bool Camera::_get_frame(cv::Mat& frame) { if (cap && cap->isOpened()) { - for (int i = 0; i < 100 && !cap->read(frame); i++) - ;; + for (int i = 0; i < 5 && !cap->read(frame); i++) + portable::sleep(100); if (frame.empty()) return false; |