diff --git a/pom.xml b/pom.xml index 2f45a6d4..b3acceac 100644 --- a/pom.xml +++ b/pom.xml @@ -131,7 +131,7 @@ jain-sip-ri 1.3.0-92 system - ${project.basedir}/libs/jain-sip-ri-1.3.0-92.jar + ${pom.basedir}/libs/jain-sip-ri-1.3.0-92.jar log4j @@ -141,7 +141,7 @@ - org.dom4j + org.dom4j dom4j 2.1.3 diff --git a/src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java b/src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java index e3a82ec1..990f003b 100644 --- a/src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java +++ b/src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java @@ -8,7 +8,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class VManageBootstrap extends LogManager { - public static void main(String[] args) { + public static void main(String[] args) { SpringApplication.run(VManageBootstrap.class, args); } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java index 4a76e9aa..d3aceb10 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java @@ -185,11 +185,11 @@ public class SIPCommander implements ISIPCommander { /** * 云台指令码计算 * - * @param cmdCode 指令码 - * @param parameter1 数据1 - * @param parameter2 数据2 - * @param combineCode2 组合码2 - */ + * @param cmdCode 指令码 + * @param parameter1 数据1 + * @param parameter2 数据2 + * @param combineCode2 组合码2 + */ public static String frontEndCmdString(int cmdCode, int parameter1, int parameter2, int combineCode2) { StringBuilder builder = new StringBuilder("A50F01"); String strTmp; @@ -211,13 +211,13 @@ public class SIPCommander implements ISIPCommander { /** * 云台控制,支持方向与缩放控制 * - * @param device 控制设备 - * @param channelId 预览通道 - * @param leftRight 镜头左移右移 0:停止 1:左移 2:右移 - * @param upDown 镜头上移下移 0:停止 1:上移 2:下移 - * @param inOut 镜头放大缩小 0:停止 1:缩小 2:放大 - * @param moveSpeed 镜头移动速度 - * @param zoomSpeed 镜头缩放速度 + * @param device 控制设备 + * @param channelId 预览通道 + * @param leftRight 镜头左移右移 0:停止 1:左移 2:右移 + * @param upDown 镜头上移下移 0:停止 1:上移 2:下移 + * @param inOut 镜头放大缩小 0:停止 1:缩小 2:放大 + * @param moveSpeed 镜头移动速度 + * @param zoomSpeed 镜头缩放速度 */ @Override public boolean ptzCmd(Device device, String channelId, int leftRight, int upDown, int inOut, int moveSpeed, @@ -333,13 +333,14 @@ public class SIPCommander implements ISIPCommander { if (seniorSdp) { if("TCP-PASSIVE".equals(streamMode)) { - content.append("m=video "+ mediaPort +" TCP/RTP/AVP 126 125 99 34 98 97 96\r\n"); + content.append("m=video "+ mediaPort +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n"); }else if ("TCP-ACTIVE".equals(streamMode)) { - content.append("m=video "+ mediaPort +" TCP/RTP/AVP 126 125 99 34 98 97 96\r\n"); + content.append("m=video "+ mediaPort +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n"); }else if("UDP".equals(streamMode)) { - content.append("m=video "+ mediaPort +" RTP/AVP 126 125 99 34 98 97 96\r\n"); + content.append("m=video "+ mediaPort +" RTP/AVP 96 126 125 99 34 98 97\r\n"); } content.append("a=recvonly\r\n"); + content.append("a=rtpmap:96 PS/90000\r\n"); content.append("a=fmtp:126 profile-level-id=42e01e\r\n"); content.append("a=rtpmap:126 H264/90000\r\n"); content.append("a=rtpmap:125 H264S/90000\r\n"); @@ -348,7 +349,6 @@ public class SIPCommander implements ISIPCommander { content.append("a=fmtp:99 profile-level-id=3\r\n"); content.append("a=rtpmap:98 H264/90000\r\n"); content.append("a=rtpmap:97 MPEG4/90000\r\n"); - content.append("a=rtpmap:96 PS/90000\r\n"); if("TCP-PASSIVE".equals(streamMode)){ // tcp被动模式 content.append("a=setup:passive\r\n"); content.append("a=connection:new\r\n"); @@ -387,9 +387,6 @@ public class SIPCommander implements ISIPCommander { content.append("y="+ssrc+"\r\n");//ssrc -// String fromTag = UUID.randomUUID().toString(); -// Request request = headerProvider.createInviteRequest(device, channelId, content.toString(), null, fromTag, null, ssrc); - Request request = headerProvider.createInviteRequest(device, channelId, content.toString(), null, "live", null, ssrc); ClientTransaction transaction = transmitRequest(device, request, errorEvent); @@ -416,12 +413,15 @@ public class SIPCommander implements ISIPCommander { try { MediaServerConfig mediaInfo = redisCatchStorage.getMediaInfo(); String ssrc = null; + String streamId = null; if (rtpEnable) { ssrc = String.format("gb_playback_%s_%s", device.getDeviceId(), channelId); + streamId = ssrc; }else { ssrc = streamSession.createPlayBackSsrc(); + streamId = String.format("%08x", Integer.parseInt(ssrc)).toUpperCase(); } - String streamId = String.format("%08x", Integer.parseInt(ssrc)).toUpperCase(); + // 添加订阅 JSONObject subscribeKey = new JSONObject(); subscribeKey.put("app", "rtp"); @@ -429,7 +429,6 @@ public class SIPCommander implements ISIPCommander { subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_publish, subscribeKey, event); - // StringBuffer content = new StringBuffer(200); content.append("v=0\r\n"); content.append("o="+sipConfig.getSipId()+" 0 0 IN IP4 "+sipConfig.getSipIp()+"\r\n"); @@ -449,13 +448,14 @@ public class SIPCommander implements ISIPCommander { if (seniorSdp) { if("TCP-PASSIVE".equals(streamMode)) { - content.append("m=video "+ mediaPort +" TCP/RTP/AVP 126 125 99 34 98 97 96\r\n"); + content.append("m=video "+ mediaPort +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n"); }else if ("TCP-ACTIVE".equals(streamMode)) { - content.append("m=video "+ mediaPort +" TCP/RTP/AVP 126 125 99 34 98 97 96\r\n"); + content.append("m=video "+ mediaPort +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n"); }else if("UDP".equals(streamMode)) { - content.append("m=video "+ mediaPort +" RTP/AVP 126 125 99 34 98 97 96\r\n"); + content.append("m=video "+ mediaPort +" RTP/AVP 96 126 125 99 34 98 97\r\n"); } content.append("a=recvonly\r\n"); + content.append("a=rtpmap:96 PS/90000\r\n"); content.append("a=fmtp:126 profile-level-id=42e01e\r\n"); content.append("a=rtpmap:126 H264/90000\r\n"); content.append("a=rtpmap:125 H264S/90000\r\n"); @@ -464,7 +464,6 @@ public class SIPCommander implements ISIPCommander { content.append("a=fmtp:99 profile-level-id=3\r\n"); content.append("a=rtpmap:98 H264/90000\r\n"); content.append("a=rtpmap:97 MPEG4/90000\r\n"); - content.append("a=rtpmap:96 PS/90000\r\n"); if("TCP-PASSIVE".equals(streamMode)){ // tcp被动模式 content.append("a=setup:passive\r\n"); content.append("a=connection:new\r\n"); @@ -533,9 +532,6 @@ public class SIPCommander implements ISIPCommander { if (dialog == null) { return; } - - - Request byeRequest = dialog.createRequest(Request.BYE); SipURI byeURI = (SipURI) byeRequest.getRequestURI(); String vh = transaction.getRequest().getHeader(ViaHeader.NAME).toString(); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java index 9cb63c5e..3ed22b28 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java @@ -297,7 +297,7 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { device.setStreamMode("UDP"); } storager.updateDevice(device); - cmder.catalogQuery(device, null); + //cmder.catalogQuery(device, null); // 回复200 OK responseAck(evt); if (offLineDetector.isOnline(deviceId)) { diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java index 115cacb3..ff1a7e15 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java @@ -21,15 +21,6 @@ public interface DeviceChannelMapper { "'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status})") int add(DeviceChannel channel); -// @Update("UPDATE device_channel " + -// "SET name=#{name}, manufacture=#{manufacture}, model=#{model}, owner=#{owner}, civilCode=#{civilCode}, " + -// "block=#{block}, address=#{address}, parental=#{parental}, parentId=#{parentId}, safetyWay=#{safetyWay}, " + -// "registerWay=#{registerWay}, certNum=#{certNum}, certifiable=#{certifiable}, errCode=#{errCode}, secrecy=#{secrecy}, " + -// "ipAddress=#{ipAddress}, port=#{port}, password=#{password}, PTZType=#{PTZType}, status=#{status}, streamId=#{streamId}, " + -// "hasAudio=#{hasAudio}" + -// "WHERE deviceId=#{deviceId} AND channelId=#{channelId}") - - @Update(value = {"