mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-07 02:32:45 +08:00
Added exception handling in videobuffer
This commit is contained in:
@@ -95,6 +95,10 @@ void imageCollectionThread(void* arg)
|
|||||||
|
|
||||||
VideoDispatcher* dispatcher = (VideoDispatcher*) arg;
|
VideoDispatcher* dispatcher = (VideoDispatcher*) arg;
|
||||||
|
|
||||||
|
while (dispatcher->active)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
cv::VideoCapture cap=cv::VideoCapture();
|
cv::VideoCapture cap=cv::VideoCapture();
|
||||||
cap.open(dispatcher->mjpeg_url);
|
cap.open(dispatcher->mjpeg_url);
|
||||||
|
|
||||||
@@ -135,3 +139,15 @@ void imageCollectionThread(void* arg)
|
|||||||
usleep(100000);
|
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
|
#define OPENALPR_VIDEOBUFFER_H
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
#include "opencv2/highgui/highgui.hpp"
|
#include "opencv2/highgui/highgui.hpp"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user