From 22efd0f56c20e1aedb18fa7b9bcdc48007fcc954 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期一, 20 十二月 2021 09:51:51 +0800 Subject: [PATCH] 添加心跳到期时验证zlm是否真的离线。 --- src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java | 2 +- src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java | 1 + src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMKeepliveTimeoutListener.java | 17 ++++++++++++++++- 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 dc0996a..59e2192 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 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("<?xml version=\"1.0\" ?>\r\n"); ptzXml.append("<Control>\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 c2ae319..71b07f8 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; @@ -25,7 +29,13 @@ private EventPublisher publisher; @Autowired + private ZLMRESTfulUtils zlmresTfulUtils; + + @Autowired private UserSetup userSetup; + + @Autowired + private IMediaServerService mediaServerService; public ZLMKeepliveTimeoutListener(RedisMessageListenerContainer listenerContainer) { super(listenerContainer); @@ -48,7 +58,12 @@ } 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 dab637f..cf30a79 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 @@ MediaServerItem mediaInfo = mediaServerService.getOne(streamInfoForSuccess.getMediaServerId()); String streamUrl = streamInfoForSuccess.getFmp4(); // 璇锋眰鎴浘 + logger.info("[璇锋眰鎴浘]: " + fileName); zlmresTfulUtils.getSnap(mediaInfo, streamUrl, 15, 1, path, fileName); } } -- Gitblit v1.8.0