mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-11 21:50:06 +08:00
Moved frame number counter to inside mutex
This commit is contained in:
@@ -25,11 +25,11 @@ class VideoDispatcher
|
||||
|
||||
int getLatestFrame(cv::Mat* frame)
|
||||
{
|
||||
tthread::lock_guard<tthread::mutex> guard(mMutex);
|
||||
|
||||
if (latestFrameNumber == lastFrameRead)
|
||||
return -1;
|
||||
|
||||
tthread::lock_guard<tthread::mutex> 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<tthread::mutex> guard(mMutex);
|
||||
this->latestFrame = frame;
|
||||
|
||||
this->latestFrameNumber++;
|
||||
|
Reference in New Issue
Block a user