优化ssrc释放逻辑,优化级联点播速度,去除等待流格式的配置项
This commit is contained in:
@@ -89,7 +89,7 @@ public interface IRedisCatchStorage {
|
||||
* @param channelId
|
||||
* @return sendRtpItem
|
||||
*/
|
||||
SendRtpItem querySendRTPServer(String platformGbId, String channelId);
|
||||
SendRtpItem querySendRTPServer(String platformGbId, String channelId, String streamId, String callId);
|
||||
|
||||
List<SendRtpItem> querySendRTPServer(String platformGbId);
|
||||
|
||||
@@ -98,7 +98,7 @@ public interface IRedisCatchStorage {
|
||||
* @param platformGbId
|
||||
* @param channelId
|
||||
*/
|
||||
void deleteSendRTPServer(String platformGbId, String channelId);
|
||||
void deleteSendRTPServer(String platformGbId, String channelId, String callId, String streamId);
|
||||
|
||||
/**
|
||||
* 查询某个通道是否存在上级点播(RTP推送)
|
||||
|
||||
@@ -135,6 +135,32 @@ public interface DeviceChannelMapper {
|
||||
"'${item.ipAddress}', ${item.port}, '${item.password}', ${item.PTZType}, ${item.status}, " +
|
||||
"'${item.streamId}', ${item.longitude}, ${item.latitude},'${item.createTime}', '${item.updateTime}')" +
|
||||
"</foreach> " +
|
||||
"ON DUPLICATE KEY UPDATE " +
|
||||
"updateTime=VALUES(updateTime), " +
|
||||
"name=VALUES(name), " +
|
||||
"manufacture=VALUES(manufacture), " +
|
||||
"model=VALUES(model), " +
|
||||
"owner=VALUES(owner), " +
|
||||
"civilCode=VALUES(civilCode), " +
|
||||
"block=VALUES(block), " +
|
||||
"subCount=VALUES(subCount), " +
|
||||
"address=VALUES(address), " +
|
||||
"parental=VALUES(parental), " +
|
||||
"parentId=VALUES(parentId), " +
|
||||
"safetyWay=VALUES(safetyWay), " +
|
||||
"registerWay=VALUES(registerWay), " +
|
||||
"certNum=VALUES(certNum), " +
|
||||
"certifiable=VALUES(certifiable), " +
|
||||
"errCode=VALUES(errCode), " +
|
||||
"secrecy=VALUES(secrecy), " +
|
||||
"ipAddress=VALUES(ipAddress), " +
|
||||
"port=VALUES(port), " +
|
||||
"password=VALUES(password), " +
|
||||
"PTZType=VALUES(PTZType), " +
|
||||
"status=VALUES(status), " +
|
||||
"streamId=VALUES(streamId), " +
|
||||
"longitude=VALUES(longitude), " +
|
||||
"latitude=VALUES(latitude)" +
|
||||
"</script>")
|
||||
int batchAdd(List<DeviceChannel> addChannels);
|
||||
|
||||
@@ -211,4 +237,15 @@ public interface DeviceChannelMapper {
|
||||
" from device_channel\n" +
|
||||
" where deviceId = #{deviceId}")
|
||||
List<DeviceChannelTree> tree(String deviceId);
|
||||
|
||||
@Delete(value = {" <script>" +
|
||||
"DELETE " +
|
||||
"from " +
|
||||
"device_channel " +
|
||||
"WHERE " +
|
||||
"deviceId = #{deviceId} " +
|
||||
" AND channelId NOT IN " +
|
||||
"<foreach collection='channels' item='item' open='(' separator=',' close=')' > #{item.channelId}</foreach>" +
|
||||
" </script>"})
|
||||
int cleanChannelsNotInList(String deviceId, List<DeviceChannel> channels);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.genersoft.iot.vmp.utils.redis.RedisUtil;
|
||||
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;
|
||||
|
||||
@@ -276,19 +277,32 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
|
||||
@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<>();
|
||||
|
||||
@@ -306,18 +320,28 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
* @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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询某个通道是否存在上级点播(RTP推送)
|
||||
* @param channelId
|
||||
*/
|
||||
@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;
|
||||
|
||||
@@ -284,7 +284,8 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
|
||||
logger.debug("[目录查询]收到的数据存在重复: {}" , stringBuilder);
|
||||
}
|
||||
try {
|
||||
int cleanChannelsResult = deviceChannelMapper.cleanChannelsByDeviceId(deviceId);
|
||||
// int cleanChannelsResult = deviceChannelMapper.cleanChannelsByDeviceId(deviceId);
|
||||
int cleanChannelsResult = deviceChannelMapper.cleanChannelsNotInList(deviceId, channels);
|
||||
int limitCount = 300;
|
||||
boolean result = cleanChannelsResult < 0;
|
||||
if (!result && channels.size() > 0) {
|
||||
|
||||
Reference in New Issue
Block a user