Browse Source

修改bug

pull/1/head
648540858 4 years ago
parent
commit
002782569d
  1. 1
      README.md
  2. 2
      src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/OfflineEventListener.java
  3. 62
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
  4. 2
      src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java
  5. 14
      src/main/java/com/genersoft/iot/vmp/storager/redis/VideoManagerRedisStoragerImpl.java

1
README.md

@ -37,3 +37,4 @@ QQ群: 901799015
# 致谢 # 致谢
感谢作者[夏楚](https://github.com/xiongziliang) 提供这么棒的开源流媒体服务框架 感谢作者[夏楚](https://github.com/xiongziliang) 提供这么棒的开源流媒体服务框架

2
src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/OfflineEventListener.java

@ -54,5 +54,7 @@ public class OfflineEventListener implements ApplicationListener<OfflineEvent> {
// 处理离线监听 // 处理离线监听
storager.outline(event.getDeviceId()); storager.outline(event.getDeviceId());
//
} }
} }

62
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java

@ -181,15 +181,15 @@ public class SIPCommander implements ISIPCommander {
try { try {
String cmdStr= cmdString(leftRight, upDown, inOut, moveSpeed, zoomSpeed); String cmdStr= cmdString(leftRight, upDown, inOut, moveSpeed, zoomSpeed);
StringBuffer ptzXml = new StringBuffer(200); StringBuffer ptzXml = new StringBuffer(200);
ptzXml.append("<?xml version=\"1.0\" ?>"); ptzXml.append("<?xml version=\"1.0\" ?>\r\n");
ptzXml.append("<Control>"); ptzXml.append("<Control>\r\n");
ptzXml.append("<CmdType>DeviceControl</CmdType>"); ptzXml.append("<CmdType>DeviceControl</CmdType>\r\n");
ptzXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>"); ptzXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n");
ptzXml.append("<DeviceID>" + channelId + "</DeviceID>"); ptzXml.append("<DeviceID>" + channelId + "</DeviceID>\r\n");
ptzXml.append("<PTZCmd>" + cmdStr + "</PTZCmd>"); ptzXml.append("<PTZCmd>" + cmdStr + "</PTZCmd>\r\n");
ptzXml.append("<Info>"); ptzXml.append("<Info>\r\n");
ptzXml.append("</Info>"); ptzXml.append("</Info>\r\n");
ptzXml.append("</Control>"); ptzXml.append("</Control>\r\n");
Request request = headerProvider.createMessageRequest(device, ptzXml.toString(), "ViaPtzBranch", "FromPtzTag", "ToPtzTag"); Request request = headerProvider.createMessageRequest(device, ptzXml.toString(), "ViaPtzBranch", "FromPtzTag", "ToPtzTag");
@ -458,12 +458,12 @@ public class SIPCommander implements ISIPCommander {
public boolean deviceInfoQuery(Device device) { public boolean deviceInfoQuery(Device device) {
try { try {
StringBuffer catalogXml = new StringBuffer(200); StringBuffer catalogXml = new StringBuffer(200);
catalogXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>"); catalogXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n");
catalogXml.append("<Query>"); catalogXml.append("<Query>\r\n");
catalogXml.append("<CmdType>DeviceInfo</CmdType>"); catalogXml.append("<CmdType>DeviceInfo</CmdType>\r\n");
catalogXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>"); catalogXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n");
catalogXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>"); catalogXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n");
catalogXml.append("</Query>"); catalogXml.append("</Query>\r\n");
Request request = headerProvider.createMessageRequest(device, catalogXml.toString(), "ViaDeviceInfoBranch", "FromDeviceInfoTag", "ToDeviceInfoTag"); Request request = headerProvider.createMessageRequest(device, catalogXml.toString(), "ViaDeviceInfoBranch", "FromDeviceInfoTag", "ToDeviceInfoTag");
transmitRequest(device, request); transmitRequest(device, request);
@ -486,12 +486,12 @@ public class SIPCommander implements ISIPCommander {
storager.cleanChannelsForDevice(device.getDeviceId()); storager.cleanChannelsForDevice(device.getDeviceId());
try { try {
StringBuffer catalogXml = new StringBuffer(200); StringBuffer catalogXml = new StringBuffer(200);
catalogXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>"); catalogXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n");
catalogXml.append("<Query>"); catalogXml.append("<Query>\r\n");
catalogXml.append("<CmdType>Catalog</CmdType>"); catalogXml.append("<CmdType>Catalog</CmdType>\r\n");
catalogXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>"); catalogXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n");
catalogXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>"); catalogXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n");
catalogXml.append("</Query>"); catalogXml.append("</Query>\r\n");
Request request = headerProvider.createMessageRequest(device, catalogXml.toString(), "ViaCatalogBranch", "FromCatalogTag", "ToCatalogTag"); Request request = headerProvider.createMessageRequest(device, catalogXml.toString(), "ViaCatalogBranch", "FromCatalogTag", "ToCatalogTag");
transmitRequest(device, request); transmitRequest(device, request);
@ -514,17 +514,17 @@ public class SIPCommander implements ISIPCommander {
try { try {
StringBuffer recordInfoXml = new StringBuffer(200); StringBuffer recordInfoXml = new StringBuffer(200);
recordInfoXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>"); recordInfoXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n");
recordInfoXml.append("<Query>"); recordInfoXml.append("<Query>\r\n");
recordInfoXml.append("<CmdType>RecordInfo</CmdType>"); recordInfoXml.append("<CmdType>RecordInfo</CmdType>\r\n");
recordInfoXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>"); recordInfoXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n");
recordInfoXml.append("<DeviceID>" + channelId + "</DeviceID>"); recordInfoXml.append("<DeviceID>" + channelId + "</DeviceID>\r\n");
recordInfoXml.append("<StartTime>" + DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(startTime) + "</StartTime>"); recordInfoXml.append("<StartTime>" + DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(startTime) + "</StartTime>\r\n");
recordInfoXml.append("<EndTime>" + DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(endTime) + "</EndTime>"); recordInfoXml.append("<EndTime>" + DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(endTime) + "</EndTime>\r\n");
recordInfoXml.append("<Secrecy>0</Secrecy>"); recordInfoXml.append("<Secrecy>0</Secrecy>\\r\n");
// 大华NVR要求必须增加一个值为all的文本元素节点Type // 大华NVR要求必须增加一个值为all的文本元素节点Type
recordInfoXml.append("<Type>all</Type>"); recordInfoXml.append("<Type>all</Type>\r\n");
recordInfoXml.append("</Query>"); recordInfoXml.append("</Query>\r\n");
Request request = headerProvider.createMessageRequest(device, recordInfoXml.toString(), "ViaRecordInfoBranch", "FromRecordInfoTag", "ToRecordInfoTag"); Request request = headerProvider.createMessageRequest(device, recordInfoXml.toString(), "ViaRecordInfoBranch", "FromRecordInfoTag", "ToRecordInfoTag");
transmitRequest(device, request); transmitRequest(device, request);

2
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java

@ -99,6 +99,7 @@ public class ZLMRunner implements CommandLineRunner {
param.put("secret",mediaSecret); param.put("secret",mediaSecret);
param.put("hook.enable","1"); param.put("hook.enable","1");
param.put("hook.on_flow_report",""); param.put("hook.on_flow_report","");
param.put("hook.on_play","");
param.put("hook.on_http_access",""); param.put("hook.on_http_access","");
param.put("hook.on_publish",String.format("%s/on_publish", hookPrex)); param.put("hook.on_publish",String.format("%s/on_publish", hookPrex));
param.put("hook.on_record_mp4",""); param.put("hook.on_record_mp4","");
@ -107,6 +108,7 @@ public class ZLMRunner implements CommandLineRunner {
param.put("hook.on_rtsp_realm",""); param.put("hook.on_rtsp_realm","");
param.put("hook.on_server_started",String.format("%s/on_server_started", hookPrex)); param.put("hook.on_server_started",String.format("%s/on_server_started", hookPrex));
param.put("hook.on_shell_login",String.format("%s/on_shell_login", hookPrex)); param.put("hook.on_shell_login",String.format("%s/on_shell_login", hookPrex));
param.put("hook.on_stream_changed",String.format("%s/on_stream_changed", hookPrex));
param.put("hook.on_stream_none_reader",String.format("%s/on_stream_none_reader", hookPrex)); param.put("hook.on_stream_none_reader",String.format("%s/on_stream_none_reader", hookPrex));
param.put("hook.on_stream_not_found",String.format("%s/on_stream_not_found", hookPrex)); param.put("hook.on_stream_not_found",String.format("%s/on_stream_not_found", hookPrex));
param.put("hook.timeoutSec","20"); param.put("hook.timeoutSec","20");

14
src/main/java/com/genersoft/iot/vmp/storager/redis/VideoManagerRedisStoragerImpl.java

@ -93,7 +93,7 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
":" + channel.getName() + ":" + channel.getName() +
"_" + (channel.getStatus() == 1 ? "on":"off") + "_" + (channel.getStatus() == 1 ? "on":"off") +
"_" + (channelMap.get(channelId).size() > 0)+ "_" + (channelMap.get(channelId).size() > 0)+
"_" + channel.getParentId(), "_" + (StringUtils.isEmpty(channel.getParentId())?null:channel.getParentId()),
channel); channel);
// 更新device中的通道数量 // 更新device中的通道数量
Device device = (Device)redis.get(VideoManagerConstants.DEVICE_PREFIX+deviceId); Device device = (Device)redis.get(VideoManagerConstants.DEVICE_PREFIX+deviceId);
@ -113,7 +113,14 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
DeviceChannel deviceChannel = queryChannel(deviceId, parentId); DeviceChannel deviceChannel = queryChannel(deviceId, parentId);
if (deviceChannel != null) { if (deviceChannel != null) {
deviceChannel.setSubCount(channelMap.get(parentId).size()); deviceChannel.setSubCount(channelMap.get(parentId).size());
redis.set(VideoManagerConstants.CACHEKEY_PREFIX+deviceId + "_" + deviceChannel.getChannelId(), // redis.set(VideoManagerConstants.CACHEKEY_PREFIX+deviceId + "_" + deviceChannel.getChannelId(),
// deviceChannel);
redis.set(VideoManagerConstants.CACHEKEY_PREFIX + deviceId +
"_" + deviceChannel.getChannelId() +
":" + deviceChannel.getName() +
"_" + (deviceChannel.getStatus() == 1 ? "on":"off") +
"_" + (channelMap.get(deviceChannel.getChannelId()).size() > 0)+
"_" + (StringUtils.isEmpty(deviceChannel.getParentId())?null:deviceChannel.getParentId()),
deviceChannel); deviceChannel);
} }
@ -438,7 +445,8 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
if (subChannel == null) { if (subChannel == null) {
subChannel = new HashSet<>(); subChannel = new HashSet<>();
} }
if (!"null".equals(s[6])) { System.out.println(key);
if (s.length == 7 && !"null".equals(s[6])) {
subChannel.add(s[6]); subChannel.add(s[6]);
} }
channelMap.put(channelId, subChannel); channelMap.put(channelId, subChannel);

Loading…
Cancel
Save