Revert "Only lock when needed."

This reverts commit 1c20855f29.
This commit is contained in:
Kees-V
2014-10-25 14:22:50 +02:00
parent eebc707f2b
commit 686743484c

View File

@@ -156,6 +156,7 @@ void getALPRImages(cv::VideoCapture cap, VideoDispatcher* dispatcher)
while (dispatcher->active)
{
dispatcher->mMutex.lock();
bool hasImage = false;
try
{
@@ -163,16 +164,15 @@ void getALPRImages(cv::VideoCapture cap, VideoDispatcher* dispatcher)
// Double check the image to make sure it's valid.
if (!frame.data || frame.empty())
{
dispatcher->mMutex.unlock();
std::stringstream ss;
ss << "Stream " << dispatcher->mjpeg_url << " received invalid frame";
dispatcher->log_error(ss.str());
return;
}
dispatcher->mMutex.lock();
dispatcher->setLatestFrame(&frame);
dispatcher->mMutex.unlock();
}
}
catch (const std::runtime_error& error)
{
// Error occured while trying to gather image. Retry, don't exit.