修复国标点播缓存启动未清理的BUG

This commit is contained in:
648540858
2024-10-25 17:41:50 +08:00
parent ef66bd8781
commit 059635c2cc
29 changed files with 256 additions and 350 deletions

View File

@@ -30,13 +30,13 @@ public interface IPlayService {
MediaServer getNewMediaServerItem(Device device);
void playBack(Device device, DeviceChannel channel, String startTime, String endTime, ErrorCallback<StreamInfo> callback);
void zlmServerOffline(String mediaServerId);
void zlmServerOffline(MediaServer mediaServer);
void download(Device device, DeviceChannel channel, String startTime, String endTime, int downloadSpeed, ErrorCallback<StreamInfo> callback);
StreamInfo getDownLoadInfo(Device device, DeviceChannel channel, String stream);
void zlmServerOnline(String mediaServerId);
void zlmServerOnline(MediaServer mediaServer);
AudioBroadcastResult audioBroadcast(Device device, DeviceChannel deviceChannel, Boolean broadcastMode);

View File

@@ -210,9 +210,6 @@ public class InviteStreamServiceImpl implements IInviteStreamService {
":" + inviteInfo.getSsrcInfo().getSsrc();
redisTemplate.opsForHash().delete(key, objectKey);
}
if (redisTemplate.opsForHash().size(key) == 0) {
redisTemplate.opsForHash().delete(key);
}
}
@Override

View File

@@ -246,32 +246,6 @@ public class PlatformServiceImpl implements IPlatformService {
return false;
}
private void unregister(Platform platform) {
// 停止心跳定时
final String keepaliveTaskKey = KEEPALIVE_KEY_PREFIX + platform.getServerGBId();
dynamicTask.stop(keepaliveTaskKey);
// 停止注册定时
final String registerTaskKey = REGISTER_KEY_PREFIX + platform.getServerGBId();
dynamicTask.stop(registerTaskKey);
PlatformCatch platformCatchOld = redisCatchStorage.queryPlatformCatchInfo(platform.getServerGBId());
// 注销旧的
try {
if (platform.isStatus()) {
commanderForPlatform.unregister(platform, platformCatchOld.getSipTransactionInfo(), null, eventResult -> {
log.info("[国标级联] 注销命令发送成功,平台:{}", platform.getServerGBId());
});
}
} catch (InvalidArgumentException | ParseException | SipException e) {
log.error("[命令发送失败] 国标级联 注销: {}", e.getMessage());
}
}
private void register(Platform platform) {
}
@Override
public void online(Platform platform, SipTransactionInfo sipTransactionInfo) {
log.info("[国标级联]{}, 平台上线", platform.getServerGBId());

View File

@@ -1157,12 +1157,12 @@ public class PlayServiceImpl implements IPlayService {
@Override
public void zlmServerOffline(String mediaServerId) {
public void zlmServerOffline(MediaServer mediaServer) {
// 处理正在向上推流的上级平台
List<SendRtpInfo> sendRtpInfos = sendRtpServerService.queryAll();
if (!sendRtpInfos.isEmpty()) {
for (SendRtpInfo sendRtpInfo : sendRtpInfos) {
if (sendRtpInfo.getMediaServerId().equals(mediaServerId) && sendRtpInfo.isSendToPlatform()) {
if (sendRtpInfo.getMediaServerId().equals(mediaServer.getId()) && sendRtpInfo.isSendToPlatform()) {
Platform platform = platformService.queryPlatformByServerGBId(sendRtpInfo.getTargetId());
CommonGBChannel channel = channelService.getOne(sendRtpInfo.getChannelId());
try {
@@ -1177,7 +1177,7 @@ public class PlayServiceImpl implements IPlayService {
List<SsrcTransaction> allSsrc = sessionManager.getAll();
if (allSsrc.size() > 0) {
for (SsrcTransaction ssrcTransaction : allSsrc) {
if (ssrcTransaction.getMediaServerId().equals(mediaServerId)) {
if (ssrcTransaction.getMediaServerId().equals(mediaServer.getId())) {
Device device = deviceService.getDeviceByDeviceId(ssrcTransaction.getDeviceId());
if (device == null) {
continue;
@@ -1314,7 +1314,22 @@ public class PlayServiceImpl implements IPlayService {
}
@Override
public void zlmServerOnline(String mediaServerId) {
public void zlmServerOnline(MediaServer mediaServer) {
// 获取
List<InviteInfo> inviteInfoList = inviteStreamService.getAllInviteInfo();
if (inviteInfoList.isEmpty()) {
return;
}
List<String> rtpServerList = mediaServerService.listRtpServer(mediaServer);
if (rtpServerList.isEmpty()) {
return;
}
for (InviteInfo inviteInfo : inviteInfoList) {
if (!rtpServerList.contains(inviteInfo.getStream())){
inviteStreamService.removeInviteInfo(inviteInfo);
}
}
}
@Override
@@ -1568,7 +1583,10 @@ public class PlayServiceImpl implements IPlayService {
public void stop(InviteSessionType type, Device device, DeviceChannel channel, String stream) {
InviteInfo inviteInfo = inviteStreamService.getInviteInfo(type, channel.getId(), stream);
if (inviteInfo == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "点播未找到");
if (type == InviteSessionType.PLAY) {
deviceChannelService.stopPlay(channel.getId());
}
return;
}
inviteStreamService.removeInviteInfo(inviteInfo);
if (InviteSessionStatus.ok == inviteInfo.getStatus()) {