From 74c9e0400d0df8d7ba35f564ac8e2e1d82a340ce Mon Sep 17 00:00:00 2001 From: panlinlin <648540858@qq.com> Date: Mon, 11 Jan 2021 17:35:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=94=99=E8=AF=AF=E7=9A=84?= =?UTF-8?q?=E4=BD=BF=E7=94=A8stream=E4=BD=9C=E4=B8=BAssrc=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E7=9A=84=E6=97=A0=E6=B3=95stop=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../genersoft/iot/vmp/gb28181/SipLayer.java | 4 +++- .../transmit/cmd/impl/SIPCommander.java | 20 ++++--------------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java b/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java index e171297c..25a35a47 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java @@ -121,7 +121,9 @@ public class SipLayer implements SipListener { logger.debug(evt.getRequest().toString()); // 由于jainsip是单线程程序,为提高性能并发处理 processThreadPool.execute(() -> { - processorFactory.createRequestProcessor(evt).process(); + if (processorFactory != null) { + processorFactory.createRequestProcessor(evt).process(); + } }); } 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 d3aceb10..31fd7281 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 @@ -290,12 +290,8 @@ public class SIPCommander implements ISIPCommander { @Override public void playStreamCmd(Device device, String channelId, ZLMHttpHookSubscribe.Event event, SipSubscribe.Event errorEvent) { try { - String ssrc = ""; - if (rtpEnable) { - ssrc = String.format("gb_play_%s_%s", device.getDeviceId(), channelId); - }else { - ssrc = streamSession.createPlaySsrc(); - } + + String ssrc = streamSession.createPlaySsrc(); String streamId = null; if (rtpEnable) { streamId = String.format("gb_play_%s_%s", device.getDeviceId(), channelId); @@ -412,16 +408,8 @@ public class SIPCommander implements ISIPCommander { , SipSubscribe.Event errorEvent) { 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 ssrc = streamSession.createPlayBackSsrc(); + String streamId = String.format("%08x", Integer.parseInt(ssrc)).toUpperCase(); // 添加订阅 JSONObject subscribeKey = new JSONObject(); subscribeKey.put("app", "rtp");