From dc054dd2c9a4344aecba0005167c0d838b9e9a09 Mon Sep 17 00:00:00 2001 From: fajiao <1519100073@qq.com> Date: Wed, 25 May 2022 17:04:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B0=86=20rtp=20over=20tcp=20/=20activ?= =?UTF-8?q?e=20=E4=BF=AE=E6=94=B9=E4=B8=BA=20rtp=20over=20tcp=20/=20passiv?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../request/impl/InviteRequestProcessor.java | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java index 2723da47..3e39c0f6 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java @@ -210,14 +210,15 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements // 区分TCP发流还是udp, 当前默认udp if ("TCP/RTP/AVP".equals(protocol)) { + mediaTransmissionTCP = true; String setup = mediaDescription.getAttribute("setup"); if (setup != null) { - mediaTransmissionTCP = true; if ("active".equals(setup)) { - tcpActive = true; - // 不支持tcp主动 - responseAck(evt, Response.NOT_IMPLEMENTED, "tcp active not support"); // 目录不支持点播 - return; +// tcpActive = true; +// // 不支持tcp主动 +// responseAck(evt, Response.NOT_IMPLEMENTED, "tcp active not support"); // 目录不支持点播 +// return; + tcpActive = false; } else if ("passive".equals(setup)) { tcpActive = false; } @@ -290,7 +291,11 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements }else { content.append("t=0 0\r\n"); } - content.append("m=video "+ sendRtpItem.getLocalPort()+" RTP/AVP 96\r\n"); + if(sendRtpItem.isTcp()){ + content.append("m=video "+ sendRtpItem.getLocalPort()+" TCP/RTP/AVP 96\r\n"); + }else { + content.append("m=video "+ sendRtpItem.getLocalPort()+" RTP/AVP 96\r\n"); + } content.append("a=sendonly\r\n"); content.append("a=rtpmap:96 PS/90000\r\n"); content.append("y="+ ssrc + "\r\n"); @@ -516,12 +521,16 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements content.append("s=Play\r\n"); content.append("c=IN IP4 "+mediaServerItem.getSdpIp()+"\r\n"); content.append("t=0 0\r\n"); - content.append("m=video "+ sendRtpItem.getLocalPort()+" RTP/AVP 96\r\n"); + if(sendRtpItem.isTcp()){ + content.append("m=video "+ sendRtpItem.getLocalPort()+" TCP/RTP/AVP 96\r\n"); + }else { + content.append("m=video "+ sendRtpItem.getLocalPort()+" RTP/AVP 96\r\n"); + } content.append("a=sendonly\r\n"); content.append("a=rtpmap:96 PS/90000\r\n"); if (sendRtpItem.isTcp()) { content.append("a=connection:new\r\n"); - if (!sendRtpItem.isTcpActive()) { + if (sendRtpItem.isTcpActive()) { content.append("a=setup:active\r\n"); }else { content.append("a=setup:passive\r\n"); @@ -582,11 +591,11 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements String protocol = media.getProtocol(); // 区分TCP发流还是udp, 当前默认udp if ("TCP/RTP/AVP".equals(protocol)) { + mediaTransmissionTCP = true; String setup = mediaDescription.getAttribute("setup"); if (setup != null) { - mediaTransmissionTCP = true; if ("active".equals(setup)) { - tcpActive = true; + tcpActive = false; } else if ("passive".equals(setup)) { tcpActive = false; }