From cd2b99f26de4f52c2d113ea7af013f1508258c88 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Thu, 3 Jul 2014 10:48:38 -0400 Subject: [PATCH 1/3] Moved frame number counter to inside mutex --- src/videobuffer.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/videobuffer.h b/src/videobuffer.h index 813bb5a..1ea4b34 100644 --- a/src/videobuffer.h +++ b/src/videobuffer.h @@ -25,11 +25,11 @@ class VideoDispatcher int getLatestFrame(cv::Mat* frame) { + tthread::lock_guard guard(mMutex); + if (latestFrameNumber == lastFrameRead) return -1; - tthread::lock_guard guard(mMutex); - frame->create(latestFrame->size(), latestFrame->type()); latestFrame->copyTo(*frame); @@ -40,6 +40,7 @@ class VideoDispatcher void setLatestFrame(cv::Mat* frame) { + tthread::lock_guard guard(mMutex); this->latestFrame = frame; this->latestFrameNumber++; From 25edfef9ddaf9fbcfa5c2de1b6b16dae41d2c0f8 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Thu, 3 Jul 2014 12:13:38 -0400 Subject: [PATCH 2/3] removed unnecessary mutex --- src/videobuffer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/videobuffer.h b/src/videobuffer.h index 1ea4b34..fab6be0 100644 --- a/src/videobuffer.h +++ b/src/videobuffer.h @@ -40,7 +40,7 @@ class VideoDispatcher void setLatestFrame(cv::Mat* frame) { - tthread::lock_guard guard(mMutex); + //tthread::lock_guard guard(mMutex); this->latestFrame = frame; this->latestFrameNumber++; From 3da219c64f6e8b64206eaa30594445bb536ca078 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Thu, 3 Jul 2014 13:36:16 -0400 Subject: [PATCH 3/3] Fixed string warning --- src/misc_utilities/sortstate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/misc_utilities/sortstate.cpp b/src/misc_utilities/sortstate.cpp index eff5229..bb496cf 100644 --- a/src/misc_utilities/sortstate.cpp +++ b/src/misc_utilities/sortstate.cpp @@ -84,7 +84,7 @@ int main( int argc, const char** argv ) if (pipeline_data.region_confidence <= 20) { - pipeline_data.region_code = 'zz'; + pipeline_data.region_code = "zz"; pipeline_data.region_confidence = 100; } else