Commit 1de344674afd6bb35b51b165bbad76dbe6299b7e

Authored by 648540858
1 parent f1e902af

使用冒号分隔redis的key

src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java
@@ -50,7 +50,7 @@ public class VideoStreamSessionManager { @@ -50,7 +50,7 @@ public class VideoStreamSessionManager {
50 ssrcTransaction.setType(type); 50 ssrcTransaction.setType(type);
51 51
52 redisTemplate.opsForValue().set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() 52 redisTemplate.opsForValue().set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId()
53 - + "_" + deviceId + "_" + channelId + "_" + callId + "_" + stream, ssrcTransaction); 53 + + ":" + deviceId + ":" + channelId + ":" + callId + ":" + stream, ssrcTransaction);
54 } 54 }
55 55
56 public SsrcTransaction getSsrcTransaction(String deviceId, String channelId, String callId, String stream){ 56 public SsrcTransaction getSsrcTransaction(String deviceId, String channelId, String callId, String stream){
@@ -67,7 +67,7 @@ public class VideoStreamSessionManager { @@ -67,7 +67,7 @@ public class VideoStreamSessionManager {
67 if (ObjectUtils.isEmpty(stream)) { 67 if (ObjectUtils.isEmpty(stream)) {
68 stream ="*"; 68 stream ="*";
69 } 69 }
70 - String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId+ "_" + stream; 70 + String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":" + deviceId + ":" + channelId + ":" + callId+ ":" + stream;
71 List<Object> scanResult = RedisUtil.scan(redisTemplate, key); 71 List<Object> scanResult = RedisUtil.scan(redisTemplate, key);
72 if (scanResult.size() == 0) { 72 if (scanResult.size() == 0) {
73 return null; 73 return null;
@@ -80,12 +80,12 @@ public class VideoStreamSessionManager { @@ -80,12 +80,12 @@ public class VideoStreamSessionManager {
80 if (ObjectUtils.isEmpty(callId)) { 80 if (ObjectUtils.isEmpty(callId)) {
81 return null; 81 return null;
82 } 82 }
83 - String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_*_*_" + callId+ "_*"; 83 + String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":*:*:" + callId+ ":*";
84 List<Object> scanResult = RedisUtil.scan(redisTemplate, key); 84 List<Object> scanResult = RedisUtil.scan(redisTemplate, key);
85 if (!scanResult.isEmpty()) { 85 if (!scanResult.isEmpty()) {
86 return (SsrcTransaction)redisTemplate.opsForValue().get(scanResult.get(0)); 86 return (SsrcTransaction)redisTemplate.opsForValue().get(scanResult.get(0));
87 }else { 87 }else {
88 - key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_*_*_play_*"; 88 + key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":*:*:play:*";
89 scanResult = RedisUtil.scan(redisTemplate, key); 89 scanResult = RedisUtil.scan(redisTemplate, key);
90 if (scanResult.isEmpty()) { 90 if (scanResult.isEmpty()) {
91 return null; 91 return null;
@@ -115,7 +115,7 @@ public class VideoStreamSessionManager { @@ -115,7 +115,7 @@ public class VideoStreamSessionManager {
115 if (ObjectUtils.isEmpty(stream)) { 115 if (ObjectUtils.isEmpty(stream)) {
116 stream ="*"; 116 stream ="*";
117 } 117 }
118 - String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId+ "_" + stream; 118 + String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":" + deviceId + ":" + channelId + ":" + callId+ ":" + stream;
119 List<Object> scanResult = RedisUtil.scan(redisTemplate, key); 119 List<Object> scanResult = RedisUtil.scan(redisTemplate, key);
120 if (scanResult.size() == 0) { 120 if (scanResult.size() == 0) {
121 return null; 121 return null;
@@ -149,8 +149,8 @@ public class VideoStreamSessionManager { @@ -149,8 +149,8 @@ public class VideoStreamSessionManager {
149 return; 149 return;
150 } 150 }
151 for (SsrcTransaction ssrcTransaction : ssrcTransactionList) { 151 for (SsrcTransaction ssrcTransaction : ssrcTransactionList) {
152 - redisTemplate.delete(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_"  
153 - + deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_" + ssrcTransaction.getStream()); 152 + redisTemplate.delete(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":"
  153 + + deviceId + ":" + channelId + ":" + ssrcTransaction.getCallId() + ":" + ssrcTransaction.getStream());
154 } 154 }
155 } 155 }
156 156
@@ -159,8 +159,8 @@ public class VideoStreamSessionManager { @@ -159,8 +159,8 @@ public class VideoStreamSessionManager {
159 if (ssrcTransaction == null ) { 159 if (ssrcTransaction == null ) {
160 return; 160 return;
161 } 161 }
162 - redisTemplate.delete(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_"  
163 - + deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_" + ssrcTransaction.getStream()); 162 + redisTemplate.delete(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":"
  163 + + deviceId + ":" + channelId + ":" + ssrcTransaction.getCallId() + ":" + ssrcTransaction.getStream());
164 } 164 }
165 165
166 166