Browse Source

去除所有的system.print, 优化日志显示

pull/93/head
panlinlin 4 years ago
parent
commit
f7a2d2a92d
  1. 11
      src/main/java/com/genersoft/iot/vmp/conf/MediaServerConfig.java
  2. 26
      src/main/java/com/genersoft/iot/vmp/gb28181/auth/DigestServerAuthenticationHelper.java
  3. 10
      src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/KeepaliveTimeoutListenerForPlatform.java
  4. 6
      src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/KeepliveTimeoutListener.java
  5. 2
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
  6. 17
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/AckRequestProcessor.java
  7. 8
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/ByeRequestProcessor.java
  8. 22
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java
  9. 6
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/OtherRequestProcessor.java
  10. 8
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/SubscribeRequestProcessor.java
  11. 6
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/response/impl/InviteResponseProcessor.java
  12. 15
      src/main/java/com/genersoft/iot/vmp/gb28181/utils/NumericUtil.java
  13. 2
      src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
  14. 1
      src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java
  15. 4
      src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java
  16. 4
      src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java
  17. 4
      src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java
  18. 12
      src/main/java/com/genersoft/iot/vmp/onvif/impl/ONVIFServerIMpl.java
  19. 11
      src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
  20. 11
      src/main/java/com/genersoft/iot/vmp/utils/GpsUtil.java
  21. 4
      src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java

11
src/main/java/com/genersoft/iot/vmp/conf/MediaServerConfig.java

@ -22,6 +22,9 @@ public class MediaServerConfig {
@JSONField(name = "general.enableVhost")
private String generalEnableVhost;
@JSONField(name = "general.mediaServerId")
private String generalMediaServerId;
@JSONField(name = "general.flowThreshold")
private String generalFlowThreshold;
@ -738,4 +741,12 @@ public class MediaServerConfig {
public void setUpdateTime(long updateTime) {
this.updateTime = updateTime;
}
public String getGeneralMediaServerId() {
return generalMediaServerId;
}
public void setGeneralMediaServerId(String generalMediaServerId) {
this.generalMediaServerId = generalMediaServerId;
}
}

26
src/main/java/com/genersoft/iot/vmp/gb28181/auth/DigestServerAuthenticationHelper.java

@ -39,6 +39,8 @@ import javax.sip.message.Request;
import javax.sip.message.Response;
import gov.nist.core.InternalErrorHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Implements the HTTP digest authentication method server side functionality.
@ -49,6 +51,8 @@ import gov.nist.core.InternalErrorHandler;
public class DigestServerAuthenticationHelper {
private Logger logger = LoggerFactory.getLogger(DigestServerAuthenticationHelper.class);
private MessageDigest messageDigest;
public static final String DEFAULT_ALGORITHM = "MD5";
@ -204,18 +208,18 @@ public class DigestServerAuthenticationHelper {
String A2 = request.getMethod().toUpperCase() + ":" + uri.toString();
byte mdbytes[] = messageDigest.digest(A1.getBytes());
String HA1 = toHexString(mdbytes);
System.out.println("A1: " + A1);
System.out.println("A2: " + A2);
logger.debug("A1: " + A1);
logger.debug("A2: " + A2);
mdbytes = messageDigest.digest(A2.getBytes());
String HA2 = toHexString(mdbytes);
System.out.println("HA1: " + HA1);
System.out.println("HA2: " + HA2);
logger.debug("HA1: " + HA1);
logger.debug("HA2: " + HA2);
String cnonce = authHeader.getCNonce();
System.out.println("nonce: " + nonce);
System.out.println("nc: " + ncStr);
System.out.println("cnonce: " + cnonce);
System.out.println("qop: " + qop);
logger.debug("nonce: " + nonce);
logger.debug("nc: " + ncStr);
logger.debug("cnonce: " + cnonce);
logger.debug("qop: " + qop);
String KD = HA1 + ":" + nonce;
if (qop != null && qop.equals("auth") ) {
@ -228,12 +232,12 @@ public class DigestServerAuthenticationHelper {
KD += ":" + qop;
}
KD += ":" + HA2;
System.out.println("KD: " + KD);
logger.debug("KD: " + KD);
mdbytes = messageDigest.digest(KD.getBytes());
String mdString = toHexString(mdbytes);
System.out.println("mdString: " + mdString);
logger.debug("mdString: " + mdString);
String response = authHeader.getResponse();
System.out.println("response: " + response);
logger.debug("response: " + response);
return mdString.equals(response);
}

10
src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/KeepaliveTimeoutListenerForPlatform.java

@ -1,5 +1,7 @@
package com.genersoft.iot.vmp.gb28181.event.offline;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.listener.KeyExpirationEventMessageListener;
@ -17,6 +19,8 @@ import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
@Component
public class KeepaliveTimeoutListenerForPlatform extends KeyExpirationEventMessageListener {
private Logger logger = LoggerFactory.getLogger(KeepaliveTimeoutListenerForPlatform.class);
@Autowired
private EventPublisher publisher;
@ -34,9 +38,9 @@ public class KeepaliveTimeoutListenerForPlatform extends KeyExpirationEventMessa
public void onMessage(Message message, byte[] pattern) {
// 获取失效的key
String expiredKey = message.toString();
System.out.println(expiredKey);
logger.info(expiredKey);
if(!expiredKey.startsWith(VideoManagerConstants.PLATFORM_PREFIX)){
System.out.println("收到redis过期监听,但开头不是"+VideoManagerConstants.PLATFORM_PREFIX+",忽略");
logger.info("收到redis过期监听,但开头不是"+VideoManagerConstants.PLATFORM_PREFIX+",忽略");
return;
}
// 平台心跳到期,需要重发, 判断是否已经多次未收到心跳回复, 多次未收到,则重新发起注册, 注册尝试多次未得到回复,则认为平台离线
@ -45,7 +49,7 @@ public class KeepaliveTimeoutListenerForPlatform extends KeyExpirationEventMessa
publisher.platformKeepaliveExpireEventPublish(platformGBId);
}else if (expiredKey.startsWith(VideoManagerConstants.PLATFORM_REGISTER_PREFIX)) {
System.out.println("11111111111111");
logger.info("11111111111111");
String platformGBId = expiredKey.substring(VideoManagerConstants.PLATFORM_REGISTER_PREFIX.length(),expiredKey.length());
publisher.platformNotRegisterEventPublish(platformGBId);

6
src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/KeepliveTimeoutListener.java

@ -1,5 +1,7 @@
package com.genersoft.iot.vmp.gb28181.event.offline;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.listener.KeyExpirationEventMessageListener;
@ -17,6 +19,8 @@ import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
@Component
public class KeepliveTimeoutListener extends KeyExpirationEventMessageListener {
private Logger logger = LoggerFactory.getLogger(KeepliveTimeoutListener.class);
@Autowired
private EventPublisher publisher;
@ -34,7 +38,7 @@ public class KeepliveTimeoutListener extends KeyExpirationEventMessageListener {
// 获取失效的key
String expiredKey = message.toString();
if(!expiredKey.startsWith(VideoManagerConstants.KEEPLIVEKEY_PREFIX)){
System.out.println("收到redis过期监听,但开头不是"+VideoManagerConstants.KEEPLIVEKEY_PREFIX+",忽略");
logger.info("收到redis过期监听,但开头不是"+VideoManagerConstants.KEEPLIVEKEY_PREFIX+",忽略");
return;
}

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

@ -280,7 +280,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);
System.out.println("控制字符串:" + cmdStr);
logger.info("控制字符串:" + cmdStr);
StringBuffer ptzXml = new StringBuffer(200);
ptzXml.append("<?xml version=\"1.0\" ?>\r\n");
ptzXml.append("<Control>\r\n");

17
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/AckRequestProcessor.java

@ -14,6 +14,8 @@ import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcessor;
import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @Description:ACK请求处理器
@ -22,6 +24,9 @@ import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
*/
public class AckRequestProcessor extends SIPRequestAbstractProcessor {
private Logger logger = LoggerFactory.getLogger(AckRequestProcessor.class);
private IRedisCatchStorage redisCatchStorage;
private ZLMRTPServerFactory zlmrtpServerFactory;
@ -55,8 +60,8 @@ public class AckRequestProcessor extends SIPRequestAbstractProcessor {
}
redisCatchStorage.updateSendRTPSever(sendRtpItem);
System.out.println(platformGbId);
System.out.println(channelId);
logger.info(platformGbId);
logger.info(channelId);
Map<String, Object> param = new HashMap<>();
param.put("vhost","__defaultVhost__");
param.put("app",streamInfo.getApp());
@ -74,16 +79,16 @@ public class AckRequestProcessor extends SIPRequestAbstractProcessor {
if (System.currentTimeMillis() - startTime < 30 * 1000) {
if (zlmrtpServerFactory.isStreamReady(streamInfo.getApp(), streamInfo.getStreamId())) {
rtpPushed = true;
System.out.println("已获取设备推流,开始向上级推流");
logger.info("已获取设备推流,开始向上级推流");
zlmrtpServerFactory.startSendRtpStream(param);
} else {
System.out.println("等待设备推流.......");
logger.info("等待设备推流.......");
Thread.sleep(1000);
continue;
}
} else {
rtpPushed = true;
System.out.println("设备推流超时,终止向上级推流");
logger.info("设备推流超时,终止向上级推流");
}
} catch (InterruptedException e) {
e.printStackTrace();
@ -95,7 +100,7 @@ public class AckRequestProcessor extends SIPRequestAbstractProcessor {
// CSeq csReq = (CSeq) request.getHeader(CSeq.NAME);
// ackRequest = dialog.createAck(csReq.getSeqNumber());
// dialog.sendAck(ackRequest);
// System.out.println("send ack to callee:" + ackRequest.toString());
// logger.info("send ack to callee:" + ackRequest.toString());
// } catch (SipException e) {
// e.printStackTrace();
// } catch (InvalidArgumentException e) {

8
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/ByeRequestProcessor.java

@ -16,6 +16,8 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander;
import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcessor;
import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.ParseException;
import java.util.HashMap;
@ -28,6 +30,8 @@ import java.util.Map;
*/
public class ByeRequestProcessor extends SIPRequestAbstractProcessor {
private Logger logger = LoggerFactory.getLogger(ByeRequestProcessor.class);
private ISIPCommander cmder;
private IRedisCatchStorage redisCatchStorage;
@ -54,11 +58,11 @@ public class ByeRequestProcessor extends SIPRequestAbstractProcessor {
param.put("vhost","__defaultVhost__");
param.put("app",sendRtpItem.getApp());
param.put("stream",streamId);
System.out.println("停止向上级推流:" + streamId);
logger.info("停止向上级推流:" + streamId);
zlmrtpServerFactory.stopSendRtpStream(param);
redisCatchStorage.deleteSendRTPServer(platformGbId, channelId);
if (zlmrtpServerFactory.totalReaderCount(sendRtpItem.getApp(), streamId) == 0) {
System.out.println(streamId + "无其它观看者,通知设备停止推流");
logger.info(streamId + "无其它观看者,通知设备停止推流");
cmder.streamByeCmd(sendRtpItem.getDeviceId(), channelId);
}
}

22
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java

@ -114,13 +114,13 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
String cmd = XmlUtil.getText(rootElement, "CmdType");
if (MESSAGE_KEEP_ALIVE.equals(cmd)) {
logger.info("接收到KeepAlive消息");
logger.debug("接收到KeepAlive消息");
processMessageKeepAlive(evt);
} else if (MESSAGE_CONFIG_DOWNLOAD.equals(cmd)) {
logger.info("接收到ConfigDownload消息");
logger.debug("接收到ConfigDownload消息");
processMessageConfigDownload(evt);
} else if (MESSAGE_CATALOG.equals(cmd)) {
logger.info("接收到Catalog消息");
logger.debug("接收到Catalog消息");
processMessageCatalogList(evt);
} else if (MESSAGE_DEVICE_INFO.equals(cmd)) {
// DeviceInfo消息处理
@ -129,31 +129,31 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
// DeviceStatus消息处理
processMessageDeviceStatus(evt);
} else if (MESSAGE_DEVICE_CONTROL.equals(cmd)) {
logger.info("接收到DeviceControl消息");
logger.debug("接收到DeviceControl消息");
processMessageDeviceControl(evt);
} else if (MESSAGE_DEVICE_CONFIG.equals(cmd)) {
logger.info("接收到DeviceConfig消息");
processMessageDeviceConfig(evt);
} else if (MESSAGE_ALARM.equals(cmd)) {
logger.info("接收到Alarm消息");
logger.debug("接收到Alarm消息");
processMessageAlarm(evt);
} else if (MESSAGE_RECORD_INFO.equals(cmd)) {
logger.info("接收到RecordInfo消息");
logger.debug("接收到RecordInfo消息");
processMessageRecordInfo(evt);
}else if (MESSAGE_MEDIA_STATUS.equals(cmd)) {
logger.info("接收到MediaStatus消息");
logger.debug("接收到MediaStatus消息");
processMessageMediaStatus(evt);
} else if (MESSAGE_MOBILE_POSITION.equals(cmd)) {
logger.info("接收到MobilePosition消息");
logger.debug("接收到MobilePosition消息");
processMessageMobilePosition(evt);
} else if (MESSAGE_PRESET_QUERY.equals(cmd)) {
logger.info("接收到PresetQuery消息");
logger.debug("接收到PresetQuery消息");
processMessagePresetQuery(evt);
} else if (MESSAGE_BROADCAST.equals(cmd)) {
// Broadcast消息处理
processMessageBroadcast(evt);
} else {
logger.info("接收到消息:" + cmd);
logger.debug("接收到消息:" + cmd);
responseAck(evt);
}
} catch (DocumentException | SipException |InvalidArgumentException | ParseException e) {
@ -467,7 +467,7 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
cmderFroPlatform.deviceInfoResponse(parentPlatform, sn, fromHeader.getTag());
}
} else {
logger.info("接收到DeviceInfo应答消息");
logger.debug("接收到DeviceInfo应答消息");
Device device = storager.queryVideoDevice(deviceId);
if (device == null) {
return;

6
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/OtherRequestProcessor.java

@ -3,6 +3,8 @@ package com.genersoft.iot.vmp.gb28181.transmit.request.impl;
import javax.sip.RequestEvent;
import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcessor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @Description:暂不支持的消息请求处理器
@ -11,6 +13,8 @@ import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcesso
*/
public class OtherRequestProcessor extends SIPRequestAbstractProcessor {
private Logger logger = LoggerFactory.getLogger(OtherRequestProcessor.class);
/**
* <p>Title: process</p>
* <p>Description: </p>
@ -21,7 +25,7 @@ public class OtherRequestProcessor extends SIPRequestAbstractProcessor {
*/
@Override
public void process(RequestEvent evt) {
System.out.println("Unsupported the method: " + evt.getRequest().getMethod());
logger.info("Unsupported the method: " + evt.getRequest().getMethod());
}
}

8
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/SubscribeRequestProcessor.java

@ -11,6 +11,8 @@ import javax.sip.message.Request;
import javax.sip.message.Response;
import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcessor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @Description:SUBSCRIBE请求处理器
@ -19,6 +21,8 @@ import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcesso
*/
public class SubscribeRequestProcessor extends SIPRequestAbstractProcessor {
private Logger logger = LoggerFactory.getLogger(SubscribeRequestProcessor.class);
/**
* 处理SUBSCRIBE请求
*
@ -38,13 +42,13 @@ public class SubscribeRequestProcessor extends SIPRequestAbstractProcessor {
ExpiresHeader expireHeader = getHeaderFactory().createExpiresHeader(30);
response.setExpires(expireHeader);
}
System.out.println("response : " + response.toString());
logger.info("response : " + response.toString());
ServerTransaction transaction = getServerTransaction(evt);
if (transaction != null) {
transaction.sendResponse(response);
transaction.terminate();
} else {
System.out.println("processRequest serverTransactionId is null.");
logger.info("processRequest serverTransactionId is null.");
}
} catch (ParseException e) {

6
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/response/impl/InviteResponseProcessor.java

@ -9,6 +9,8 @@ import javax.sip.message.Request;
import javax.sip.message.Response;
import gov.nist.javax.sip.ResponseEventExt;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import com.genersoft.iot.vmp.conf.SipConfig;
@ -24,7 +26,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.response.ISIPResponseProcessor;
@Component
public class InviteResponseProcessor implements ISIPResponseProcessor {
// private final static Logger logger = LoggerFactory.getLogger(InviteResponseProcessor.class);
private final static Logger logger = LoggerFactory.getLogger(InviteResponseProcessor.class);
/**
* 处理invite响应
@ -51,7 +53,7 @@ public class InviteResponseProcessor implements ISIPResponseProcessor {
requestURI.setHost(event.getRemoteIpAddress());
requestURI.setPort(event.getRemotePort());
reqAck.setRequestURI(requestURI);
System.out.println("向 " + event.getRemoteIpAddress() + ":" + event.getRemotePort() + "回复ack");
logger.info("向 " + event.getRemoteIpAddress() + ":" + event.getRemotePort() + "回复ack");
dialog.sendAck(reqAck);
}
} catch (InvalidArgumentException | SipException e) {

15
src/main/java/com/genersoft/iot/vmp/gb28181/utils/NumericUtil.java

@ -1,5 +1,8 @@
package com.genersoft.iot.vmp.gb28181.utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 数值格式判断和处理
* @author lawrencehj
@ -7,6 +10,8 @@ package com.genersoft.iot.vmp.gb28181.utils;
*/
public class NumericUtil {
private static Logger logger = LoggerFactory.getLogger(NumericUtil.class);
/**
* 判断是否Double格式
* @param str
@ -14,11 +19,11 @@ public class NumericUtil {
*/
public static boolean isDouble(String str) {
try {
Double num2 = Double.valueOf(str);
System.out.println(num2 + " is a valid numeric string!");
Double num2 = Double.valueOf(str);
logger.debug(num2 + " is a valid numeric string!");
return true;
} catch (Exception e) {
System.out.println(str + " is an invalid numeric string!");
logger.debug(str + " is an invalid numeric string!");
return false;
}
}
@ -31,10 +36,10 @@ public class NumericUtil {
public static boolean isInteger(String str) {
try {
int num2 = Integer.valueOf(str);
System.out.println(num2 + " is an integer!");
logger.debug(num2 + " is an integer!");
return true;
} catch (Exception e) {
System.out.println(str + " is not an integer!");
logger.debug(str + " is not an integer!");
return false;
}
}

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

@ -251,7 +251,7 @@ public class ZLMHttpHookListener {
JSONArray tracks = json.getJSONArray("tracks");
boolean regist = json.getBoolean("regist");
if (tracks != null) {
System.out.println("on_stream_changed->>" + schema);
logger.info("[stream: " + streamId + "]on_stream_changed->>" + schema);
}
if ("rtmp".equals(schema)){
if ("rtp".equals(app) && !regist ) {

1
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java

@ -71,7 +71,6 @@ public class ZLMMediaListManager {
jsonObject.put("app", streamPushItem.getApp());
jsonObject.put("stream", streamPushItem.getStream());
subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_play,jsonObject,(response)->{
System.out.println(1222211111);
updateMedia(response.getString("app"), response.getString("stream"));
});
}

4
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java

@ -131,8 +131,8 @@ public class ZLMRESTfulUtils {
}
public JSONObject addFFmpegSource(String src_url, String dst_url, String timeout_ms){
System.out.println(src_url);
System.out.println(dst_url);
logger.info(src_url);
logger.info(dst_url);
Map<String, Object> param = new HashMap<>();
param.put("src_url", src_url);
param.put("dst_url", dst_url);

4
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java

@ -189,7 +189,7 @@ public class ZLMRTPServerFactory {
public Boolean startSendRtpStream(Map<String, Object>param) {
Boolean result = false;
JSONObject jsonObject = zlmresTfulUtils.startSendRtp(param);
System.out.println(jsonObject);
logger.info(jsonObject.toJSONString());
if (jsonObject == null) {
logger.error("RTP推流失败: 请检查ZLM服务");
} else if (jsonObject.getInteger("code") == 0) {
@ -233,7 +233,7 @@ public class ZLMRTPServerFactory {
public Boolean stopSendRtpStream(Map<String, Object>param) {
Boolean result = false;
JSONObject jsonObject = zlmresTfulUtils.stopSendRtp(param);
System.out.println(jsonObject);
logger.info(jsonObject.toJSONString());
if (jsonObject == null) {
logger.error("停止RTP推流失败: 请检查ZLM服务");
} else if (jsonObject.getInteger("code") == 0) {

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

@ -154,11 +154,11 @@ public class ZLMRunner implements CommandLineRunner {
* zlm 连接成功或者zlm重启后
*/
private void zLmRunning(MediaServerConfig mediaServerConfig){
logger.info("zlm接入成功...");
logger.info( "[ id: " + mediaServerConfig.getGeneralMediaServerId() + "] zlm接入成功...");
if (autoConfig) saveZLMConfig();
MediaServerConfig mediaInfo = redisCatchStorage.getMediaInfo();
if (mediaInfo != null && System.currentTimeMillis() - mediaInfo.getUpdateTime() < 50){
logger.info("zlm刚刚更新,忽略这次更新");
logger.info("[ id: " + mediaServerConfig.getGeneralMediaServerId() + "]zlm刚刚更新,忽略这次更新");
return;
}
mediaServerConfig.setLocalIP(mediaIp);

12
src/main/java/com/genersoft/iot/vmp/onvif/impl/ONVIFServerIMpl.java

@ -43,7 +43,7 @@ public class ONVIFServerIMpl implements IONVIFServer {
public void onDevicesFound(List<Device> devices) {
if (devices == null || devices.size() == 0) return;
for (Device device : devices){
System.out.println(device.getHostName());
logger.info(device.getHostName());
deviceMap.put(device.getHostName(), device);
}
}
@ -53,7 +53,7 @@ public class ONVIFServerIMpl implements IONVIFServer {
public void onDiscoveryFinished() {
ArrayList<String> result = new ArrayList<>();
for (Device device : deviceMap.values()) {
System.out.println(device.getHostName());
logger.info(device.getHostName());
result.add(device.getHostName());
}
callBack.run(0, result);
@ -71,14 +71,14 @@ public class ONVIFServerIMpl implements IONVIFServer {
@Override
public void onResponse(OnvifDevice onvifDevice, OnvifResponse response) {
System.out.println("[RESPONSE] " + onvifDevice.getHostName()
logger.info("[RESPONSE] " + onvifDevice.getHostName()
+ "======" + response.getErrorCode()
+ "======" + response.getErrorMessage());
}
@Override
public void onError(OnvifDevice onvifDevice, int errorCode, String errorMessage) {
System.out.println("[ERROR] " + onvifDevice.getHostName() + "======" + errorCode + "=======" + errorMessage);
logger.info("[ERROR] " + onvifDevice.getHostName() + "======" + errorCode + "=======" + errorMessage);
callBack.run(errorCode, errorMessage);
}
});
@ -91,8 +91,8 @@ public class ONVIFServerIMpl implements IONVIFServer {
@Override
public void onMediaProfilesReceived(OnvifDevice device, List<OnvifMediaProfile> mediaProfiles) {
for (OnvifMediaProfile mediaProfile : mediaProfiles) {
System.out.println(mediaProfile.getName());
System.out.println(mediaProfile.getToken());
logger.info(mediaProfile.getName());
logger.info(mediaProfile.getToken());
if (mediaProfile.getName().equals("mainStream")) {
onvifManager.getMediaStreamURI(device, mediaProfile, (OnvifDevice onvifDevice,
OnvifMediaProfile profile, String uri) -> {

11
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java

@ -12,6 +12,8 @@ import com.genersoft.iot.vmp.storager.dao.*;
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.stereotype.Component;
@ -29,6 +31,9 @@ import org.springframework.transaction.annotation.Transactional;
@SuppressWarnings("rawtypes")
@Component
public class VideoManagerStoragerImpl implements IVideoManagerStorager {
private Logger logger = LoggerFactory.getLogger(VideoManagerStoragerImpl.class);
@Autowired
DataSourceTransactionManager dataSourceTransactionManager;
@ -232,7 +237,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
return false;
}
device.setOnline(1);
System.out.println("更新设备在线");
logger.info("更新设备在线: " + deviceId);
return deviceMapper.update(device) > 0;
}
@ -244,7 +249,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
*/
@Override
public synchronized boolean outline(String deviceId) {
System.out.println("更新设备离线: " + deviceId);
logger.info("更新设备离线: " + deviceId);
Device device = deviceMapper.getDeviceByDeviceId(deviceId);
if (device == null) return false;
device.setOnline(0);
@ -540,7 +545,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
@Override
public void updateMediaList(List<StreamPushItem> streamPushItems) {
if (streamPushItems == null || streamPushItems.size() == 0) return;
System.out.printf("updateMediaList: " + streamPushItems.size());
logger.info("updateMediaList: " + streamPushItems.size());
streamPushMapper.addAll(streamPushItems);
// TODO 待优化
for (int i = 0; i < streamPushItems.size(); i++) {

11
src/main/java/com/genersoft/iot/vmp/utils/GpsUtil.java

@ -7,9 +7,16 @@ import java.net.Socket;
import java.util.Base64;
import com.genersoft.iot.vmp.gb28181.bean.BaiduPoint;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class GpsUtil {
private static Logger logger = LoggerFactory.getLogger(GpsUtil.class);
public static BaiduPoint Wgs84ToBd09(String xx, String yy) {
try {
Socket s = new Socket("api.map.baidu.com", 80);
BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream(), "UTF-8"));
@ -26,7 +33,7 @@ public class GpsUtil {
String json = "";
String tmp = "";
while ((tmp = br.readLine()) != null) {
// System.out.println(tmp);
// logger.info(tmp);
json += tmp;
}
@ -44,7 +51,7 @@ public class GpsUtil {
return bdPoint;
//return (new String(decode(x)) + "," + new String(decode(y)));
} else {
System.out.println("gps坐标无效!!");
logger.info("gps坐标无效!!");
}
out.close();
br.close();

4
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java

@ -167,7 +167,7 @@ public class PlayController {
streamId );
String srcUrl = String.format("rtsp://%s:%s/rtp/%s", "127.0.0.1", mediaInfo.getRtspPort(), streamId);
JSONObject jsonObject = zlmresTfulUtils.addFFmpegSource(srcUrl, dstUrl, "1000000");
System.out.println(jsonObject);
logger.info(jsonObject.toJSONString());
JSONObject result = new JSONObject();
if (jsonObject != null && jsonObject.getInteger("code") == 0) {
result.put("code", 0);
@ -198,7 +198,7 @@ public class PlayController {
public ResponseEntity<String> playConvertStop(@PathVariable String key) {
JSONObject jsonObject = zlmresTfulUtils.delFFmpegSource(key);
System.out.println(jsonObject);
logger.info(jsonObject.toJSONString());
JSONObject result = new JSONObject();
if (jsonObject != null && jsonObject.getInteger("code") == 0) {
result.put("code", 0);

Loading…
Cancel
Save