From 845ce5331322b18f1514c476c86a0e352f79dde9 Mon Sep 17 00:00:00 2001 From: lovemen <50255147@qq.com> Date: Thu, 23 Feb 2023 15:35:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=B8=8A=E7=BA=A7=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E7=82=B9=E6=92=ADproxy=E4=BB=A3=E7=90=86=E6=B5=81?= =?UTF-8?q?=E6=97=B6=E6=9C=AA=E6=90=BA=E5=B8=A6SSRC=E4=BF=A1=E6=81=AF,gbSt?= =?UTF-8?q?ream=E9=87=87=E7=94=A8=E9=BB=98=E8=AE=A40000000000=E4=BD=9C?= =?UTF-8?q?=E4=B8=BASSRC=E6=97=A0=E6=B3=95=E6=92=AD=E6=94=BE=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E3=80=82=E4=BB=A5=E5=8F=8A=E4=B8=8A=E7=BA=A7=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E7=82=B9=E6=92=ADproxy=E4=BB=A3=E7=90=86=E6=B5=81?= =?UTF-8?q?=E6=97=B6=E5=9B=9E=E5=A4=8D=E7=9A=84SDP=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E7=AB=AF=E5=8F=A3=E5=8F=B7=E4=B8=BA0=E4=B8=8D=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../request/impl/InviteRequestProcessor.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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 81dd8d81..fd9e0c60 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 @@ -5,6 +5,7 @@ import com.genersoft.iot.vmp.conf.DynamicTask; import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.gb28181.bean.*; import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; +import com.genersoft.iot.vmp.gb28181.session.SsrcConfig; import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; import com.genersoft.iot.vmp.gb28181.transmit.SIPSender; @@ -492,6 +493,15 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements } } } else if (gbStream != null) { + if(ssrc.equals(ssrcDefault)) + { + SsrcConfig ssrcConfig = mediaServerItem.getSsrcConfig(); + if(ssrcConfig != null) + { + ssrc = ssrcConfig.getPlaySsrc(); + ssrcConfig.releaseSsrc(ssrc); + } + } if("push".equals(gbStream.getStreamType())) { if (streamPushItem != null && streamPushItem.isPushIng()) { // 推流状态 @@ -818,7 +828,13 @@ 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"); + // 非严格模式端口不统一, 增加兼容性,修改为一个不为0的端口 + int localPort = sendRtpItem.getLocalPort(); + if(localPort == 0) + { + localPort = new Random().nextInt(65535) + 1; + } + content.append("m=video " + localPort + " RTP/AVP 96\r\n"); content.append("a=sendonly\r\n"); content.append("a=rtpmap:96 PS/90000\r\n"); if (sendRtpItem.isTcp()) {