From 872d336dedb501f83e403dfb43f590ce3bc5e4cb Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期一, 11 一月 2021 11:24:56 +0800 Subject: [PATCH] Merge pull request #29 from lawrencehj/wvp-28181-2.0 --- src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java | 52 ++++++++++++++++++++++++---------------------------- 1 files changed, 24 insertions(+), 28 deletions(-) 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 4a76e9a..d3aceb1 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 @@ /** * 浜戝彴鎸囦护鐮佽绠� * - * @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 @@ /** * 浜戝彴鎺у埗锛屾敮鎸佹柟鍚戜笌缂╂斁鎺у埗 * - * @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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ if (dialog == null) { return; } - - - Request byeRequest = dialog.createRequest(Request.BYE); SipURI byeURI = (SipURI) byeRequest.getRequestURI(); String vh = transaction.getRequest().getHeader(ViaHeader.NAME).toString(); -- Gitblit v1.8.0