mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 18:42:48 +08:00
Added exception handling in videobuffer
This commit is contained in:
@@ -95,6 +95,10 @@ void imageCollectionThread(void* arg)
|
||||
|
||||
VideoDispatcher* dispatcher = (VideoDispatcher*) arg;
|
||||
|
||||
while (dispatcher->active)
|
||||
{
|
||||
try
|
||||
{
|
||||
cv::VideoCapture cap=cv::VideoCapture();
|
||||
cap.open(dispatcher->mjpeg_url);
|
||||
|
||||
@@ -134,4 +138,16 @@ void imageCollectionThread(void* arg)
|
||||
// Delay 100ms
|
||||
usleep(100000);
|
||||
}
|
||||
}
|
||||
catch (const std::runtime_error& error)
|
||||
{
|
||||
// Error occured while trying to gather image. Retry, don't exit.
|
||||
std::cerr << "VideoBuffer exception: " << error.what() << std::endl;
|
||||
}
|
||||
// Delay 1 second
|
||||
usleep(1000000);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -2,6 +2,7 @@
|
||||
#define OPENALPR_VIDEOBUFFER_H
|
||||
|
||||
#include <cstdio>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
|
||||
|
Reference in New Issue
Block a user