From 7732a1d180f04ea8e3cd569a73a9288bca5626e9 Mon Sep 17 00:00:00 2001 From: wendy512 <wendy512@yeah.net> Date: 星期四, 18 七月 2024 13:40:47 +0800 Subject: [PATCH] 解决国标视频回放判断streamMode时空指针异常问题 --- src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java b/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java index 0b672d3..d52fbc5 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java @@ -39,10 +39,10 @@ private final Map<String, SipProviderImpl> tcpSipProviderMap = new ConcurrentHashMap<>(); private final Map<String, SipProviderImpl> udpSipProviderMap = new ConcurrentHashMap<>(); + private final List<String> monitorIps = new ArrayList<>(); @Override public void run(String... args) { - List<String> monitorIps = new ArrayList<>(); if (ObjectUtils.isEmpty(sipConfig.getIp())) { try { // 鑾峰緱鏈満鐨勬墍鏈夌綉缁滄帴鍙� @@ -139,11 +139,11 @@ } public SipProviderImpl getUdpSipProvider(String ip) { - if (ObjectUtils.isEmpty(ip)) { - return null; - } if (udpSipProviderMap.size() == 1) { return udpSipProviderMap.values().stream().findFirst().get(); + } + if (ObjectUtils.isEmpty(ip)) { + return null; } return udpSipProviderMap.get(ip); } @@ -163,16 +163,19 @@ } public SipProviderImpl getTcpSipProvider(String ip) { - if (ObjectUtils.isEmpty(ip)) { - return null; - } if (tcpSipProviderMap.size() == 1) { return tcpSipProviderMap.values().stream().findFirst().get(); + } + if (ObjectUtils.isEmpty(ip)) { + return null; } return tcpSipProviderMap.get(ip); } public String getLocalIp(String deviceLocalIp) { + if (monitorIps.size() == 1) { + return monitorIps.get(0); + } if (!ObjectUtils.isEmpty(deviceLocalIp)) { return deviceLocalIp; } -- Gitblit v1.8.0