From 86e9c380bb033d4ffa36acf5883516727278c299 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 22 Feb 2017 09:24:58 +0100 Subject: tracker/pt: don't busy loop when trying to get a frame Reported-by: @MathijsG Issue: #552 --- tracker-pt/camera.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tracker-pt') 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; -- cgit v1.2.3