修复国标点播缓存启动未清理的BUG
This commit is contained in:
@@ -151,9 +151,6 @@ public interface DeviceChannelMapper {
|
||||
" </script>"})
|
||||
List<DeviceChannelExtend> queryChannelsWithDeviceInfo(@Param("deviceId") String deviceId, @Param("parentChannelId") String parentChannelId, @Param("query") String query, @Param("hasSubChannel") Boolean hasSubChannel, @Param("online") Boolean online, @Param("channelIds") List<String> channelIds);
|
||||
|
||||
@Update(value = {"UPDATE wvp_device_channel SET stream_id=null WHERE device_db_id=#{deviceId} AND device_id=#{channelId}"})
|
||||
void stopPlay(@Param("deviceId") int deviceId, @Param("channelId") String channelId);
|
||||
|
||||
@Update(value = {"UPDATE wvp_device_channel SET stream_id=#{streamId} WHERE id=#{channelId}"})
|
||||
void startPlay(@Param("channelId") Integer channelId, @Param("streamId") String streamId);
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.genersoft.iot.vmp.gb28181.event.device.RequestTimeoutEvent;
|
||||
import com.genersoft.iot.vmp.gb28181.event.record.RecordEndEvent;
|
||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.mobilePosition.MobilePositionEvent;
|
||||
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||
import com.genersoft.iot.vmp.media.event.mediaServer.MediaServerOfflineEvent;
|
||||
import com.genersoft.iot.vmp.media.event.mediaServer.MediaServerOnlineEvent;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -39,15 +40,15 @@ public class EventPublisher {
|
||||
applicationEventPublisher.publishEvent(alarmEvent);
|
||||
}
|
||||
|
||||
public void mediaServerOfflineEventPublish(String mediaServerId){
|
||||
public void mediaServerOfflineEventPublish(MediaServer mediaServer){
|
||||
MediaServerOfflineEvent outEvent = new MediaServerOfflineEvent(this);
|
||||
outEvent.setMediaServerId(mediaServerId);
|
||||
outEvent.setMediaServer(mediaServer);
|
||||
applicationEventPublisher.publishEvent(outEvent);
|
||||
}
|
||||
|
||||
public void mediaServerOnlineEventPublish(String mediaServerId) {
|
||||
public void mediaServerOnlineEventPublish(MediaServer mediaServer) {
|
||||
MediaServerOnlineEvent outEvent = new MediaServerOnlineEvent(this);
|
||||
outEvent.setMediaServerId(mediaServerId);
|
||||
outEvent.setMediaServer(mediaServer);
|
||||
applicationEventPublisher.publishEvent(outEvent);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user