Browse Source

修复停止推流的参数组织方式

pull/446/head
648540858 3 years ago
parent
commit
81f1b8ee25
  1. 14
      src/main/java/com/genersoft/iot/vmp/gb28181/event/platformNotRegister/PlatformNotRegisterEventLister.java
  2. 5
      src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java
  3. 2
      src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java

14
src/main/java/com/genersoft/iot/vmp/gb28181/event/platformNotRegister/PlatformNotRegisterEventLister.java

@ -64,23 +64,13 @@ public class PlatformNotRegisterEventLister implements ApplicationListener<Platf
logger.info("[ 平台未注册事件 ] 停止[ {} ]的所有推流size", sendRtpItems.size()); logger.info("[ 平台未注册事件 ] 停止[ {} ]的所有推流size", sendRtpItems.size());
if (sendRtpItems != null && sendRtpItems.size() > 0) { if (sendRtpItems != null && sendRtpItems.size() > 0) {
logger.info("[ 平台未注册事件 ] 停止[ {} ]的所有推流", event.getPlatformGbID()); logger.info("[ 平台未注册事件 ] 停止[ {} ]的所有推流", event.getPlatformGbID());
StringBuilder app = new StringBuilder();
StringBuilder stream = new StringBuilder();
for (SendRtpItem sendRtpItem : sendRtpItems) { 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); redisCatchStorage.deleteSendRTPServer(event.getPlatformGbID(), sendRtpItem.getChannelId(), null, null);
MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId());
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
param.put("vhost", "__defaultVhost__"); param.put("vhost", "__defaultVhost__");
param.put("app", app.toString()); param.put("app", sendRtpItem.getApp());
param.put("stream", stream.toString()); param.put("stream", sendRtpItem.getStreamId());
zlmrtpServerFactory.stopSendRtpStream(mediaInfo, param); zlmrtpServerFactory.stopSendRtpStream(mediaInfo, param);
} }

5
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java

@ -269,6 +269,11 @@ public class ZLMRESTfulUtils {
param.put("url", url); param.put("url", url);
param.put("enable_hls", enable_hls?1:0); param.put("enable_hls", enable_hls?1:0);
param.put("enable_mp4", enable_mp4?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); param.put("rtp_type", rtp_type);
return sendPost(mediaServerItem, "addStreamProxy",param, null); return sendPost(mediaServerItem, "addStreamProxy",param, null);
} }

2
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java

@ -85,7 +85,7 @@ public class ZLMRTPServerFactory {
int result = -1; int result = -1;
// 查询此rtp server 是否已经存在 // 查询此rtp server 是否已经存在
JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(mediaServerItem, streamId); 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"); result = rtpInfo.getInteger("local_port");
return result; return result;
} }

Loading…
Cancel
Save