| | |
| | | logger.info("[添加目录订阅] 设备{}", device.getDeviceId()); |
| | | // 添加目录订阅 |
| | | CatalogSubscribeTask catalogSubscribeTask = new CatalogSubscribeTask(device, sipCommander, dynamicTask); |
| | | // 提前开始刷新订阅 |
| | | // 刷新订阅 |
| | | int subscribeCycleForCatalog = Math.max(device.getSubscribeCycleForCatalog(),30); |
| | | // 设置最小值为30 |
| | | dynamicTask.startCron(device.getDeviceId() + "catalog", catalogSubscribeTask, (subscribeCycleForCatalog -1) * 1000); |
| | |
| | | MobilePositionSubscribeTask mobilePositionSubscribeTask = new MobilePositionSubscribeTask(device, sipCommander, dynamicTask); |
| | | // 设置最小值为30 |
| | | int subscribeCycleForCatalog = Math.max(device.getSubscribeCycleForMobilePosition(),30); |
| | | // 提前开始刷新订阅 |
| | | dynamicTask.startCron(device.getDeviceId() + "mobile_position" , mobilePositionSubscribeTask, (subscribeCycleForCatalog -1 ) * 1000); |
| | | // 刷新订阅 |
| | | dynamicTask.startCron(device.getDeviceId() + "mobile_position" , mobilePositionSubscribeTask, (subscribeCycleForCatalog) * 1000); |
| | | return true; |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public void onMessage(Message message, byte[] bytes) { |
| | | // TODO 增加队列 |
| | | logger.warn("[REDIS 消息-推流设备状态变化]: {}", new String(message.getBody())); |
| | | // |
| | | PushStreamStatusChangeFromRedisDto statusChangeFromPushStream = JSON.parseObject(message.getBody(), PushStreamStatusChangeFromRedisDto.class); |
| | | if (statusChangeFromPushStream == null) { |
| | | logger.warn("[REDIS 消息]推流设备状态变化消息解析失败"); |
| | | return; |
| | | } |
| | | // 取消定时任务 |
| | | dynamicTask.stop(VideoManagerConstants.VM_MSG_GET_ALL_ONLINE_REQUESTED); |
| | | if (statusChangeFromPushStream.isSetAllOffline()) { |
| | | // 所有设备离线 |
| | | streamPushService.allStreamOffline(); |