This commit is contained in:
shikong 2023-12-18 22:26:32 +08:00
parent b2d6a5fe4c
commit da98ec41c3
2 changed files with 8 additions and 1 deletions

View File

@ -582,8 +582,13 @@ public class Gb28181DownloadService {
if(time <= 0) {
String callId = request.getCallId().getCallId();
String infoKey = CacheUtil.getKey(MediaSdpHelper.Action.PLAY.getAction(), callId);
VideoInfo parse = JsonUtils.parse(RedisUtil.StringOps.get(infoKey), VideoInfo.class);
Optional.ofNullable(parse).ifPresent((info)->{
if(info.getCallId().equalsIgnoreCase(callId)){
realtimeManager.removePlaying(device.getDeviceCode());
}
});
RedisUtil.KeyOps.delete(infoKey);
realtimeManager.removePlaying(device.getDeviceCode());
}
sender.getProvider(transport,ip)

View File

@ -45,6 +45,7 @@ public class RealtimeManager {
// 定时任务
schedule = scheduledExecutorService.schedule(()->{
log.info("[定时任务] 关闭设备(deviceCode => {}) 视频", deviceCode);
playing.remove(deviceCode);
Gb28181DownloadService.VideoInfo _videoInfo = JsonUtils.parse(RedisUtil.StringOps.get(getRealtimeKey(deviceCode)), Gb28181DownloadService.VideoInfo.class);
RedisUtil.KeyOps.delete(getRealtimeKey(deviceCode));
@ -98,6 +99,7 @@ public class RealtimeManager {
// 判断缓存的 视频信息 缓存的 callId 是否相同 避免 下级点播出现信息不一致
if(videoInfo.getCallId().equalsIgnoreCase(existCallId)){
log.info("关闭视频连接, {} => {}",deviceCode, existCallId);
sender.sendRequest((provider, localIp, localPort) ->
SipRequestBuilder.createByeRequest(deviceIp, devicePort, device.getGbDeviceChannelId(), SipUtil.generateFromTag(), null, existCallId));
}