Commit 81f1b8ee25114452b3d8c86c6cbf8820f5689db3
1 parent
f10b458f
修复停止推流的参数组织方式
Showing
3 changed files
with
8 additions
and
13 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/event/platformNotRegister/PlatformNotRegisterEventLister.java
| @@ -64,23 +64,13 @@ public class PlatformNotRegisterEventLister implements ApplicationListener<Platf | @@ -64,23 +64,13 @@ public class PlatformNotRegisterEventLister implements ApplicationListener<Platf | ||
| 64 | logger.info("[ 平台未注册事件 ] 停止[ {} ]的所有推流size", sendRtpItems.size()); | 64 | logger.info("[ 平台未注册事件 ] 停止[ {} ]的所有推流size", sendRtpItems.size()); |
| 65 | if (sendRtpItems != null && sendRtpItems.size() > 0) { | 65 | if (sendRtpItems != null && sendRtpItems.size() > 0) { |
| 66 | logger.info("[ 平台未注册事件 ] 停止[ {} ]的所有推流", event.getPlatformGbID()); | 66 | logger.info("[ 平台未注册事件 ] 停止[ {} ]的所有推流", event.getPlatformGbID()); |
| 67 | - StringBuilder app = new StringBuilder(); | ||
| 68 | - StringBuilder stream = new StringBuilder(); | ||
| 69 | for (SendRtpItem sendRtpItem : sendRtpItems) { | 67 | for (SendRtpItem sendRtpItem : sendRtpItems) { |
| 70 | - if (app.length() != 0) { | ||
| 71 | - app.append(","); | ||
| 72 | - } | ||
| 73 | - app.append(sendRtpItem.getApp()); | ||
| 74 | - if (stream.length() != 0) { | ||
| 75 | - stream.append(","); | ||
| 76 | - } | ||
| 77 | - stream.append(sendRtpItem.getStreamId()); | ||
| 78 | redisCatchStorage.deleteSendRTPServer(event.getPlatformGbID(), sendRtpItem.getChannelId(), null, null); | 68 | redisCatchStorage.deleteSendRTPServer(event.getPlatformGbID(), sendRtpItem.getChannelId(), null, null); |
| 79 | MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); | 69 | MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); |
| 80 | Map<String, Object> param = new HashMap<>(); | 70 | Map<String, Object> param = new HashMap<>(); |
| 81 | param.put("vhost", "__defaultVhost__"); | 71 | param.put("vhost", "__defaultVhost__"); |
| 82 | - param.put("app", app.toString()); | ||
| 83 | - param.put("stream", stream.toString()); | 72 | + param.put("app", sendRtpItem.getApp()); |
| 73 | + param.put("stream", sendRtpItem.getStreamId()); | ||
| 84 | zlmrtpServerFactory.stopSendRtpStream(mediaInfo, param); | 74 | zlmrtpServerFactory.stopSendRtpStream(mediaInfo, param); |
| 85 | } | 75 | } |
| 86 | 76 |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java
| @@ -269,6 +269,11 @@ public class ZLMRESTfulUtils { | @@ -269,6 +269,11 @@ public class ZLMRESTfulUtils { | ||
| 269 | param.put("url", url); | 269 | param.put("url", url); |
| 270 | param.put("enable_hls", enable_hls?1:0); | 270 | param.put("enable_hls", enable_hls?1:0); |
| 271 | param.put("enable_mp4", enable_mp4?1:0); | 271 | param.put("enable_mp4", enable_mp4?1:0); |
| 272 | + param.put("enable_rtmp", 1); | ||
| 273 | + param.put("enable_fmp4", 1); | ||
| 274 | + param.put("enable_audio", 1); | ||
| 275 | + param.put("enable_rtsp", 1); | ||
| 276 | + param.put("add_mute_audio", 1); | ||
| 272 | param.put("rtp_type", rtp_type); | 277 | param.put("rtp_type", rtp_type); |
| 273 | return sendPost(mediaServerItem, "addStreamProxy",param, null); | 278 | return sendPost(mediaServerItem, "addStreamProxy",param, null); |
| 274 | } | 279 | } |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java
| @@ -85,7 +85,7 @@ public class ZLMRTPServerFactory { | @@ -85,7 +85,7 @@ public class ZLMRTPServerFactory { | ||
| 85 | int result = -1; | 85 | int result = -1; |
| 86 | // 查询此rtp server 是否已经存在 | 86 | // 查询此rtp server 是否已经存在 |
| 87 | JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(mediaServerItem, streamId); | 87 | JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(mediaServerItem, streamId); |
| 88 | - if (rtpInfo.getInteger("code ") == 0 && rtpInfo.getBoolean("exist")) { | 88 | + if (rtpInfo != null && rtpInfo.getInteger("code") == 0 && rtpInfo.getBoolean("exist")) { |
| 89 | result = rtpInfo.getInteger("local_port"); | 89 | result = rtpInfo.getInteger("local_port"); |
| 90 | return result; | 90 | return result; |
| 91 | } | 91 | } |