summaryrefslogtreecommitdiffhomepage
path: root/FTNoIR_Tracker_PT
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2014-01-14 00:44:09 +0100
committerStanislaw Halik <sthalik@misaki.pl>2014-01-14 00:44:09 +0100
commit0232c0af79ce21c5c5735db5368ac83aa12f94b2 (patch)
treefa75c8e72fc4b69ef3edaf2f7355a1504304161c /FTNoIR_Tracker_PT
parent0abdc671d5ffe56284b106fd48da2a1abacee6af (diff)
prevent mutex starvation with PT on non-Windows platforms
Diffstat (limited to 'FTNoIR_Tracker_PT')
-rw-r--r--FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp
index d15e13f8..162e4343 100644
--- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp
+++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp
@@ -69,9 +69,7 @@ void Tracker::run()
float dt;
bool new_frame;
forever
- {
- QMutexLocker lock(&mutex);
-
+ {
if (commands & ABORT) break;
if (commands & PAUSE) continue;
commands = 0;
@@ -79,8 +77,11 @@ void Tracker::run()
dt = time.restart() / 1000.0;
new_frame = camera.get_frame(dt, &frame);
+
if (new_frame && !frame.empty())
{
+ QMutexLocker lock(&mutex);
+
frame = frame_rotation.rotate_frame(frame);
const std::vector<cv::Vec2f>& points = point_extractor.extract_points(frame, dt, true);
for (auto p : points)