添加心跳到期时验证zlm是否真的离线。
This commit is contained in:
parent
4418c62e5c
commit
22efd0f56c
@ -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("<?xml version=\"1.0\" ?>\r\n");
|
||||
ptzXml.append("<Control>\r\n");
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user