From 4abbf4df07f02c0c94baa2787fdcf4a14dcb3463 Mon Sep 17 00:00:00 2001
From: sc.dm <822878110@qq.com>
Date: 星期四, 10 三月 2022 17:42:02 +0800
Subject: [PATCH] Merge branch '648540858:wvp-28181-2.0' into wvp-28181-2.0
---
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java | 60 +++++++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 43 insertions(+), 17 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
index 1baefbe..0641348 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
@@ -10,6 +10,7 @@
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
+import com.genersoft.iot.vmp.service.bean.SSRCInfo;
import com.genersoft.iot.vmp.service.bean.ThirdPartyGB;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
@@ -17,6 +18,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
@@ -91,7 +93,8 @@
*/
@Override
public boolean startPlay(StreamInfo stream) {
- return redis.set(String.format("%S_%S_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, userSetup.getServerId(), stream.getStreamId(),stream.getDeviceID(), stream.getChannelId()),
+ return redis.set(String.format("%S_%S_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, userSetup.getServerId(),
+ stream.getStream(), stream.getDeviceID(), stream.getChannelId()),
stream);
}
@@ -105,7 +108,7 @@
if (streamInfo == null) return false;
return redis.del(String.format("%S_%s_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX,
userSetup.getServerId(),
- streamInfo.getStreamId(),
+ streamInfo.getStream(),
streamInfo.getDeviceID(),
streamInfo.getChannelId()));
}
@@ -119,7 +122,7 @@
return (StreamInfo)redis.get(String.format("%S_%s_%s_%s_%s",
VideoManagerConstants.PLAYER_PREFIX,
userSetup.getServerId(),
- streamInfo.getStreamId(),
+ streamInfo.getStream(),
streamInfo.getDeviceID(),
streamInfo.getChannelId()));
}
@@ -164,14 +167,14 @@
@Override
public boolean startPlayback(StreamInfo stream) {
- return redis.set(String.format("%S_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, userSetup.getServerId(),stream.getStreamId(),
- stream.getDeviceID(), stream.getChannelId()), stream);
+ return redis.set(String.format("%S_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX,
+ userSetup.getServerId(), stream.getStream(), stream.getDeviceID(), stream.getChannelId()), stream);
}
@Override
public boolean startDownload(StreamInfo streamInfo) {
- return redis.set(String.format("%S_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, userSetup.getServerId(),streamInfo.getStreamId(),
- streamInfo.getDeviceID(), streamInfo.getChannelId()), streamInfo);
+ return redis.set(String.format("%S_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, userSetup.getServerId(),
+ streamInfo.getStream(), streamInfo.getDeviceID(), streamInfo.getChannelId()), streamInfo);
}
@Override
@@ -185,7 +188,7 @@
}
return redis.del(String.format("%S_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX,
userSetup.getServerId(),
- streamInfo.getStreamId(),
+ streamInfo.getStream(),
streamInfo.getDeviceID(),
streamInfo.getChannelId()));
}
@@ -274,19 +277,32 @@
@Override
public void updateSendRTPSever(SendRtpItem sendRtpItem) {
- String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetup.getServerId() + "_" + sendRtpItem.getPlatformId() + "_" + sendRtpItem.getChannelId();
+ String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetup.getServerId() + "_"
+ + sendRtpItem.getPlatformId() + "_" + sendRtpItem.getChannelId() + "_"
+ + sendRtpItem.getStreamId() + "_" + sendRtpItem.getCallId();
redis.set(key, sendRtpItem);
}
@Override
- public SendRtpItem querySendRTPServer(String platformGbId, String channelId) {
- String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetup.getServerId() + "_" + platformGbId + "_" + channelId;
- return (SendRtpItem)redis.get(key);
+ public SendRtpItem querySendRTPServer(String platformGbId, String channelId, String streamId, String callId) {
+ if (platformGbId == null) platformGbId = "*";
+ if (channelId == null) channelId = "*";
+ if (streamId == null) streamId = "*";
+ if (callId == null) callId = "*";
+ String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetup.getServerId() + "_" + platformGbId
+ + "_" + channelId + "_" + streamId + "_" + callId;
+ List<Object> scan = redis.scan(key);
+ if (scan.size() > 0) {
+ return (SendRtpItem)redis.get((String)scan.get(0));
+ }else {
+ return null;
+ }
}
@Override
public List<SendRtpItem> querySendRTPServer(String platformGbId) {
- String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetup.getServerId() + "_" + platformGbId + "_*";
+ if (platformGbId == null) platformGbId = "*";
+ String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetup.getServerId() + "_" + platformGbId + "_*" + "_*" + "_*";
List<Object> queryResult = redis.scan(key);
List<SendRtpItem> result= new ArrayList<>();
@@ -304,10 +320,20 @@
* @param channelId
*/
@Override
- public void deleteSendRTPServer(String platformGbId, String channelId) {
- String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetup.getServerId() + "_" + platformGbId + "_" + channelId;
- redis.del(key);
+ public void deleteSendRTPServer(String platformGbId, String channelId, String callId, String streamId) {
+ if (streamId == null) streamId = "*";
+ if (callId == null) callId = "*";
+ String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetup.getServerId() + "_" + platformGbId
+ + "_" + channelId + "_" + streamId + "_" + callId;
+ List<Object> scan = redis.scan(key);
+ if (scan.size() > 0) {
+ for (Object keyStr : scan) {
+ redis.del((String)keyStr);
+ }
+ }
}
+
+
/**
* 鏌ヨ鏌愪釜閫氶亾鏄惁瀛樺湪涓婄骇鐐规挱锛圧TP鎺ㄩ�侊級
@@ -315,7 +341,7 @@
*/
@Override
public boolean isChannelSendingRTP(String channelId) {
- String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetup.getServerId() + "_" + "*_" + channelId;
+ String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetup.getServerId() + "_" + "*_" + channelId + "*_" + "*_";
List<Object> RtpStreams = redis.scan(key);
if (RtpStreams.size() > 0) {
return true;
--
Gitblit v1.8.0