优化多wvp国标级联推流时缓存的清理
parent
313243195e
commit
e85cef4345
|
@ -54,10 +54,7 @@ import javax.sip.header.CallIdHeader;
|
||||||
import javax.sip.message.Response;
|
import javax.sip.message.Response;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.Vector;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SIP命令类型: INVITE请求
|
* SIP命令类型: INVITE请求
|
||||||
|
@ -589,7 +586,13 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
||||||
sendRtpItem.setOnlyAudio(false);
|
sendRtpItem.setOnlyAudio(false);
|
||||||
sendRtpItem.setStatus(0);
|
sendRtpItem.setStatus(0);
|
||||||
sendRtpItem.setSessionName(sessionName);
|
sendRtpItem.setSessionName(sessionName);
|
||||||
|
// 清理可能存在的缓存避免用到旧的数据
|
||||||
|
List<SendRtpItem> sendRtpItemList = redisCatchStorage.querySendRTPServer(platform.getServerGBId(), channelId, gbStream.getStream());
|
||||||
|
if (!sendRtpItemList.isEmpty()) {
|
||||||
|
for (SendRtpItem rtpItem : sendRtpItemList) {
|
||||||
|
redisCatchStorage.deleteSendRTPServer(rtpItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
if ("push".equals(gbStream.getStreamType())) {
|
if ("push".equals(gbStream.getStreamType())) {
|
||||||
sendRtpItem.setPlayType(InviteStreamType.PUSH);
|
sendRtpItem.setPlayType(InviteStreamType.PUSH);
|
||||||
if (streamPushItem != null) {
|
if (streamPushItem != null) {
|
||||||
|
|
|
@ -40,6 +40,8 @@ public interface IRedisCatchStorage {
|
||||||
|
|
||||||
void updateSendRTPSever(SendRtpItem sendRtpItem);
|
void updateSendRTPSever(SendRtpItem sendRtpItem);
|
||||||
|
|
||||||
|
List<SendRtpItem> querySendRTPServer(String platformGbId, String channelId, String streamId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询RTP推送信息缓存
|
* 查询RTP推送信息缓存
|
||||||
* @param platformGbId
|
* @param platformGbId
|
||||||
|
@ -192,6 +194,8 @@ public interface IRedisCatchStorage {
|
||||||
|
|
||||||
void addDiskInfo(List<Map<String, Object>> diskInfo);
|
void addDiskInfo(List<Map<String, Object>> diskInfo);
|
||||||
|
|
||||||
|
void deleteSendRTPServer(SendRtpItem sendRtpItem);
|
||||||
|
|
||||||
List<SendRtpItem> queryAllSendRTPServer();
|
List<SendRtpItem> queryAllSendRTPServer();
|
||||||
|
|
||||||
List<Device> getAllDevices();
|
List<Device> getAllDevices();
|
||||||
|
|
|
@ -152,6 +152,25 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||||
redisTemplate.opsForValue().set(key, sendRtpItem);
|
redisTemplate.opsForValue().set(key, sendRtpItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SendRtpItem> querySendRTPServer(String platformGbId, String channelId, String streamId) {
|
||||||
|
String scanKey = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX
|
||||||
|
+ userSetting.getServerId() + "_*_"
|
||||||
|
+ platformGbId + "_"
|
||||||
|
+ channelId + "_"
|
||||||
|
+ streamId + "_"
|
||||||
|
+ "*";
|
||||||
|
List<SendRtpItem> result = new ArrayList<>();
|
||||||
|
List<Object> scan = RedisUtil.scan(redisTemplate, scanKey);
|
||||||
|
if (!scan.isEmpty()) {
|
||||||
|
for (Object o : scan) {
|
||||||
|
String key = (String) o;
|
||||||
|
result.add(JsonUtil.redisJsonToObject(redisTemplate, key, SendRtpItem.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SendRtpItem querySendRTPServer(String platformGbId, String channelId, String streamId, String callId) {
|
public SendRtpItem querySendRTPServer(String platformGbId, String channelId, String streamId, String callId) {
|
||||||
if (platformGbId == null) {
|
if (platformGbId == null) {
|
||||||
|
@ -268,6 +287,14 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除RTP推送信息缓存
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void deleteSendRTPServer(SendRtpItem sendRtpItem) {
|
||||||
|
deleteSendRTPServer(sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(),sendRtpItem.getCallId(), sendRtpItem.getServerId());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SendRtpItem> queryAllSendRTPServer() {
|
public List<SendRtpItem> queryAllSendRTPServer() {
|
||||||
String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX
|
String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX
|
||||||
|
|
Loading…
Reference in New Issue