From 81f1b8ee25114452b3d8c86c6cbf8820f5689db3 Mon Sep 17 00:00:00 2001 From: 648540858 <456panlinlin> Date: Fri, 8 Apr 2022 16:30:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=81=9C=E6=AD=A2=E6=8E=A8?= =?UTF-8?q?=E6=B5=81=E7=9A=84=E5=8F=82=E6=95=B0=E7=BB=84=E7=BB=87=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PlatformNotRegisterEventLister.java | 14 ++------------ .../iot/vmp/media/zlm/ZLMRESTfulUtils.java | 5 +++++ .../iot/vmp/media/zlm/ZLMRTPServerFactory.java | 2 +- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/platformNotRegister/PlatformNotRegisterEventLister.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/platformNotRegister/PlatformNotRegisterEventLister.java index 757c00a3c..3f76e8af7 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/event/platformNotRegister/PlatformNotRegisterEventLister.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/event/platformNotRegister/PlatformNotRegisterEventLister.java @@ -64,23 +64,13 @@ public class PlatformNotRegisterEventLister implements ApplicationListener 0) { logger.info("[ 平台未注册事件 ] 停止[ {} ]的所有推流", event.getPlatformGbID()); - StringBuilder app = new StringBuilder(); - StringBuilder stream = new StringBuilder(); for (SendRtpItem sendRtpItem : sendRtpItems) { - if (app.length() != 0) { - app.append(","); - } - app.append(sendRtpItem.getApp()); - if (stream.length() != 0) { - stream.append(","); - } - stream.append(sendRtpItem.getStreamId()); redisCatchStorage.deleteSendRTPServer(event.getPlatformGbID(), sendRtpItem.getChannelId(), null, null); MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); Map param = new HashMap<>(); param.put("vhost", "__defaultVhost__"); - param.put("app", app.toString()); - param.put("stream", stream.toString()); + param.put("app", sendRtpItem.getApp()); + param.put("stream", sendRtpItem.getStreamId()); zlmrtpServerFactory.stopSendRtpStream(mediaInfo, param); } diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java index d0b1cb2d8..4b2bf487a 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java @@ -269,6 +269,11 @@ public class ZLMRESTfulUtils { param.put("url", url); param.put("enable_hls", enable_hls?1:0); param.put("enable_mp4", enable_mp4?1:0); + param.put("enable_rtmp", 1); + param.put("enable_fmp4", 1); + param.put("enable_audio", 1); + param.put("enable_rtsp", 1); + param.put("add_mute_audio", 1); param.put("rtp_type", rtp_type); return sendPost(mediaServerItem, "addStreamProxy",param, null); } diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java index de9f17626..a36593e36 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java @@ -85,7 +85,7 @@ public class ZLMRTPServerFactory { int result = -1; // 查询此rtp server 是否已经存在 JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(mediaServerItem, streamId); - if (rtpInfo.getInteger("code ") == 0 && rtpInfo.getBoolean("exist")) { + if (rtpInfo != null && rtpInfo.getInteger("code") == 0 && rtpInfo.getBoolean("exist")) { result = rtpInfo.getInteger("local_port"); return result; }