648540858
2023-07-17 5c49627012996aedb802b81e64c4776f9874f0a7
优化发流端口分配
1个文件已修改
13 ■■■■ 已修改文件
src/main/java/com/genersoft/iot/vmp/media/zlm/SendRtpPortManager.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/media/zlm/SendRtpPortManager.java
@@ -36,6 +36,13 @@
    }
    public int getNextPort(String mediaServerId) {
        String sendIndexKey = KEY + userSetting.getServerId() + "_" +  mediaServerId;
        MediaSendRtpPortInfo mediaSendRtpPortInfo = (MediaSendRtpPortInfo)redisTemplate.opsForValue().get(sendIndexKey);
        if (mediaSendRtpPortInfo == null) {
            logger.warn("[发送端口管理] 获取{}的发送端口时未找到端口信息", mediaSendRtpPortInfo);
            return 0;
        }
        String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX
                + userSetting.getServerId() + "_*";
        List<Object> queryResult = RedisUtil.scan(redisTemplate, key);
@@ -48,12 +55,6 @@
            }
        }
        String sendIndexKey = KEY + userSetting.getServerId() + "_" +  mediaServerId;
        MediaSendRtpPortInfo mediaSendRtpPortInfo = (MediaSendRtpPortInfo)redisTemplate.opsForValue().get(sendIndexKey);
        if (mediaSendRtpPortInfo == null) {
            logger.warn("[发送端口管理] 获取{}的发送端口时未找到端口信息", mediaSendRtpPortInfo);
            return 0;
        }
        int port = getPort(mediaSendRtpPortInfo.getCurrent(),
                mediaSendRtpPortInfo.getStart(),
                mediaSendRtpPortInfo.getEnd(), checkPort -> sendRtpItemMap.get(checkPort) == null);