Commit 1de344674afd6bb35b51b165bbad76dbe6299b7e
1 parent
f1e902af
使用冒号分隔redis的key
Showing
1 changed file
with
9 additions
and
9 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java
| ... | ... | @@ -50,7 +50,7 @@ public class VideoStreamSessionManager { |
| 50 | 50 | ssrcTransaction.setType(type); |
| 51 | 51 | |
| 52 | 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 | 56 | public SsrcTransaction getSsrcTransaction(String deviceId, String channelId, String callId, String stream){ |
| ... | ... | @@ -67,7 +67,7 @@ public class VideoStreamSessionManager { |
| 67 | 67 | if (ObjectUtils.isEmpty(stream)) { |
| 68 | 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 | 71 | List<Object> scanResult = RedisUtil.scan(redisTemplate, key); |
| 72 | 72 | if (scanResult.size() == 0) { |
| 73 | 73 | return null; |
| ... | ... | @@ -80,12 +80,12 @@ public class VideoStreamSessionManager { |
| 80 | 80 | if (ObjectUtils.isEmpty(callId)) { |
| 81 | 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 | 84 | List<Object> scanResult = RedisUtil.scan(redisTemplate, key); |
| 85 | 85 | if (!scanResult.isEmpty()) { |
| 86 | 86 | return (SsrcTransaction)redisTemplate.opsForValue().get(scanResult.get(0)); |
| 87 | 87 | }else { |
| 88 | - key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_*_*_play_*"; | |
| 88 | + key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":*:*:play:*"; | |
| 89 | 89 | scanResult = RedisUtil.scan(redisTemplate, key); |
| 90 | 90 | if (scanResult.isEmpty()) { |
| 91 | 91 | return null; |
| ... | ... | @@ -115,7 +115,7 @@ public class VideoStreamSessionManager { |
| 115 | 115 | if (ObjectUtils.isEmpty(stream)) { |
| 116 | 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 | 119 | List<Object> scanResult = RedisUtil.scan(redisTemplate, key); |
| 120 | 120 | if (scanResult.size() == 0) { |
| 121 | 121 | return null; |
| ... | ... | @@ -149,8 +149,8 @@ public class VideoStreamSessionManager { |
| 149 | 149 | return; |
| 150 | 150 | } |
| 151 | 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 | 159 | if (ssrcTransaction == null ) { |
| 160 | 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 | ... | ... |