From a9bdb0a706e10d2dffb50ae5a8086dd744bbd976 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期二, 10 五月 2022 17:45:07 +0800 Subject: [PATCH] 优化语音广播流程 --- src/main/java/com/genersoft/iot/vmp/gb28181/session/CatalogDataCatch.java | 27 +++++++++++++++++---------- 1 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/session/CatalogDataCatch.java b/src/main/java/com/genersoft/iot/vmp/gb28181/session/CatalogDataCatch.java index 97360d2..7eeb778 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/session/CatalogDataCatch.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/session/CatalogDataCatch.java @@ -21,16 +21,13 @@ public static Map<String, CatalogData> data = new ConcurrentHashMap<>(); @Autowired - private DeferredResultHolder deferredResultHolder; - - @Autowired private IVideoManagerStorage storager; public void addReady(Device device, int sn ) { CatalogData catalogData = data.get(device.getDeviceId()); if (catalogData == null || catalogData.getStatus().equals(CatalogData.CatalogDataStatus.end)) { catalogData = new CatalogData(); - catalogData.setChannelList(new ArrayList<>()); + catalogData.setChannelList(Collections.synchronizedList(new ArrayList<>())); catalogData.setDevice(device); catalogData.setSn(sn); catalogData.setStatus(CatalogData.CatalogDataStatus.ready); @@ -46,7 +43,7 @@ catalogData.setSn(sn); catalogData.setTotal(total); catalogData.setDevice(device); - catalogData.setChannelList(new ArrayList<>()); + catalogData.setChannelList(Collections.synchronizedList(new ArrayList<>())); catalogData.setStatus(CatalogData.CatalogDataStatus.runIng); catalogData.setLastTime(new Date(System.currentTimeMillis())); data.put(deviceId, catalogData); @@ -65,19 +62,25 @@ public List<DeviceChannel> get(String deviceId) { CatalogData catalogData = data.get(deviceId); - if (catalogData == null) return null; + if (catalogData == null) { + return null; + } return catalogData.getChannelList(); } public int getTotal(String deviceId) { CatalogData catalogData = data.get(deviceId); - if (catalogData == null) return 0; + if (catalogData == null) { + return 0; + } return catalogData.getTotal(); } public SyncStatus getSyncStatus(String deviceId) { CatalogData catalogData = data.get(deviceId); - if (catalogData == null) return null; + if (catalogData == null) { + return null; + } SyncStatus syncStatus = new SyncStatus(); syncStatus.setCurrent(catalogData.getChannelList().size()); syncStatus.setTotal(catalogData.getTotal()); @@ -87,7 +90,9 @@ public boolean isSyncRunning(String deviceId) { CatalogData catalogData = data.get(deviceId); - if (catalogData == null) return false; + if (catalogData == null) { + return false; + } return !catalogData.getStatus().equals(CatalogData.CatalogDataStatus.end); } @@ -125,7 +130,9 @@ public void setChannelSyncEnd(String deviceId, String errorMsg) { CatalogData catalogData = data.get(deviceId); - if (catalogData == null)return; + if (catalogData == null) { + return; + } catalogData.setStatus(CatalogData.CatalogDataStatus.end); catalogData.setErrorMsg(errorMsg); } -- Gitblit v1.8.0