From 8f7e8efc981cf68a3067fb3421fdfbbf6f6275ab Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期二, 23 八月 2022 11:48:31 +0800 Subject: [PATCH] 合并主线 --- src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java | 24 ++++++++++++++++++------ 1 files changed, 18 insertions(+), 6 deletions(-) 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 1fe00e4..c9e2b34 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 @@ -9,6 +9,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.springframework.util.ObjectUtils; import org.springframework.util.StringUtils; import java.util.*; @@ -87,7 +88,7 @@ return result; } - public int createRTPServer(MediaServerItem mediaServerItem, String streamId, int ssrc) { + public int createRTPServer(MediaServerItem mediaServerItem, String streamId, int ssrc, Integer port) { int result = -1; // 鏌ヨ姝tp server 鏄惁宸茬粡瀛樺湪 JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(mediaServerItem, streamId); @@ -105,7 +106,11 @@ param.put("enable_tcp", 1); param.put("stream_id", streamId); // 鎺ㄦ祦绔彛璁剧疆0鍒欎娇鐢ㄩ殢鏈虹鍙� - param.put("port", 0); + if (port == null) { + param.put("port", 0); + }else { + param.put("port", port); + } param.put("ssrc", ssrc); JSONObject openRtpServerResultJson = zlmresTfulUtils.openRtpServer(mediaServerItem, param); @@ -183,7 +188,7 @@ // 浣跨敤RTPServer 鍔熻兘鎵句竴涓彲鐢ㄧ殑绔彛 String sendRtpPortRange = serverItem.getSendRtpPortRange(); - if (StringUtils.isEmpty(sendRtpPortRange)) { + if (ObjectUtils.isEmpty(sendRtpPortRange)) { return null; } String[] portRangeStrArray = serverItem.getSendRtpPortRange().split(","); @@ -225,7 +230,7 @@ public SendRtpItem createSendRtpItem(MediaServerItem serverItem, String ip, int port, String ssrc, String platformId, String app, String stream, String channelId, boolean tcp){ // 浣跨敤RTPServer 鍔熻兘鎵句竴涓彲鐢ㄧ殑绔彛 String sendRtpPortRange = serverItem.getSendRtpPortRange(); - if (StringUtils.isEmpty(sendRtpPortRange)) { + if (ObjectUtils.isEmpty(sendRtpPortRange)) { return null; } String[] portRangeStrArray = serverItem.getSendRtpPortRange().split(","); @@ -262,6 +267,13 @@ } /** + * 璋冪敤zlm RESTFUL API 鈥斺�� startSendRtpPassive + */ + public JSONObject startSendRtpPassive(MediaServerItem mediaServerItem, Map<String, Object>param) { + return zlmresTfulUtils.startSendRtpPassive(mediaServerItem, param); + } + + /** * 鏌ヨ寰呰浆鎺ㄧ殑娴佹槸鍚﹀氨缁� */ public Boolean isRtpReady(MediaServerItem mediaServerItem, String streamId) { @@ -290,11 +302,11 @@ return 0; } Integer code = mediaInfo.getInteger("code"); - if ( code < 0) { + if (code < 0) { logger.warn("鏌ヨ娴�({}/{})鏄惁鏈夊叾瀹冭鐪嬭�呮椂寰楀埌锛� {}", app, streamId, mediaInfo.getString("msg")); return -1; } - if ( code == 0 && mediaInfo.getBoolean("online") != null && !mediaInfo.getBoolean("online")) { + if ( code == 0 && mediaInfo.getBoolean("online") != null && ! mediaInfo.getBoolean("online")) { logger.warn("鏌ヨ娴�({}/{})鏄惁鏈夊叾瀹冭鐪嬭�呮椂寰楀埌锛� {}", app, streamId, mediaInfo.getString("msg")); return -1; } -- Gitblit v1.8.0