From e48fa711a3664bece9b3e58840a75fe7c05bc47c Mon Sep 17 00:00:00 2001 From: panlinlin <648540858@qq.com> Date: 星期六, 08 五月 2021 17:14:05 +0800 Subject: [PATCH] 添加截图(快照)功能 --- src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java | 27 ++++++++++++++++----------- 1 files changed, 16 insertions(+), 11 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 ffe91d2..63102b1 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 @@ -2,6 +2,7 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.genersoft.iot.vmp.conf.MediaConfig; import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; import com.genersoft.iot.vmp.gb28181.session.SsrcUtil; import org.slf4j.Logger; @@ -18,13 +19,13 @@ private Logger logger = LoggerFactory.getLogger("ZLMRTPServerFactory"); - @Value("${media.rtp.udpPortRange}") - private String udpPortRange; + @Autowired + private MediaConfig mediaConfig; @Autowired private ZLMRESTfulUtils zlmresTfulUtils; - private int[] udpPortRangeArray = new int[2]; + private int[] portRangeArray = new int[2]; private int currentPort = 0; @@ -52,7 +53,7 @@ Map<String, Object> param = new HashMap<>(); int result = -1; - int newPort = getPortFromUdpPortRange(); + int newPort = getPortFromportRange(); param.put("port", newPort); param.put("enable_tcp", 1); param.put("stream_id", streamId); @@ -101,16 +102,16 @@ return result; } - private int getPortFromUdpPortRange() { + private int getPortFromportRange() { if (currentPort == 0) { - String[] udpPortRangeStrArray = udpPortRange.split(","); - udpPortRangeArray[0] = Integer.parseInt(udpPortRangeStrArray[0]); - udpPortRangeArray[1] = Integer.parseInt(udpPortRangeStrArray[1]); + String[] portRangeStrArray = mediaConfig.getRtpPortRange().split(","); + portRangeArray[0] = Integer.parseInt(portRangeStrArray[0]); + portRangeArray[1] = Integer.parseInt(portRangeStrArray[1]); } - if (currentPort == 0 || currentPort++ > udpPortRangeArray[1]) { - currentPort = udpPortRangeArray[0]; - return udpPortRangeArray[0]; + if (currentPort == 0 || currentPort++ > portRangeArray[1]) { + currentPort = portRangeArray[0]; + return portRangeArray[0]; } else { if (currentPort % 2 == 1) { currentPort++; @@ -244,4 +245,8 @@ } return result; } + + public void closeAllSendRtpStream() { + + } } -- Gitblit v1.8.0