From 1de344674afd6bb35b51b165bbad76dbe6299b7e Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Thu, 28 Mar 2024 18:08:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8=E5=86=92=E5=8F=B7=E5=88=86?= =?UTF-8?q?=E9=9A=94redis=E7=9A=84key?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../session/VideoStreamSessionManager.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java b/src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java index 24d4ef32..cb2caeca 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java @@ -50,7 +50,7 @@ public class VideoStreamSessionManager { ssrcTransaction.setType(type); redisTemplate.opsForValue().set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() - + "_" + deviceId + "_" + channelId + "_" + callId + "_" + stream, ssrcTransaction); + + ":" + deviceId + ":" + channelId + ":" + callId + ":" + stream, ssrcTransaction); } public SsrcTransaction getSsrcTransaction(String deviceId, String channelId, String callId, String stream){ @@ -67,7 +67,7 @@ public class VideoStreamSessionManager { if (ObjectUtils.isEmpty(stream)) { stream ="*"; } - String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId+ "_" + stream; + String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":" + deviceId + ":" + channelId + ":" + callId+ ":" + stream; List scanResult = RedisUtil.scan(redisTemplate, key); if (scanResult.size() == 0) { return null; @@ -80,12 +80,12 @@ public class VideoStreamSessionManager { if (ObjectUtils.isEmpty(callId)) { return null; } - String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_*_*_" + callId+ "_*"; + String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":*:*:" + callId+ ":*"; List scanResult = RedisUtil.scan(redisTemplate, key); if (!scanResult.isEmpty()) { return (SsrcTransaction)redisTemplate.opsForValue().get(scanResult.get(0)); }else { - key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_*_*_play_*"; + key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":*:*:play:*"; scanResult = RedisUtil.scan(redisTemplate, key); if (scanResult.isEmpty()) { return null; @@ -115,7 +115,7 @@ public class VideoStreamSessionManager { if (ObjectUtils.isEmpty(stream)) { stream ="*"; } - String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId+ "_" + stream; + String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":" + deviceId + ":" + channelId + ":" + callId+ ":" + stream; List scanResult = RedisUtil.scan(redisTemplate, key); if (scanResult.size() == 0) { return null; @@ -149,8 +149,8 @@ public class VideoStreamSessionManager { return; } for (SsrcTransaction ssrcTransaction : ssrcTransactionList) { - redisTemplate.delete(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" - + deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_" + ssrcTransaction.getStream()); + redisTemplate.delete(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":" + + deviceId + ":" + channelId + ":" + ssrcTransaction.getCallId() + ":" + ssrcTransaction.getStream()); } } @@ -159,8 +159,8 @@ public class VideoStreamSessionManager { if (ssrcTransaction == null ) { return; } - redisTemplate.delete(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" - + deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_" + ssrcTransaction.getStream()); + redisTemplate.delete(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":" + + deviceId + ":" + channelId + ":" + ssrcTransaction.getCallId() + ":" + ssrcTransaction.getStream()); }