Commit f7a2d2a92d7e25780c91dd74ecf52e094b62ef4c
1 parent
b92027f3
去除所有的system.print, 优化日志显示
Showing
21 changed files
with
124 additions
and
66 deletions
src/main/java/com/genersoft/iot/vmp/conf/MediaServerConfig.java
| @@ -22,6 +22,9 @@ public class MediaServerConfig { | @@ -22,6 +22,9 @@ public class MediaServerConfig { | ||
| 22 | @JSONField(name = "general.enableVhost") | 22 | @JSONField(name = "general.enableVhost") |
| 23 | private String generalEnableVhost; | 23 | private String generalEnableVhost; |
| 24 | 24 | ||
| 25 | + @JSONField(name = "general.mediaServerId") | ||
| 26 | + private String generalMediaServerId; | ||
| 27 | + | ||
| 25 | @JSONField(name = "general.flowThreshold") | 28 | @JSONField(name = "general.flowThreshold") |
| 26 | private String generalFlowThreshold; | 29 | private String generalFlowThreshold; |
| 27 | 30 | ||
| @@ -738,4 +741,12 @@ public class MediaServerConfig { | @@ -738,4 +741,12 @@ public class MediaServerConfig { | ||
| 738 | public void setUpdateTime(long updateTime) { | 741 | public void setUpdateTime(long updateTime) { |
| 739 | this.updateTime = updateTime; | 742 | this.updateTime = updateTime; |
| 740 | } | 743 | } |
| 744 | + | ||
| 745 | + public String getGeneralMediaServerId() { | ||
| 746 | + return generalMediaServerId; | ||
| 747 | + } | ||
| 748 | + | ||
| 749 | + public void setGeneralMediaServerId(String generalMediaServerId) { | ||
| 750 | + this.generalMediaServerId = generalMediaServerId; | ||
| 751 | + } | ||
| 741 | } | 752 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/auth/DigestServerAuthenticationHelper.java
| @@ -39,6 +39,8 @@ import javax.sip.message.Request; | @@ -39,6 +39,8 @@ import javax.sip.message.Request; | ||
| 39 | import javax.sip.message.Response; | 39 | import javax.sip.message.Response; |
| 40 | 40 | ||
| 41 | import gov.nist.core.InternalErrorHandler; | 41 | import gov.nist.core.InternalErrorHandler; |
| 42 | +import org.slf4j.Logger; | ||
| 43 | +import org.slf4j.LoggerFactory; | ||
| 42 | 44 | ||
| 43 | /** | 45 | /** |
| 44 | * Implements the HTTP digest authentication method server side functionality. | 46 | * Implements the HTTP digest authentication method server side functionality. |
| @@ -49,6 +51,8 @@ import gov.nist.core.InternalErrorHandler; | @@ -49,6 +51,8 @@ import gov.nist.core.InternalErrorHandler; | ||
| 49 | 51 | ||
| 50 | public class DigestServerAuthenticationHelper { | 52 | public class DigestServerAuthenticationHelper { |
| 51 | 53 | ||
| 54 | + private Logger logger = LoggerFactory.getLogger(DigestServerAuthenticationHelper.class); | ||
| 55 | + | ||
| 52 | private MessageDigest messageDigest; | 56 | private MessageDigest messageDigest; |
| 53 | 57 | ||
| 54 | public static final String DEFAULT_ALGORITHM = "MD5"; | 58 | public static final String DEFAULT_ALGORITHM = "MD5"; |
| @@ -204,18 +208,18 @@ public class DigestServerAuthenticationHelper { | @@ -204,18 +208,18 @@ public class DigestServerAuthenticationHelper { | ||
| 204 | String A2 = request.getMethod().toUpperCase() + ":" + uri.toString(); | 208 | String A2 = request.getMethod().toUpperCase() + ":" + uri.toString(); |
| 205 | byte mdbytes[] = messageDigest.digest(A1.getBytes()); | 209 | byte mdbytes[] = messageDigest.digest(A1.getBytes()); |
| 206 | String HA1 = toHexString(mdbytes); | 210 | String HA1 = toHexString(mdbytes); |
| 207 | - System.out.println("A1: " + A1); | ||
| 208 | - System.out.println("A2: " + A2); | 211 | + logger.debug("A1: " + A1); |
| 212 | + logger.debug("A2: " + A2); | ||
| 209 | 213 | ||
| 210 | mdbytes = messageDigest.digest(A2.getBytes()); | 214 | mdbytes = messageDigest.digest(A2.getBytes()); |
| 211 | String HA2 = toHexString(mdbytes); | 215 | String HA2 = toHexString(mdbytes); |
| 212 | - System.out.println("HA1: " + HA1); | ||
| 213 | - System.out.println("HA2: " + HA2); | 216 | + logger.debug("HA1: " + HA1); |
| 217 | + logger.debug("HA2: " + HA2); | ||
| 214 | String cnonce = authHeader.getCNonce(); | 218 | String cnonce = authHeader.getCNonce(); |
| 215 | - System.out.println("nonce: " + nonce); | ||
| 216 | - System.out.println("nc: " + ncStr); | ||
| 217 | - System.out.println("cnonce: " + cnonce); | ||
| 218 | - System.out.println("qop: " + qop); | 219 | + logger.debug("nonce: " + nonce); |
| 220 | + logger.debug("nc: " + ncStr); | ||
| 221 | + logger.debug("cnonce: " + cnonce); | ||
| 222 | + logger.debug("qop: " + qop); | ||
| 219 | String KD = HA1 + ":" + nonce; | 223 | String KD = HA1 + ":" + nonce; |
| 220 | 224 | ||
| 221 | if (qop != null && qop.equals("auth") ) { | 225 | if (qop != null && qop.equals("auth") ) { |
| @@ -228,12 +232,12 @@ public class DigestServerAuthenticationHelper { | @@ -228,12 +232,12 @@ public class DigestServerAuthenticationHelper { | ||
| 228 | KD += ":" + qop; | 232 | KD += ":" + qop; |
| 229 | } | 233 | } |
| 230 | KD += ":" + HA2; | 234 | KD += ":" + HA2; |
| 231 | - System.out.println("KD: " + KD); | 235 | + logger.debug("KD: " + KD); |
| 232 | mdbytes = messageDigest.digest(KD.getBytes()); | 236 | mdbytes = messageDigest.digest(KD.getBytes()); |
| 233 | String mdString = toHexString(mdbytes); | 237 | String mdString = toHexString(mdbytes); |
| 234 | - System.out.println("mdString: " + mdString); | 238 | + logger.debug("mdString: " + mdString); |
| 235 | String response = authHeader.getResponse(); | 239 | String response = authHeader.getResponse(); |
| 236 | - System.out.println("response: " + response); | 240 | + logger.debug("response: " + response); |
| 237 | return mdString.equals(response); | 241 | return mdString.equals(response); |
| 238 | 242 | ||
| 239 | } | 243 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/KeepaliveTimeoutListenerForPlatform.java
| 1 | package com.genersoft.iot.vmp.gb28181.event.offline; | 1 | package com.genersoft.iot.vmp.gb28181.event.offline; |
| 2 | 2 | ||
| 3 | +import org.slf4j.Logger; | ||
| 4 | +import org.slf4j.LoggerFactory; | ||
| 3 | import org.springframework.beans.factory.annotation.Autowired; | 5 | import org.springframework.beans.factory.annotation.Autowired; |
| 4 | import org.springframework.data.redis.connection.Message; | 6 | import org.springframework.data.redis.connection.Message; |
| 5 | import org.springframework.data.redis.listener.KeyExpirationEventMessageListener; | 7 | import org.springframework.data.redis.listener.KeyExpirationEventMessageListener; |
| @@ -17,6 +19,8 @@ import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | @@ -17,6 +19,8 @@ import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | ||
| 17 | @Component | 19 | @Component |
| 18 | public class KeepaliveTimeoutListenerForPlatform extends KeyExpirationEventMessageListener { | 20 | public class KeepaliveTimeoutListenerForPlatform extends KeyExpirationEventMessageListener { |
| 19 | 21 | ||
| 22 | + private Logger logger = LoggerFactory.getLogger(KeepaliveTimeoutListenerForPlatform.class); | ||
| 23 | + | ||
| 20 | @Autowired | 24 | @Autowired |
| 21 | private EventPublisher publisher; | 25 | private EventPublisher publisher; |
| 22 | 26 | ||
| @@ -34,9 +38,9 @@ public class KeepaliveTimeoutListenerForPlatform extends KeyExpirationEventMessa | @@ -34,9 +38,9 @@ public class KeepaliveTimeoutListenerForPlatform extends KeyExpirationEventMessa | ||
| 34 | public void onMessage(Message message, byte[] pattern) { | 38 | public void onMessage(Message message, byte[] pattern) { |
| 35 | // 获取失效的key | 39 | // 获取失效的key |
| 36 | String expiredKey = message.toString(); | 40 | String expiredKey = message.toString(); |
| 37 | - System.out.println(expiredKey); | 41 | + logger.info(expiredKey); |
| 38 | if(!expiredKey.startsWith(VideoManagerConstants.PLATFORM_PREFIX)){ | 42 | if(!expiredKey.startsWith(VideoManagerConstants.PLATFORM_PREFIX)){ |
| 39 | - System.out.println("收到redis过期监听,但开头不是"+VideoManagerConstants.PLATFORM_PREFIX+",忽略"); | 43 | + logger.info("收到redis过期监听,但开头不是"+VideoManagerConstants.PLATFORM_PREFIX+",忽略"); |
| 40 | return; | 44 | return; |
| 41 | } | 45 | } |
| 42 | // 平台心跳到期,需要重发, 判断是否已经多次未收到心跳回复, 多次未收到,则重新发起注册, 注册尝试多次未得到回复,则认为平台离线 | 46 | // 平台心跳到期,需要重发, 判断是否已经多次未收到心跳回复, 多次未收到,则重新发起注册, 注册尝试多次未得到回复,则认为平台离线 |
| @@ -45,7 +49,7 @@ public class KeepaliveTimeoutListenerForPlatform extends KeyExpirationEventMessa | @@ -45,7 +49,7 @@ public class KeepaliveTimeoutListenerForPlatform extends KeyExpirationEventMessa | ||
| 45 | 49 | ||
| 46 | publisher.platformKeepaliveExpireEventPublish(platformGBId); | 50 | publisher.platformKeepaliveExpireEventPublish(platformGBId); |
| 47 | }else if (expiredKey.startsWith(VideoManagerConstants.PLATFORM_REGISTER_PREFIX)) { | 51 | }else if (expiredKey.startsWith(VideoManagerConstants.PLATFORM_REGISTER_PREFIX)) { |
| 48 | - System.out.println("11111111111111"); | 52 | + logger.info("11111111111111"); |
| 49 | String platformGBId = expiredKey.substring(VideoManagerConstants.PLATFORM_REGISTER_PREFIX.length(),expiredKey.length()); | 53 | String platformGBId = expiredKey.substring(VideoManagerConstants.PLATFORM_REGISTER_PREFIX.length(),expiredKey.length()); |
| 50 | 54 | ||
| 51 | publisher.platformNotRegisterEventPublish(platformGBId); | 55 | publisher.platformNotRegisterEventPublish(platformGBId); |
src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/KeepliveTimeoutListener.java
| 1 | package com.genersoft.iot.vmp.gb28181.event.offline; | 1 | package com.genersoft.iot.vmp.gb28181.event.offline; |
| 2 | 2 | ||
| 3 | +import org.slf4j.Logger; | ||
| 4 | +import org.slf4j.LoggerFactory; | ||
| 3 | import org.springframework.beans.factory.annotation.Autowired; | 5 | import org.springframework.beans.factory.annotation.Autowired; |
| 4 | import org.springframework.data.redis.connection.Message; | 6 | import org.springframework.data.redis.connection.Message; |
| 5 | import org.springframework.data.redis.listener.KeyExpirationEventMessageListener; | 7 | import org.springframework.data.redis.listener.KeyExpirationEventMessageListener; |
| @@ -17,6 +19,8 @@ import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | @@ -17,6 +19,8 @@ import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | ||
| 17 | @Component | 19 | @Component |
| 18 | public class KeepliveTimeoutListener extends KeyExpirationEventMessageListener { | 20 | public class KeepliveTimeoutListener extends KeyExpirationEventMessageListener { |
| 19 | 21 | ||
| 22 | + private Logger logger = LoggerFactory.getLogger(KeepliveTimeoutListener.class); | ||
| 23 | + | ||
| 20 | @Autowired | 24 | @Autowired |
| 21 | private EventPublisher publisher; | 25 | private EventPublisher publisher; |
| 22 | 26 | ||
| @@ -34,7 +38,7 @@ public class KeepliveTimeoutListener extends KeyExpirationEventMessageListener { | @@ -34,7 +38,7 @@ public class KeepliveTimeoutListener extends KeyExpirationEventMessageListener { | ||
| 34 | // 获取失效的key | 38 | // 获取失效的key |
| 35 | String expiredKey = message.toString(); | 39 | String expiredKey = message.toString(); |
| 36 | if(!expiredKey.startsWith(VideoManagerConstants.KEEPLIVEKEY_PREFIX)){ | 40 | if(!expiredKey.startsWith(VideoManagerConstants.KEEPLIVEKEY_PREFIX)){ |
| 37 | - System.out.println("收到redis过期监听,但开头不是"+VideoManagerConstants.KEEPLIVEKEY_PREFIX+",忽略"); | 41 | + logger.info("收到redis过期监听,但开头不是"+VideoManagerConstants.KEEPLIVEKEY_PREFIX+",忽略"); |
| 38 | return; | 42 | return; |
| 39 | } | 43 | } |
| 40 | 44 |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
| @@ -280,7 +280,7 @@ public class SIPCommander implements ISIPCommander { | @@ -280,7 +280,7 @@ public class SIPCommander implements ISIPCommander { | ||
| 280 | public boolean frontEndCmd(Device device, String channelId, int cmdCode, int parameter1, int parameter2, int combineCode2) { | 280 | public boolean frontEndCmd(Device device, String channelId, int cmdCode, int parameter1, int parameter2, int combineCode2) { |
| 281 | try { | 281 | try { |
| 282 | String cmdStr= frontEndCmdString(cmdCode, parameter1, parameter2, combineCode2); | 282 | String cmdStr= frontEndCmdString(cmdCode, parameter1, parameter2, combineCode2); |
| 283 | - System.out.println("控制字符串:" + cmdStr); | 283 | + logger.info("控制字符串:" + cmdStr); |
| 284 | StringBuffer ptzXml = new StringBuffer(200); | 284 | StringBuffer ptzXml = new StringBuffer(200); |
| 285 | ptzXml.append("<?xml version=\"1.0\" ?>\r\n"); | 285 | ptzXml.append("<?xml version=\"1.0\" ?>\r\n"); |
| 286 | ptzXml.append("<Control>\r\n"); | 286 | ptzXml.append("<Control>\r\n"); |
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; | @@ -14,6 +14,8 @@ import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; | ||
| 14 | import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcessor; | 14 | import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcessor; |
| 15 | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; | 15 | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; |
| 16 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 16 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 17 | +import org.slf4j.Logger; | ||
| 18 | +import org.slf4j.LoggerFactory; | ||
| 17 | 19 | ||
| 18 | /** | 20 | /** |
| 19 | * @Description:ACK请求处理器 | 21 | * @Description:ACK请求处理器 |
| @@ -22,6 +24,9 @@ import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | @@ -22,6 +24,9 @@ import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | ||
| 22 | */ | 24 | */ |
| 23 | public class AckRequestProcessor extends SIPRequestAbstractProcessor { | 25 | public class AckRequestProcessor extends SIPRequestAbstractProcessor { |
| 24 | 26 | ||
| 27 | + | ||
| 28 | + private Logger logger = LoggerFactory.getLogger(AckRequestProcessor.class); | ||
| 29 | + | ||
| 25 | private IRedisCatchStorage redisCatchStorage; | 30 | private IRedisCatchStorage redisCatchStorage; |
| 26 | 31 | ||
| 27 | private ZLMRTPServerFactory zlmrtpServerFactory; | 32 | private ZLMRTPServerFactory zlmrtpServerFactory; |
| @@ -55,8 +60,8 @@ public class AckRequestProcessor extends SIPRequestAbstractProcessor { | @@ -55,8 +60,8 @@ public class AckRequestProcessor extends SIPRequestAbstractProcessor { | ||
| 55 | } | 60 | } |
| 56 | 61 | ||
| 57 | redisCatchStorage.updateSendRTPSever(sendRtpItem); | 62 | redisCatchStorage.updateSendRTPSever(sendRtpItem); |
| 58 | - System.out.println(platformGbId); | ||
| 59 | - System.out.println(channelId); | 63 | + logger.info(platformGbId); |
| 64 | + logger.info(channelId); | ||
| 60 | Map<String, Object> param = new HashMap<>(); | 65 | Map<String, Object> param = new HashMap<>(); |
| 61 | param.put("vhost","__defaultVhost__"); | 66 | param.put("vhost","__defaultVhost__"); |
| 62 | param.put("app",streamInfo.getApp()); | 67 | param.put("app",streamInfo.getApp()); |
| @@ -74,16 +79,16 @@ public class AckRequestProcessor extends SIPRequestAbstractProcessor { | @@ -74,16 +79,16 @@ public class AckRequestProcessor extends SIPRequestAbstractProcessor { | ||
| 74 | if (System.currentTimeMillis() - startTime < 30 * 1000) { | 79 | if (System.currentTimeMillis() - startTime < 30 * 1000) { |
| 75 | if (zlmrtpServerFactory.isStreamReady(streamInfo.getApp(), streamInfo.getStreamId())) { | 80 | if (zlmrtpServerFactory.isStreamReady(streamInfo.getApp(), streamInfo.getStreamId())) { |
| 76 | rtpPushed = true; | 81 | rtpPushed = true; |
| 77 | - System.out.println("已获取设备推流,开始向上级推流"); | 82 | + logger.info("已获取设备推流,开始向上级推流"); |
| 78 | zlmrtpServerFactory.startSendRtpStream(param); | 83 | zlmrtpServerFactory.startSendRtpStream(param); |
| 79 | } else { | 84 | } else { |
| 80 | - System.out.println("等待设备推流......."); | 85 | + logger.info("等待设备推流......."); |
| 81 | Thread.sleep(1000); | 86 | Thread.sleep(1000); |
| 82 | continue; | 87 | continue; |
| 83 | } | 88 | } |
| 84 | } else { | 89 | } else { |
| 85 | rtpPushed = true; | 90 | rtpPushed = true; |
| 86 | - System.out.println("设备推流超时,终止向上级推流"); | 91 | + logger.info("设备推流超时,终止向上级推流"); |
| 87 | } | 92 | } |
| 88 | } catch (InterruptedException e) { | 93 | } catch (InterruptedException e) { |
| 89 | e.printStackTrace(); | 94 | e.printStackTrace(); |
| @@ -95,7 +100,7 @@ public class AckRequestProcessor extends SIPRequestAbstractProcessor { | @@ -95,7 +100,7 @@ public class AckRequestProcessor extends SIPRequestAbstractProcessor { | ||
| 95 | // CSeq csReq = (CSeq) request.getHeader(CSeq.NAME); | 100 | // CSeq csReq = (CSeq) request.getHeader(CSeq.NAME); |
| 96 | // ackRequest = dialog.createAck(csReq.getSeqNumber()); | 101 | // ackRequest = dialog.createAck(csReq.getSeqNumber()); |
| 97 | // dialog.sendAck(ackRequest); | 102 | // dialog.sendAck(ackRequest); |
| 98 | - // System.out.println("send ack to callee:" + ackRequest.toString()); | 103 | + // logger.info("send ack to callee:" + ackRequest.toString()); |
| 99 | // } catch (SipException e) { | 104 | // } catch (SipException e) { |
| 100 | // e.printStackTrace(); | 105 | // e.printStackTrace(); |
| 101 | // } catch (InvalidArgumentException e) { | 106 | // } catch (InvalidArgumentException e) { |
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; | @@ -16,6 +16,8 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; | ||
| 16 | import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcessor; | 16 | import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcessor; |
| 17 | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; | 17 | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; |
| 18 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 18 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 19 | +import org.slf4j.Logger; | ||
| 20 | +import org.slf4j.LoggerFactory; | ||
| 19 | 21 | ||
| 20 | import java.text.ParseException; | 22 | import java.text.ParseException; |
| 21 | import java.util.HashMap; | 23 | import java.util.HashMap; |
| @@ -28,6 +30,8 @@ import java.util.Map; | @@ -28,6 +30,8 @@ import java.util.Map; | ||
| 28 | */ | 30 | */ |
| 29 | public class ByeRequestProcessor extends SIPRequestAbstractProcessor { | 31 | public class ByeRequestProcessor extends SIPRequestAbstractProcessor { |
| 30 | 32 | ||
| 33 | + private Logger logger = LoggerFactory.getLogger(ByeRequestProcessor.class); | ||
| 34 | + | ||
| 31 | private ISIPCommander cmder; | 35 | private ISIPCommander cmder; |
| 32 | 36 | ||
| 33 | private IRedisCatchStorage redisCatchStorage; | 37 | private IRedisCatchStorage redisCatchStorage; |
| @@ -54,11 +58,11 @@ public class ByeRequestProcessor extends SIPRequestAbstractProcessor { | @@ -54,11 +58,11 @@ public class ByeRequestProcessor extends SIPRequestAbstractProcessor { | ||
| 54 | param.put("vhost","__defaultVhost__"); | 58 | param.put("vhost","__defaultVhost__"); |
| 55 | param.put("app",sendRtpItem.getApp()); | 59 | param.put("app",sendRtpItem.getApp()); |
| 56 | param.put("stream",streamId); | 60 | param.put("stream",streamId); |
| 57 | - System.out.println("停止向上级推流:" + streamId); | 61 | + logger.info("停止向上级推流:" + streamId); |
| 58 | zlmrtpServerFactory.stopSendRtpStream(param); | 62 | zlmrtpServerFactory.stopSendRtpStream(param); |
| 59 | redisCatchStorage.deleteSendRTPServer(platformGbId, channelId); | 63 | redisCatchStorage.deleteSendRTPServer(platformGbId, channelId); |
| 60 | if (zlmrtpServerFactory.totalReaderCount(sendRtpItem.getApp(), streamId) == 0) { | 64 | if (zlmrtpServerFactory.totalReaderCount(sendRtpItem.getApp(), streamId) == 0) { |
| 61 | - System.out.println(streamId + "无其它观看者,通知设备停止推流"); | 65 | + logger.info(streamId + "无其它观看者,通知设备停止推流"); |
| 62 | cmder.streamByeCmd(sendRtpItem.getDeviceId(), channelId); | 66 | cmder.streamByeCmd(sendRtpItem.getDeviceId(), channelId); |
| 63 | } | 67 | } |
| 64 | } | 68 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java
| @@ -114,13 +114,13 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { | @@ -114,13 +114,13 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { | ||
| 114 | String cmd = XmlUtil.getText(rootElement, "CmdType"); | 114 | String cmd = XmlUtil.getText(rootElement, "CmdType"); |
| 115 | 115 | ||
| 116 | if (MESSAGE_KEEP_ALIVE.equals(cmd)) { | 116 | if (MESSAGE_KEEP_ALIVE.equals(cmd)) { |
| 117 | - logger.info("接收到KeepAlive消息"); | 117 | + logger.debug("接收到KeepAlive消息"); |
| 118 | processMessageKeepAlive(evt); | 118 | processMessageKeepAlive(evt); |
| 119 | } else if (MESSAGE_CONFIG_DOWNLOAD.equals(cmd)) { | 119 | } else if (MESSAGE_CONFIG_DOWNLOAD.equals(cmd)) { |
| 120 | - logger.info("接收到ConfigDownload消息"); | 120 | + logger.debug("接收到ConfigDownload消息"); |
| 121 | processMessageConfigDownload(evt); | 121 | processMessageConfigDownload(evt); |
| 122 | } else if (MESSAGE_CATALOG.equals(cmd)) { | 122 | } else if (MESSAGE_CATALOG.equals(cmd)) { |
| 123 | - logger.info("接收到Catalog消息"); | 123 | + logger.debug("接收到Catalog消息"); |
| 124 | processMessageCatalogList(evt); | 124 | processMessageCatalogList(evt); |
| 125 | } else if (MESSAGE_DEVICE_INFO.equals(cmd)) { | 125 | } else if (MESSAGE_DEVICE_INFO.equals(cmd)) { |
| 126 | // DeviceInfo消息处理 | 126 | // DeviceInfo消息处理 |
| @@ -129,31 +129,31 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { | @@ -129,31 +129,31 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { | ||
| 129 | // DeviceStatus消息处理 | 129 | // DeviceStatus消息处理 |
| 130 | processMessageDeviceStatus(evt); | 130 | processMessageDeviceStatus(evt); |
| 131 | } else if (MESSAGE_DEVICE_CONTROL.equals(cmd)) { | 131 | } else if (MESSAGE_DEVICE_CONTROL.equals(cmd)) { |
| 132 | - logger.info("接收到DeviceControl消息"); | 132 | + logger.debug("接收到DeviceControl消息"); |
| 133 | processMessageDeviceControl(evt); | 133 | processMessageDeviceControl(evt); |
| 134 | } else if (MESSAGE_DEVICE_CONFIG.equals(cmd)) { | 134 | } else if (MESSAGE_DEVICE_CONFIG.equals(cmd)) { |
| 135 | logger.info("接收到DeviceConfig消息"); | 135 | logger.info("接收到DeviceConfig消息"); |
| 136 | processMessageDeviceConfig(evt); | 136 | processMessageDeviceConfig(evt); |
| 137 | } else if (MESSAGE_ALARM.equals(cmd)) { | 137 | } else if (MESSAGE_ALARM.equals(cmd)) { |
| 138 | - logger.info("接收到Alarm消息"); | 138 | + logger.debug("接收到Alarm消息"); |
| 139 | processMessageAlarm(evt); | 139 | processMessageAlarm(evt); |
| 140 | } else if (MESSAGE_RECORD_INFO.equals(cmd)) { | 140 | } else if (MESSAGE_RECORD_INFO.equals(cmd)) { |
| 141 | - logger.info("接收到RecordInfo消息"); | 141 | + logger.debug("接收到RecordInfo消息"); |
| 142 | processMessageRecordInfo(evt); | 142 | processMessageRecordInfo(evt); |
| 143 | }else if (MESSAGE_MEDIA_STATUS.equals(cmd)) { | 143 | }else if (MESSAGE_MEDIA_STATUS.equals(cmd)) { |
| 144 | - logger.info("接收到MediaStatus消息"); | 144 | + logger.debug("接收到MediaStatus消息"); |
| 145 | processMessageMediaStatus(evt); | 145 | processMessageMediaStatus(evt); |
| 146 | } else if (MESSAGE_MOBILE_POSITION.equals(cmd)) { | 146 | } else if (MESSAGE_MOBILE_POSITION.equals(cmd)) { |
| 147 | - logger.info("接收到MobilePosition消息"); | 147 | + logger.debug("接收到MobilePosition消息"); |
| 148 | processMessageMobilePosition(evt); | 148 | processMessageMobilePosition(evt); |
| 149 | } else if (MESSAGE_PRESET_QUERY.equals(cmd)) { | 149 | } else if (MESSAGE_PRESET_QUERY.equals(cmd)) { |
| 150 | - logger.info("接收到PresetQuery消息"); | 150 | + logger.debug("接收到PresetQuery消息"); |
| 151 | processMessagePresetQuery(evt); | 151 | processMessagePresetQuery(evt); |
| 152 | } else if (MESSAGE_BROADCAST.equals(cmd)) { | 152 | } else if (MESSAGE_BROADCAST.equals(cmd)) { |
| 153 | // Broadcast消息处理 | 153 | // Broadcast消息处理 |
| 154 | processMessageBroadcast(evt); | 154 | processMessageBroadcast(evt); |
| 155 | } else { | 155 | } else { |
| 156 | - logger.info("接收到消息:" + cmd); | 156 | + logger.debug("接收到消息:" + cmd); |
| 157 | responseAck(evt); | 157 | responseAck(evt); |
| 158 | } | 158 | } |
| 159 | } catch (DocumentException | SipException |InvalidArgumentException | ParseException e) { | 159 | } catch (DocumentException | SipException |InvalidArgumentException | ParseException e) { |
| @@ -467,7 +467,7 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { | @@ -467,7 +467,7 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { | ||
| 467 | cmderFroPlatform.deviceInfoResponse(parentPlatform, sn, fromHeader.getTag()); | 467 | cmderFroPlatform.deviceInfoResponse(parentPlatform, sn, fromHeader.getTag()); |
| 468 | } | 468 | } |
| 469 | } else { | 469 | } else { |
| 470 | - logger.info("接收到DeviceInfo应答消息"); | 470 | + logger.debug("接收到DeviceInfo应答消息"); |
| 471 | Device device = storager.queryVideoDevice(deviceId); | 471 | Device device = storager.queryVideoDevice(deviceId); |
| 472 | if (device == null) { | 472 | if (device == null) { |
| 473 | return; | 473 | return; |
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; | @@ -3,6 +3,8 @@ package com.genersoft.iot.vmp.gb28181.transmit.request.impl; | ||
| 3 | import javax.sip.RequestEvent; | 3 | import javax.sip.RequestEvent; |
| 4 | 4 | ||
| 5 | import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcessor; | 5 | import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcessor; |
| 6 | +import org.slf4j.Logger; | ||
| 7 | +import org.slf4j.LoggerFactory; | ||
| 6 | 8 | ||
| 7 | /** | 9 | /** |
| 8 | * @Description:暂不支持的消息请求处理器 | 10 | * @Description:暂不支持的消息请求处理器 |
| @@ -11,6 +13,8 @@ import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcesso | @@ -11,6 +13,8 @@ import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcesso | ||
| 11 | */ | 13 | */ |
| 12 | public class OtherRequestProcessor extends SIPRequestAbstractProcessor { | 14 | public class OtherRequestProcessor extends SIPRequestAbstractProcessor { |
| 13 | 15 | ||
| 16 | + private Logger logger = LoggerFactory.getLogger(OtherRequestProcessor.class); | ||
| 17 | + | ||
| 14 | /** | 18 | /** |
| 15 | * <p>Title: process</p> | 19 | * <p>Title: process</p> |
| 16 | * <p>Description: </p> | 20 | * <p>Description: </p> |
| @@ -21,7 +25,7 @@ public class OtherRequestProcessor extends SIPRequestAbstractProcessor { | @@ -21,7 +25,7 @@ public class OtherRequestProcessor extends SIPRequestAbstractProcessor { | ||
| 21 | */ | 25 | */ |
| 22 | @Override | 26 | @Override |
| 23 | public void process(RequestEvent evt) { | 27 | public void process(RequestEvent evt) { |
| 24 | - System.out.println("Unsupported the method: " + evt.getRequest().getMethod()); | 28 | + logger.info("Unsupported the method: " + evt.getRequest().getMethod()); |
| 25 | } | 29 | } |
| 26 | 30 | ||
| 27 | } | 31 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/SubscribeRequestProcessor.java
| @@ -11,6 +11,8 @@ import javax.sip.message.Request; | @@ -11,6 +11,8 @@ import javax.sip.message.Request; | ||
| 11 | import javax.sip.message.Response; | 11 | import javax.sip.message.Response; |
| 12 | 12 | ||
| 13 | import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcessor; | 13 | import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcessor; |
| 14 | +import org.slf4j.Logger; | ||
| 15 | +import org.slf4j.LoggerFactory; | ||
| 14 | 16 | ||
| 15 | /** | 17 | /** |
| 16 | * @Description:SUBSCRIBE请求处理器 | 18 | * @Description:SUBSCRIBE请求处理器 |
| @@ -19,6 +21,8 @@ import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcesso | @@ -19,6 +21,8 @@ import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcesso | ||
| 19 | */ | 21 | */ |
| 20 | public class SubscribeRequestProcessor extends SIPRequestAbstractProcessor { | 22 | public class SubscribeRequestProcessor extends SIPRequestAbstractProcessor { |
| 21 | 23 | ||
| 24 | + private Logger logger = LoggerFactory.getLogger(SubscribeRequestProcessor.class); | ||
| 25 | + | ||
| 22 | /** | 26 | /** |
| 23 | * 处理SUBSCRIBE请求 | 27 | * 处理SUBSCRIBE请求 |
| 24 | * | 28 | * |
| @@ -38,13 +42,13 @@ public class SubscribeRequestProcessor extends SIPRequestAbstractProcessor { | @@ -38,13 +42,13 @@ public class SubscribeRequestProcessor extends SIPRequestAbstractProcessor { | ||
| 38 | ExpiresHeader expireHeader = getHeaderFactory().createExpiresHeader(30); | 42 | ExpiresHeader expireHeader = getHeaderFactory().createExpiresHeader(30); |
| 39 | response.setExpires(expireHeader); | 43 | response.setExpires(expireHeader); |
| 40 | } | 44 | } |
| 41 | - System.out.println("response : " + response.toString()); | 45 | + logger.info("response : " + response.toString()); |
| 42 | ServerTransaction transaction = getServerTransaction(evt); | 46 | ServerTransaction transaction = getServerTransaction(evt); |
| 43 | if (transaction != null) { | 47 | if (transaction != null) { |
| 44 | transaction.sendResponse(response); | 48 | transaction.sendResponse(response); |
| 45 | transaction.terminate(); | 49 | transaction.terminate(); |
| 46 | } else { | 50 | } else { |
| 47 | - System.out.println("processRequest serverTransactionId is null."); | 51 | + logger.info("processRequest serverTransactionId is null."); |
| 48 | } | 52 | } |
| 49 | 53 | ||
| 50 | } catch (ParseException e) { | 54 | } catch (ParseException e) { |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/response/impl/InviteResponseProcessor.java
| @@ -9,6 +9,8 @@ import javax.sip.message.Request; | @@ -9,6 +9,8 @@ import javax.sip.message.Request; | ||
| 9 | import javax.sip.message.Response; | 9 | import javax.sip.message.Response; |
| 10 | 10 | ||
| 11 | import gov.nist.javax.sip.ResponseEventExt; | 11 | import gov.nist.javax.sip.ResponseEventExt; |
| 12 | +import org.slf4j.Logger; | ||
| 13 | +import org.slf4j.LoggerFactory; | ||
| 12 | import org.springframework.stereotype.Component; | 14 | import org.springframework.stereotype.Component; |
| 13 | 15 | ||
| 14 | import com.genersoft.iot.vmp.conf.SipConfig; | 16 | import com.genersoft.iot.vmp.conf.SipConfig; |
| @@ -24,7 +26,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.response.ISIPResponseProcessor; | @@ -24,7 +26,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.response.ISIPResponseProcessor; | ||
| 24 | @Component | 26 | @Component |
| 25 | public class InviteResponseProcessor implements ISIPResponseProcessor { | 27 | public class InviteResponseProcessor implements ISIPResponseProcessor { |
| 26 | 28 | ||
| 27 | - // private final static Logger logger = LoggerFactory.getLogger(InviteResponseProcessor.class); | 29 | + private final static Logger logger = LoggerFactory.getLogger(InviteResponseProcessor.class); |
| 28 | 30 | ||
| 29 | /** | 31 | /** |
| 30 | * 处理invite响应 | 32 | * 处理invite响应 |
| @@ -51,7 +53,7 @@ public class InviteResponseProcessor implements ISIPResponseProcessor { | @@ -51,7 +53,7 @@ public class InviteResponseProcessor implements ISIPResponseProcessor { | ||
| 51 | requestURI.setHost(event.getRemoteIpAddress()); | 53 | requestURI.setHost(event.getRemoteIpAddress()); |
| 52 | requestURI.setPort(event.getRemotePort()); | 54 | requestURI.setPort(event.getRemotePort()); |
| 53 | reqAck.setRequestURI(requestURI); | 55 | reqAck.setRequestURI(requestURI); |
| 54 | - System.out.println("向 " + event.getRemoteIpAddress() + ":" + event.getRemotePort() + "回复ack"); | 56 | + logger.info("向 " + event.getRemoteIpAddress() + ":" + event.getRemotePort() + "回复ack"); |
| 55 | dialog.sendAck(reqAck); | 57 | dialog.sendAck(reqAck); |
| 56 | } | 58 | } |
| 57 | } catch (InvalidArgumentException | SipException e) { | 59 | } catch (InvalidArgumentException | SipException e) { |
src/main/java/com/genersoft/iot/vmp/gb28181/utils/NumericUtil.java
| 1 | package com.genersoft.iot.vmp.gb28181.utils; | 1 | package com.genersoft.iot.vmp.gb28181.utils; |
| 2 | 2 | ||
| 3 | +import org.slf4j.Logger; | ||
| 4 | +import org.slf4j.LoggerFactory; | ||
| 5 | + | ||
| 3 | /** | 6 | /** |
| 4 | * 数值格式判断和处理 | 7 | * 数值格式判断和处理 |
| 5 | * @author lawrencehj | 8 | * @author lawrencehj |
| @@ -7,6 +10,8 @@ package com.genersoft.iot.vmp.gb28181.utils; | @@ -7,6 +10,8 @@ package com.genersoft.iot.vmp.gb28181.utils; | ||
| 7 | */ | 10 | */ |
| 8 | public class NumericUtil { | 11 | public class NumericUtil { |
| 9 | 12 | ||
| 13 | + private static Logger logger = LoggerFactory.getLogger(NumericUtil.class); | ||
| 14 | + | ||
| 10 | /** | 15 | /** |
| 11 | * 判断是否Double格式 | 16 | * 判断是否Double格式 |
| 12 | * @param str | 17 | * @param str |
| @@ -14,11 +19,11 @@ public class NumericUtil { | @@ -14,11 +19,11 @@ public class NumericUtil { | ||
| 14 | */ | 19 | */ |
| 15 | public static boolean isDouble(String str) { | 20 | public static boolean isDouble(String str) { |
| 16 | try { | 21 | try { |
| 17 | - Double num2 = Double.valueOf(str); | ||
| 18 | - System.out.println(num2 + " is a valid numeric string!"); | 22 | + Double num2 = Double.valueOf(str); |
| 23 | + logger.debug(num2 + " is a valid numeric string!"); | ||
| 19 | return true; | 24 | return true; |
| 20 | } catch (Exception e) { | 25 | } catch (Exception e) { |
| 21 | - System.out.println(str + " is an invalid numeric string!"); | 26 | + logger.debug(str + " is an invalid numeric string!"); |
| 22 | return false; | 27 | return false; |
| 23 | } | 28 | } |
| 24 | } | 29 | } |
| @@ -31,10 +36,10 @@ public class NumericUtil { | @@ -31,10 +36,10 @@ public class NumericUtil { | ||
| 31 | public static boolean isInteger(String str) { | 36 | public static boolean isInteger(String str) { |
| 32 | try { | 37 | try { |
| 33 | int num2 = Integer.valueOf(str); | 38 | int num2 = Integer.valueOf(str); |
| 34 | - System.out.println(num2 + " is an integer!"); | 39 | + logger.debug(num2 + " is an integer!"); |
| 35 | return true; | 40 | return true; |
| 36 | } catch (Exception e) { | 41 | } catch (Exception e) { |
| 37 | - System.out.println(str + " is not an integer!"); | 42 | + logger.debug(str + " is not an integer!"); |
| 38 | return false; | 43 | return false; |
| 39 | } | 44 | } |
| 40 | } | 45 | } |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
| @@ -251,7 +251,7 @@ public class ZLMHttpHookListener { | @@ -251,7 +251,7 @@ public class ZLMHttpHookListener { | ||
| 251 | JSONArray tracks = json.getJSONArray("tracks"); | 251 | JSONArray tracks = json.getJSONArray("tracks"); |
| 252 | boolean regist = json.getBoolean("regist"); | 252 | boolean regist = json.getBoolean("regist"); |
| 253 | if (tracks != null) { | 253 | if (tracks != null) { |
| 254 | - System.out.println("on_stream_changed->>" + schema); | 254 | + logger.info("[stream: " + streamId + "]on_stream_changed->>" + schema); |
| 255 | } | 255 | } |
| 256 | if ("rtmp".equals(schema)){ | 256 | if ("rtmp".equals(schema)){ |
| 257 | if ("rtp".equals(app) && !regist ) { | 257 | if ("rtp".equals(app) && !regist ) { |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java
| @@ -71,7 +71,6 @@ public class ZLMMediaListManager { | @@ -71,7 +71,6 @@ public class ZLMMediaListManager { | ||
| 71 | jsonObject.put("app", streamPushItem.getApp()); | 71 | jsonObject.put("app", streamPushItem.getApp()); |
| 72 | jsonObject.put("stream", streamPushItem.getStream()); | 72 | jsonObject.put("stream", streamPushItem.getStream()); |
| 73 | subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_play,jsonObject,(response)->{ | 73 | subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_play,jsonObject,(response)->{ |
| 74 | - System.out.println(1222211111); | ||
| 75 | updateMedia(response.getString("app"), response.getString("stream")); | 74 | updateMedia(response.getString("app"), response.getString("stream")); |
| 76 | }); | 75 | }); |
| 77 | } | 76 | } |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java
| @@ -131,8 +131,8 @@ public class ZLMRESTfulUtils { | @@ -131,8 +131,8 @@ public class ZLMRESTfulUtils { | ||
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | public JSONObject addFFmpegSource(String src_url, String dst_url, String timeout_ms){ | 133 | public JSONObject addFFmpegSource(String src_url, String dst_url, String timeout_ms){ |
| 134 | - System.out.println(src_url); | ||
| 135 | - System.out.println(dst_url); | 134 | + logger.info(src_url); |
| 135 | + logger.info(dst_url); | ||
| 136 | Map<String, Object> param = new HashMap<>(); | 136 | Map<String, Object> param = new HashMap<>(); |
| 137 | param.put("src_url", src_url); | 137 | param.put("src_url", src_url); |
| 138 | param.put("dst_url", dst_url); | 138 | param.put("dst_url", dst_url); |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java
| @@ -189,7 +189,7 @@ public class ZLMRTPServerFactory { | @@ -189,7 +189,7 @@ public class ZLMRTPServerFactory { | ||
| 189 | public Boolean startSendRtpStream(Map<String, Object>param) { | 189 | public Boolean startSendRtpStream(Map<String, Object>param) { |
| 190 | Boolean result = false; | 190 | Boolean result = false; |
| 191 | JSONObject jsonObject = zlmresTfulUtils.startSendRtp(param); | 191 | JSONObject jsonObject = zlmresTfulUtils.startSendRtp(param); |
| 192 | - System.out.println(jsonObject); | 192 | + logger.info(jsonObject.toJSONString()); |
| 193 | if (jsonObject == null) { | 193 | if (jsonObject == null) { |
| 194 | logger.error("RTP推流失败: 请检查ZLM服务"); | 194 | logger.error("RTP推流失败: 请检查ZLM服务"); |
| 195 | } else if (jsonObject.getInteger("code") == 0) { | 195 | } else if (jsonObject.getInteger("code") == 0) { |
| @@ -233,7 +233,7 @@ public class ZLMRTPServerFactory { | @@ -233,7 +233,7 @@ public class ZLMRTPServerFactory { | ||
| 233 | public Boolean stopSendRtpStream(Map<String, Object>param) { | 233 | public Boolean stopSendRtpStream(Map<String, Object>param) { |
| 234 | Boolean result = false; | 234 | Boolean result = false; |
| 235 | JSONObject jsonObject = zlmresTfulUtils.stopSendRtp(param); | 235 | JSONObject jsonObject = zlmresTfulUtils.stopSendRtp(param); |
| 236 | - System.out.println(jsonObject); | 236 | + logger.info(jsonObject.toJSONString()); |
| 237 | if (jsonObject == null) { | 237 | if (jsonObject == null) { |
| 238 | logger.error("停止RTP推流失败: 请检查ZLM服务"); | 238 | logger.error("停止RTP推流失败: 请检查ZLM服务"); |
| 239 | } else if (jsonObject.getInteger("code") == 0) { | 239 | } else if (jsonObject.getInteger("code") == 0) { |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java
| @@ -154,11 +154,11 @@ public class ZLMRunner implements CommandLineRunner { | @@ -154,11 +154,11 @@ public class ZLMRunner implements CommandLineRunner { | ||
| 154 | * zlm 连接成功或者zlm重启后 | 154 | * zlm 连接成功或者zlm重启后 |
| 155 | */ | 155 | */ |
| 156 | private void zLmRunning(MediaServerConfig mediaServerConfig){ | 156 | private void zLmRunning(MediaServerConfig mediaServerConfig){ |
| 157 | - logger.info("zlm接入成功..."); | 157 | + logger.info( "[ id: " + mediaServerConfig.getGeneralMediaServerId() + "] zlm接入成功..."); |
| 158 | if (autoConfig) saveZLMConfig(); | 158 | if (autoConfig) saveZLMConfig(); |
| 159 | MediaServerConfig mediaInfo = redisCatchStorage.getMediaInfo(); | 159 | MediaServerConfig mediaInfo = redisCatchStorage.getMediaInfo(); |
| 160 | if (mediaInfo != null && System.currentTimeMillis() - mediaInfo.getUpdateTime() < 50){ | 160 | if (mediaInfo != null && System.currentTimeMillis() - mediaInfo.getUpdateTime() < 50){ |
| 161 | - logger.info("zlm刚刚更新,忽略这次更新"); | 161 | + logger.info("[ id: " + mediaServerConfig.getGeneralMediaServerId() + "]zlm刚刚更新,忽略这次更新"); |
| 162 | return; | 162 | return; |
| 163 | } | 163 | } |
| 164 | mediaServerConfig.setLocalIP(mediaIp); | 164 | mediaServerConfig.setLocalIP(mediaIp); |
src/main/java/com/genersoft/iot/vmp/onvif/impl/ONVIFServerIMpl.java
| @@ -43,7 +43,7 @@ public class ONVIFServerIMpl implements IONVIFServer { | @@ -43,7 +43,7 @@ public class ONVIFServerIMpl implements IONVIFServer { | ||
| 43 | public void onDevicesFound(List<Device> devices) { | 43 | public void onDevicesFound(List<Device> devices) { |
| 44 | if (devices == null || devices.size() == 0) return; | 44 | if (devices == null || devices.size() == 0) return; |
| 45 | for (Device device : devices){ | 45 | for (Device device : devices){ |
| 46 | - System.out.println(device.getHostName()); | 46 | + logger.info(device.getHostName()); |
| 47 | deviceMap.put(device.getHostName(), device); | 47 | deviceMap.put(device.getHostName(), device); |
| 48 | } | 48 | } |
| 49 | } | 49 | } |
| @@ -53,7 +53,7 @@ public class ONVIFServerIMpl implements IONVIFServer { | @@ -53,7 +53,7 @@ public class ONVIFServerIMpl implements IONVIFServer { | ||
| 53 | public void onDiscoveryFinished() { | 53 | public void onDiscoveryFinished() { |
| 54 | ArrayList<String> result = new ArrayList<>(); | 54 | ArrayList<String> result = new ArrayList<>(); |
| 55 | for (Device device : deviceMap.values()) { | 55 | for (Device device : deviceMap.values()) { |
| 56 | - System.out.println(device.getHostName()); | 56 | + logger.info(device.getHostName()); |
| 57 | result.add(device.getHostName()); | 57 | result.add(device.getHostName()); |
| 58 | } | 58 | } |
| 59 | callBack.run(0, result); | 59 | callBack.run(0, result); |
| @@ -71,14 +71,14 @@ public class ONVIFServerIMpl implements IONVIFServer { | @@ -71,14 +71,14 @@ public class ONVIFServerIMpl implements IONVIFServer { | ||
| 71 | 71 | ||
| 72 | @Override | 72 | @Override |
| 73 | public void onResponse(OnvifDevice onvifDevice, OnvifResponse response) { | 73 | public void onResponse(OnvifDevice onvifDevice, OnvifResponse response) { |
| 74 | - System.out.println("[RESPONSE] " + onvifDevice.getHostName() | 74 | + logger.info("[RESPONSE] " + onvifDevice.getHostName() |
| 75 | + "======" + response.getErrorCode() | 75 | + "======" + response.getErrorCode() |
| 76 | + "======" + response.getErrorMessage()); | 76 | + "======" + response.getErrorMessage()); |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | @Override | 79 | @Override |
| 80 | public void onError(OnvifDevice onvifDevice, int errorCode, String errorMessage) { | 80 | public void onError(OnvifDevice onvifDevice, int errorCode, String errorMessage) { |
| 81 | - System.out.println("[ERROR] " + onvifDevice.getHostName() + "======" + errorCode + "=======" + errorMessage); | 81 | + logger.info("[ERROR] " + onvifDevice.getHostName() + "======" + errorCode + "=======" + errorMessage); |
| 82 | callBack.run(errorCode, errorMessage); | 82 | callBack.run(errorCode, errorMessage); |
| 83 | } | 83 | } |
| 84 | }); | 84 | }); |
| @@ -91,8 +91,8 @@ public class ONVIFServerIMpl implements IONVIFServer { | @@ -91,8 +91,8 @@ public class ONVIFServerIMpl implements IONVIFServer { | ||
| 91 | @Override | 91 | @Override |
| 92 | public void onMediaProfilesReceived(OnvifDevice device, List<OnvifMediaProfile> mediaProfiles) { | 92 | public void onMediaProfilesReceived(OnvifDevice device, List<OnvifMediaProfile> mediaProfiles) { |
| 93 | for (OnvifMediaProfile mediaProfile : mediaProfiles) { | 93 | for (OnvifMediaProfile mediaProfile : mediaProfiles) { |
| 94 | - System.out.println(mediaProfile.getName()); | ||
| 95 | - System.out.println(mediaProfile.getToken()); | 94 | + logger.info(mediaProfile.getName()); |
| 95 | + logger.info(mediaProfile.getToken()); | ||
| 96 | if (mediaProfile.getName().equals("mainStream")) { | 96 | if (mediaProfile.getName().equals("mainStream")) { |
| 97 | onvifManager.getMediaStreamURI(device, mediaProfile, (OnvifDevice onvifDevice, | 97 | onvifManager.getMediaStreamURI(device, mediaProfile, (OnvifDevice onvifDevice, |
| 98 | OnvifMediaProfile profile, String uri) -> { | 98 | OnvifMediaProfile profile, String uri) -> { |
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
| @@ -12,6 +12,8 @@ import com.genersoft.iot.vmp.storager.dao.*; | @@ -12,6 +12,8 @@ import com.genersoft.iot.vmp.storager.dao.*; | ||
| 12 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; | 12 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; |
| 13 | import com.github.pagehelper.PageHelper; | 13 | import com.github.pagehelper.PageHelper; |
| 14 | import com.github.pagehelper.PageInfo; | 14 | import com.github.pagehelper.PageInfo; |
| 15 | +import org.slf4j.Logger; | ||
| 16 | +import org.slf4j.LoggerFactory; | ||
| 15 | import org.springframework.beans.factory.annotation.Autowired; | 17 | import org.springframework.beans.factory.annotation.Autowired; |
| 16 | import org.springframework.jdbc.datasource.DataSourceTransactionManager; | 18 | import org.springframework.jdbc.datasource.DataSourceTransactionManager; |
| 17 | import org.springframework.stereotype.Component; | 19 | import org.springframework.stereotype.Component; |
| @@ -29,6 +31,9 @@ import org.springframework.transaction.annotation.Transactional; | @@ -29,6 +31,9 @@ import org.springframework.transaction.annotation.Transactional; | ||
| 29 | @SuppressWarnings("rawtypes") | 31 | @SuppressWarnings("rawtypes") |
| 30 | @Component | 32 | @Component |
| 31 | public class VideoManagerStoragerImpl implements IVideoManagerStorager { | 33 | public class VideoManagerStoragerImpl implements IVideoManagerStorager { |
| 34 | + | ||
| 35 | + private Logger logger = LoggerFactory.getLogger(VideoManagerStoragerImpl.class); | ||
| 36 | + | ||
| 32 | @Autowired | 37 | @Autowired |
| 33 | DataSourceTransactionManager dataSourceTransactionManager; | 38 | DataSourceTransactionManager dataSourceTransactionManager; |
| 34 | 39 | ||
| @@ -232,7 +237,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | @@ -232,7 +237,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | ||
| 232 | return false; | 237 | return false; |
| 233 | } | 238 | } |
| 234 | device.setOnline(1); | 239 | device.setOnline(1); |
| 235 | - System.out.println("更新设备在线"); | 240 | + logger.info("更新设备在线: " + deviceId); |
| 236 | return deviceMapper.update(device) > 0; | 241 | return deviceMapper.update(device) > 0; |
| 237 | } | 242 | } |
| 238 | 243 | ||
| @@ -244,7 +249,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | @@ -244,7 +249,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | ||
| 244 | */ | 249 | */ |
| 245 | @Override | 250 | @Override |
| 246 | public synchronized boolean outline(String deviceId) { | 251 | public synchronized boolean outline(String deviceId) { |
| 247 | - System.out.println("更新设备离线: " + deviceId); | 252 | + logger.info("更新设备离线: " + deviceId); |
| 248 | Device device = deviceMapper.getDeviceByDeviceId(deviceId); | 253 | Device device = deviceMapper.getDeviceByDeviceId(deviceId); |
| 249 | if (device == null) return false; | 254 | if (device == null) return false; |
| 250 | device.setOnline(0); | 255 | device.setOnline(0); |
| @@ -540,7 +545,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | @@ -540,7 +545,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | ||
| 540 | @Override | 545 | @Override |
| 541 | public void updateMediaList(List<StreamPushItem> streamPushItems) { | 546 | public void updateMediaList(List<StreamPushItem> streamPushItems) { |
| 542 | if (streamPushItems == null || streamPushItems.size() == 0) return; | 547 | if (streamPushItems == null || streamPushItems.size() == 0) return; |
| 543 | - System.out.printf("updateMediaList: " + streamPushItems.size()); | 548 | + logger.info("updateMediaList: " + streamPushItems.size()); |
| 544 | streamPushMapper.addAll(streamPushItems); | 549 | streamPushMapper.addAll(streamPushItems); |
| 545 | // TODO 待优化 | 550 | // TODO 待优化 |
| 546 | for (int i = 0; i < streamPushItems.size(); i++) { | 551 | for (int i = 0; i < streamPushItems.size(); i++) { |
src/main/java/com/genersoft/iot/vmp/utils/GpsUtil.java
| @@ -7,9 +7,16 @@ import java.net.Socket; | @@ -7,9 +7,16 @@ import java.net.Socket; | ||
| 7 | import java.util.Base64; | 7 | import java.util.Base64; |
| 8 | 8 | ||
| 9 | import com.genersoft.iot.vmp.gb28181.bean.BaiduPoint; | 9 | import com.genersoft.iot.vmp.gb28181.bean.BaiduPoint; |
| 10 | +import org.slf4j.Logger; | ||
| 11 | +import org.slf4j.LoggerFactory; | ||
| 10 | 12 | ||
| 11 | public class GpsUtil { | 13 | public class GpsUtil { |
| 14 | + | ||
| 15 | + private static Logger logger = LoggerFactory.getLogger(GpsUtil.class); | ||
| 16 | + | ||
| 12 | public static BaiduPoint Wgs84ToBd09(String xx, String yy) { | 17 | public static BaiduPoint Wgs84ToBd09(String xx, String yy) { |
| 18 | + | ||
| 19 | + | ||
| 13 | try { | 20 | try { |
| 14 | Socket s = new Socket("api.map.baidu.com", 80); | 21 | Socket s = new Socket("api.map.baidu.com", 80); |
| 15 | BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream(), "UTF-8")); | 22 | BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream(), "UTF-8")); |
| @@ -26,7 +33,7 @@ public class GpsUtil { | @@ -26,7 +33,7 @@ public class GpsUtil { | ||
| 26 | String json = ""; | 33 | String json = ""; |
| 27 | String tmp = ""; | 34 | String tmp = ""; |
| 28 | while ((tmp = br.readLine()) != null) { | 35 | while ((tmp = br.readLine()) != null) { |
| 29 | - // System.out.println(tmp); | 36 | + // logger.info(tmp); |
| 30 | json += tmp; | 37 | json += tmp; |
| 31 | } | 38 | } |
| 32 | 39 | ||
| @@ -44,7 +51,7 @@ public class GpsUtil { | @@ -44,7 +51,7 @@ public class GpsUtil { | ||
| 44 | return bdPoint; | 51 | return bdPoint; |
| 45 | //return (new String(decode(x)) + "," + new String(decode(y))); | 52 | //return (new String(decode(x)) + "," + new String(decode(y))); |
| 46 | } else { | 53 | } else { |
| 47 | - System.out.println("gps坐标无效!!"); | 54 | + logger.info("gps坐标无效!!"); |
| 48 | } | 55 | } |
| 49 | out.close(); | 56 | out.close(); |
| 50 | br.close(); | 57 | br.close(); |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
| @@ -167,7 +167,7 @@ public class PlayController { | @@ -167,7 +167,7 @@ public class PlayController { | ||
| 167 | streamId ); | 167 | streamId ); |
| 168 | String srcUrl = String.format("rtsp://%s:%s/rtp/%s", "127.0.0.1", mediaInfo.getRtspPort(), streamId); | 168 | String srcUrl = String.format("rtsp://%s:%s/rtp/%s", "127.0.0.1", mediaInfo.getRtspPort(), streamId); |
| 169 | JSONObject jsonObject = zlmresTfulUtils.addFFmpegSource(srcUrl, dstUrl, "1000000"); | 169 | JSONObject jsonObject = zlmresTfulUtils.addFFmpegSource(srcUrl, dstUrl, "1000000"); |
| 170 | - System.out.println(jsonObject); | 170 | + logger.info(jsonObject.toJSONString()); |
| 171 | JSONObject result = new JSONObject(); | 171 | JSONObject result = new JSONObject(); |
| 172 | if (jsonObject != null && jsonObject.getInteger("code") == 0) { | 172 | if (jsonObject != null && jsonObject.getInteger("code") == 0) { |
| 173 | result.put("code", 0); | 173 | result.put("code", 0); |
| @@ -198,7 +198,7 @@ public class PlayController { | @@ -198,7 +198,7 @@ public class PlayController { | ||
| 198 | public ResponseEntity<String> playConvertStop(@PathVariable String key) { | 198 | public ResponseEntity<String> playConvertStop(@PathVariable String key) { |
| 199 | 199 | ||
| 200 | JSONObject jsonObject = zlmresTfulUtils.delFFmpegSource(key); | 200 | JSONObject jsonObject = zlmresTfulUtils.delFFmpegSource(key); |
| 201 | - System.out.println(jsonObject); | 201 | + logger.info(jsonObject.toJSONString()); |
| 202 | JSONObject result = new JSONObject(); | 202 | JSONObject result = new JSONObject(); |
| 203 | if (jsonObject != null && jsonObject.getInteger("code") == 0) { | 203 | if (jsonObject != null && jsonObject.getInteger("code") == 0) { |
| 204 | result.put("code", 0); | 204 | result.put("code", 0); |