From 22efd0f56c20e1aedb18fa7b9bcdc48007fcc954 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Mon, 20 Dec 2021 09:51:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BF=83=E8=B7=B3=E5=88=B0?= =?UTF-8?q?=E6=9C=9F=E6=97=B6=E9=AA=8C=E8=AF=81zlm=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E7=9C=9F=E7=9A=84=E7=A6=BB=E7=BA=BF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gb28181/transmit/cmd/impl/SIPCommander.java | 2 +- .../zlm/event/ZLMKeepliveTimeoutListener.java | 17 ++++++++++++++++- .../iot/vmp/service/impl/PlayServiceImpl.java | 1 + 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java index dc0996a7..59e21925 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java @@ -262,7 +262,7 @@ public class SIPCommander implements ISIPCommander { public boolean frontEndCmd(Device device, String channelId, int cmdCode, int parameter1, int parameter2, int combineCode2) { try { String cmdStr= frontEndCmdString(cmdCode, parameter1, parameter2, combineCode2); - logger.info("控制字符串:" + cmdStr); + logger.debug("控制字符串:" + cmdStr); StringBuffer ptzXml = new StringBuffer(200); ptzXml.append("\r\n"); ptzXml.append("\r\n"); diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMKeepliveTimeoutListener.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMKeepliveTimeoutListener.java index c2ae319f..71b07f83 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMKeepliveTimeoutListener.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMKeepliveTimeoutListener.java @@ -1,8 +1,12 @@ package com.genersoft.iot.vmp.media.zlm.event; +import com.alibaba.fastjson.JSONObject; import com.genersoft.iot.vmp.common.VideoManagerConstants; import com.genersoft.iot.vmp.conf.UserSetup; import com.genersoft.iot.vmp.gb28181.event.EventPublisher; +import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; +import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; +import com.genersoft.iot.vmp.service.IMediaServerService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -24,9 +28,15 @@ public class ZLMKeepliveTimeoutListener extends KeyExpirationEventMessageListene @Autowired private EventPublisher publisher; + @Autowired + private ZLMRESTfulUtils zlmresTfulUtils; + @Autowired private UserSetup userSetup; + @Autowired + private IMediaServerService mediaServerService; + public ZLMKeepliveTimeoutListener(RedisMessageListenerContainer listenerContainer) { super(listenerContainer); // 配置springboot默认Config为空,即不让应用去修改redis的默认配置,因为Redis服务出于安全会禁用CONFIG命令给远程用户使用 @@ -48,7 +58,12 @@ public class ZLMKeepliveTimeoutListener extends KeyExpirationEventMessageListene } String mediaServerId = expiredKey.substring(KEEPLIVEKEY_PREFIX.length(),expiredKey.length()); + // 发起http请求验证zlm是否确实无法连接,如果确实无法连接则发送离线事件,否则不作处理 + MediaServerItem mediaServerItem = mediaServerService.getOne(mediaServerId); + JSONObject mediaServerConfig = zlmresTfulUtils.getMediaServerConfig(mediaServerItem); + if (mediaServerConfig == null) { + publisher.zlmOfflineEventPublish(mediaServerId); + } - publisher.zlmOfflineEventPublish(mediaServerId); } } diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java index dab637f7..cf30a794 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java @@ -145,6 +145,7 @@ public class PlayServiceImpl implements IPlayService { MediaServerItem mediaInfo = mediaServerService.getOne(streamInfoForSuccess.getMediaServerId()); String streamUrl = streamInfoForSuccess.getFmp4(); // 请求截图 + logger.info("[请求截图]: " + fileName); zlmresTfulUtils.getSnap(mediaInfo, streamUrl, 15, 1, path, fileName); } }