|
|
@@ -39,10 +39,10 @@ import static org.opencv.imgproc.Imgproc.*;
|
|
|
|
|
|
@Service
|
|
|
public class VideoRecognitionServiceImpl implements VideoRecognitionService {
|
|
|
- public static boolean DEBUG = false;
|
|
|
- private ThreadPoolExecutor executor = new ThreadPoolExecutor(10, 10, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<>());
|
|
|
- private Map<String, Map<String, Object>> resultMap = new HashMap<>();
|
|
|
- private Map<String, Long> lastStat = new HashMap<>();
|
|
|
+ public static boolean DEBUG = false;
|
|
|
+ private ThreadPoolExecutor executor = new ThreadPoolExecutor(10, 10, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<>());
|
|
|
+ private Map<String, Map<String, Object>> resultMap = new HashMap<>();
|
|
|
+ private Map<String, Long> lastStat = new HashMap<>();
|
|
|
|
|
|
static {
|
|
|
CLibrary.INSTANCE.setlocale(CLibrary.LC_ALL, "C");
|
|
|
@@ -56,9 +56,9 @@ public class VideoRecognitionServiceImpl implements VideoRecognitionService {
|
|
|
public interface CLibrary extends Library {
|
|
|
CLibrary INSTANCE = (CLibrary) Native.loadLibrary((Platform.isWindows() ? "msvcrt" : "c"), CLibrary.class);
|
|
|
|
|
|
- int LC_CTYPE = 0;
|
|
|
+ int LC_CTYPE = 0;
|
|
|
int LC_NUMERIC = 1;
|
|
|
- int LC_ALL = 6;
|
|
|
+ int LC_ALL = 6;
|
|
|
|
|
|
// char *setlocale(int category, const char *locale);
|
|
|
String setlocale(int category, String locale);
|
|
|
@@ -82,6 +82,9 @@ public class VideoRecognitionServiceImpl implements VideoRecognitionService {
|
|
|
if (frameCount % 200 == 0) {
|
|
|
System.gc();
|
|
|
}
|
|
|
+ if (lastStat.get(videoPath) - System.currentTimeMillis() > 60 * 1000) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
if (frameCount % 3 != 0) {
|
|
|
continue;
|
|
|
}
|