From 0858f7995b8236d79c6e39a5974cb7a13bcb4e3e Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期六, 08 四月 2023 15:22:18 +0800 Subject: [PATCH] 优化ssrc存储结构,避免因为大量ssrc存在MediaServer中导致redis读取超时 --- src/main/java/com/genersoft/iot/vmp/media/zlm/dto/MediaServerItem.java | 58 +++++++++++++--------------------------------------------- 1 files changed, 13 insertions(+), 45 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/MediaServerItem.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/MediaServerItem.java index 8f5d5af..ea248fd 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/MediaServerItem.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/MediaServerItem.java @@ -1,10 +1,10 @@ package com.genersoft.iot.vmp.media.zlm.dto; -import com.genersoft.iot.vmp.gb28181.session.SsrcConfig; +import com.genersoft.iot.vmp.gb28181.session.SSRCFactory; import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig; import io.swagger.v3.oas.annotations.media.Schema; -import org.springframework.util.StringUtils; +import org.springframework.util.ObjectUtils; import java.util.HashMap; @@ -53,11 +53,8 @@ @Schema(description = "ZLM閴存潈鍙傛暟") private String secret; - @Schema(description = "鏌愪釜娴佹棤浜鸿鐪嬫椂锛岃Е鍙慼ook.on_stream_none_reader浜嬩欢鐨勬渶澶х瓑寰呮椂闂达紝鍗曚綅姣") - private int streamNoneReaderDelayMS; - @Schema(description = "keepalive hook瑙﹀彂闂撮殧,鍗曚綅绉�") - private int hookAliveInterval; + private Float hookAliveInterval; @Schema(description = "鏄惁浣跨敤澶氱鍙fā寮�") private boolean rtpEnable; @@ -67,9 +64,6 @@ @Schema(description = "澶氱鍙TP鏀舵祦绔彛鑼冨洿") private String rtpPortRange; - - @Schema(description = "RTP鍙戞祦绔彛鑼冨洿") - private String sendRtpPortRange; @Schema(description = "assist鏈嶅姟绔彛") private int recordAssistPort; @@ -86,8 +80,8 @@ @Schema(description = "鏄惁鏄粯璁LM") private boolean defaultServer; - @Schema(description = "SSRC淇℃伅") - private SsrcConfig ssrcConfig; +// @Schema(description = "SSRC淇℃伅") +// private SsrcConfig ssrcConfig; @Schema(description = "褰撳墠浣跨敤鍒扮殑绔彛") private int currentPort; @@ -98,7 +92,7 @@ * 鍦ˋpplicationCheckRunner閲屽mediaServerSsrcMap杩涜鍒濆鍖� */ @Schema(description = "ID") - private HashMap<String, SsrcConfig> mediaServerSsrcMap; + private HashMap<String, SSRCFactory> mediaServerSsrcMap; public MediaServerItem() { } @@ -106,9 +100,9 @@ public MediaServerItem(ZLMServerConfig zlmServerConfig, String sipIp) { id = zlmServerConfig.getGeneralMediaServerId(); ip = zlmServerConfig.getIp(); - hookIp = StringUtils.isEmpty(zlmServerConfig.getHookIp())? sipIp: zlmServerConfig.getHookIp(); - sdpIp = StringUtils.isEmpty(zlmServerConfig.getSdpIp())? zlmServerConfig.getIp(): zlmServerConfig.getSdpIp(); - streamIp = StringUtils.isEmpty(zlmServerConfig.getStreamIp())? zlmServerConfig.getIp(): zlmServerConfig.getStreamIp(); + hookIp = ObjectUtils.isEmpty(zlmServerConfig.getHookIp())? sipIp: zlmServerConfig.getHookIp(); + sdpIp = ObjectUtils.isEmpty(zlmServerConfig.getSdpIp())? zlmServerConfig.getIp(): zlmServerConfig.getSdpIp(); + streamIp = ObjectUtils.isEmpty(zlmServerConfig.getStreamIp())? zlmServerConfig.getIp(): zlmServerConfig.getStreamIp(); httpPort = zlmServerConfig.getHttpPort(); httpSSlPort = zlmServerConfig.getHttpSSLport(); rtmpPort = zlmServerConfig.getRtmpPort(); @@ -118,11 +112,9 @@ rtspSSLPort = zlmServerConfig.getRtspSSlport(); autoConfig = true; // 榛樿鍊紅rue; secret = zlmServerConfig.getApiSecret(); - streamNoneReaderDelayMS = zlmServerConfig.getGeneralStreamNoneReaderDelayMS(); hookAliveInterval = zlmServerConfig.getHookAliveInterval(); rtpEnable = false; // 榛樿浣跨敤鍗曠鍙�;鐩村埌鐢ㄦ埛鑷繁璁剧疆寮�鍚绔彛 rtpPortRange = zlmServerConfig.getPortRange().replace("_",","); // 榛樿浣跨敤30000,30500浣滀负绾ц仈鏃跺彂閫佹祦鐨勭鍙e彿 - sendRtpPortRange = "30000,30500"; // 榛樿浣跨敤30000,30500浣滀负绾ц仈鏃跺彂閫佹祦鐨勭鍙e彿 recordAssistPort = 0; // 榛樿鍏抽棴 } @@ -239,14 +231,6 @@ this.secret = secret; } - public int getStreamNoneReaderDelayMS() { - return streamNoneReaderDelayMS; - } - - public void setStreamNoneReaderDelayMS(int streamNoneReaderDelayMS) { - this.streamNoneReaderDelayMS = streamNoneReaderDelayMS; - } - public boolean isRtpEnable() { return rtpEnable; } @@ -295,20 +279,12 @@ this.updateTime = updateTime; } - public HashMap<String, SsrcConfig> getMediaServerSsrcMap() { + public HashMap<String, SSRCFactory> getMediaServerSsrcMap() { return mediaServerSsrcMap; } - public void setMediaServerSsrcMap(HashMap<String, SsrcConfig> mediaServerSsrcMap) { + public void setMediaServerSsrcMap(HashMap<String, SSRCFactory> mediaServerSsrcMap) { this.mediaServerSsrcMap = mediaServerSsrcMap; - } - - public SsrcConfig getSsrcConfig() { - return ssrcConfig; - } - - public void setSsrcConfig(SsrcConfig ssrcConfig) { - this.ssrcConfig = ssrcConfig; } public int getCurrentPort() { @@ -335,19 +311,11 @@ this.lastKeepaliveTime = lastKeepaliveTime; } - public String getSendRtpPortRange() { - return sendRtpPortRange; - } - - public void setSendRtpPortRange(String sendRtpPortRange) { - this.sendRtpPortRange = sendRtpPortRange; - } - - public int getHookAliveInterval() { + public Float getHookAliveInterval() { return hookAliveInterval; } - public void setHookAliveInterval(int hookAliveInterval) { + public void setHookAliveInterval(Float hookAliveInterval) { this.hookAliveInterval = hookAliveInterval; } } -- Gitblit v1.8.0