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/session/SSRCFactory.java | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/session/SSRCFactory.java b/src/main/java/com/genersoft/iot/vmp/gb28181/session/SSRCFactory.java index 657bb2f..2422b8a 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/session/SSRCFactory.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/session/SSRCFactory.java @@ -8,6 +8,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Objects; import java.util.Set; /** @@ -37,7 +38,8 @@ public void initMediaServerSSRC(String mediaServerId, Set<String> usedSet) { - String ssrcPrefix = sipConfig.getDomain().substring(3, 8); + String sipDomain = sipConfig.getDomain(); + String ssrcPrefix = sipDomain.length() >= 8 ? sipDomain.substring(3, 8) : sipDomain; String redisKey = SSRC_INFO_KEY + userSetting.getServerId() + "_" + mediaServerId; List<String> ssrcList = new ArrayList<>(); for (int i = 1; i < MAX_STREAM_COUNT; i++) { @@ -118,7 +120,7 @@ */ public boolean hasMediaServerSSRC(String mediaServerId) { String redisKey = SSRC_INFO_KEY + userSetting.getServerId() + "_" + mediaServerId; - return redisTemplate.opsForSet().members(redisKey) != null; + return Boolean.TRUE.equals(redisTemplate.hasKey(redisKey)); } } -- Gitblit v1.8.0