添加流IP单独配置
parent
c826081253
commit
57b562d622
|
@ -17,6 +17,9 @@ public class MediaConfig {
|
||||||
@Value("${media.sdpIp:${media.ip}}")
|
@Value("${media.sdpIp:${media.ip}}")
|
||||||
private String sdpIp;
|
private String sdpIp;
|
||||||
|
|
||||||
|
@Value("${media.streamIp:${media.ip}}")
|
||||||
|
private String streamIp;
|
||||||
|
|
||||||
@Value("${media.httpPort}")
|
@Value("${media.httpPort}")
|
||||||
private String httpPort;
|
private String httpPort;
|
||||||
|
|
||||||
|
@ -60,135 +63,67 @@ public class MediaConfig {
|
||||||
return ip;
|
return ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIp(String ip) {
|
|
||||||
this.ip = ip;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHookIp() {
|
public String getHookIp() {
|
||||||
return hookIp;
|
return hookIp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHookIp(String hookIp) {
|
public String getSdpIp() {
|
||||||
this.hookIp = hookIp;
|
return sdpIp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStreamIp() {
|
||||||
|
return streamIp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHttpPort() {
|
public String getHttpPort() {
|
||||||
return httpPort;
|
return httpPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHttpPort(String httpPort) {
|
|
||||||
this.httpPort = httpPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAutoConfig() {
|
|
||||||
return autoConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getAutoConfig() {
|
|
||||||
return autoConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAutoConfig(boolean autoConfig) {
|
|
||||||
this.autoConfig = autoConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSecret() {
|
|
||||||
return secret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSecret(String secret) {
|
|
||||||
this.secret = secret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStreamNoneReaderDelayMS() {
|
|
||||||
return streamNoneReaderDelayMS;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStreamNoneReaderDelayMS(String streamNoneReaderDelayMS) {
|
|
||||||
this.streamNoneReaderDelayMS = streamNoneReaderDelayMS;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isRtpEnable() {
|
|
||||||
return rtpEnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRtpEnable(boolean rtpEnable) {
|
|
||||||
this.rtpEnable = rtpEnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRtpPortRange() {
|
|
||||||
return rtpPortRange;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRtpPortRange(String rtpPortRange) {
|
|
||||||
this.rtpPortRange = rtpPortRange;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHttpSSlPort() {
|
public String getHttpSSlPort() {
|
||||||
return httpSSlPort;
|
return httpSSlPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHttpSSlPort(String httpSSlPort) {
|
|
||||||
this.httpSSlPort = httpSSlPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRtmpPort() {
|
public String getRtmpPort() {
|
||||||
return rtmpPort;
|
return rtmpPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRtmpPort(String rtmpPort) {
|
|
||||||
this.rtmpPort = rtmpPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRtmpSSlPort() {
|
public String getRtmpSSlPort() {
|
||||||
return rtmpSSlPort;
|
return rtmpSSlPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRtmpSSlPort(String rtmpSSlPort) {
|
|
||||||
this.rtmpSSlPort = rtmpSSlPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRtpProxyPort() {
|
public String getRtpProxyPort() {
|
||||||
return rtpProxyPort;
|
return rtpProxyPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRtpProxyPort(String rtpProxyPort) {
|
|
||||||
this.rtpProxyPort = rtpProxyPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRtspPort() {
|
public String getRtspPort() {
|
||||||
return rtspPort;
|
return rtspPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRtspPort(String rtspPort) {
|
|
||||||
this.rtspPort = rtspPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRtspSSLPort() {
|
public String getRtspSSLPort() {
|
||||||
return rtspSSLPort;
|
return rtspSSLPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRtspSSLPort(String rtspSSLPort) {
|
public boolean isAutoConfig() {
|
||||||
this.rtspSSLPort = rtspSSLPort;
|
return autoConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSecret() {
|
||||||
|
return secret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStreamNoneReaderDelayMS() {
|
||||||
|
return streamNoneReaderDelayMS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isRtpEnable() {
|
||||||
|
return rtpEnable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRtpPortRange() {
|
||||||
|
return rtpPortRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRecordAssistPort() {
|
public int getRecordAssistPort() {
|
||||||
return recordAssistPort;
|
return recordAssistPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRecordAssistPort(int recordAssistPort) {
|
|
||||||
this.recordAssistPort = recordAssistPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSdpIp() {
|
|
||||||
if (StringUtils.isEmpty(sdpIp)) {
|
|
||||||
return ip;
|
|
||||||
}else {
|
|
||||||
return sdpIp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSdpIp(String sdpIp) {
|
|
||||||
this.sdpIp = sdpIp;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@ import org.slf4j.LoggerFactory;
|
||||||
*/
|
*/
|
||||||
public class AckRequestProcessor extends SIPRequestAbstractProcessor {
|
public class AckRequestProcessor extends SIPRequestAbstractProcessor {
|
||||||
|
|
||||||
|
|
||||||
private Logger logger = LoggerFactory.getLogger(AckRequestProcessor.class);
|
private Logger logger = LoggerFactory.getLogger(AckRequestProcessor.class);
|
||||||
|
|
||||||
private IRedisCatchStorage redisCatchStorage;
|
private IRedisCatchStorage redisCatchStorage;
|
||||||
|
|
|
@ -20,10 +20,10 @@ public class NumericUtil {
|
||||||
public static boolean isDouble(String str) {
|
public static boolean isDouble(String str) {
|
||||||
try {
|
try {
|
||||||
Double num2 = Double.valueOf(str);
|
Double num2 = Double.valueOf(str);
|
||||||
logger.debug(num2 + " is a valid numeric string!");
|
// logger.debug(num2 + " is a valid numeric string!");
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.debug(str + " is an invalid numeric string!");
|
// logger.debug(str + " is an invalid numeric string!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,10 +36,10 @@ public class NumericUtil {
|
||||||
public static boolean isInteger(String str) {
|
public static boolean isInteger(String str) {
|
||||||
try {
|
try {
|
||||||
int num2 = Integer.valueOf(str);
|
int num2 = Integer.valueOf(str);
|
||||||
logger.debug(num2 + " is an integer!");
|
// logger.debug(num2 + " is an integer!");
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.debug(str + " is not an integer!");
|
// logger.debug(str + " is not an integer!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,6 @@ import com.alibaba.fastjson.JSONObject;
|
||||||
import com.genersoft.iot.vmp.conf.MediaConfig;
|
import com.genersoft.iot.vmp.conf.MediaConfig;
|
||||||
import com.genersoft.iot.vmp.conf.SipConfig;
|
import com.genersoft.iot.vmp.conf.SipConfig;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
|
||||||
//import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
|
||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
||||||
import com.genersoft.iot.vmp.service.IStreamProxyService;
|
import com.genersoft.iot.vmp.service.IStreamProxyService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -17,7 +15,6 @@ import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.CommandLineRunner;
|
import org.springframework.boot.CommandLineRunner;
|
||||||
import org.springframework.core.annotation.Order;
|
import org.springframework.core.annotation.Order;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -32,15 +29,9 @@ public class ZLMRunner implements CommandLineRunner {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IVideoManagerStorager storager;
|
private IVideoManagerStorager storager;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IRedisCatchStorage redisCatchStorage;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MediaConfig mediaConfig;
|
private MediaConfig mediaConfig;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SipConfig sipConfig;
|
|
||||||
|
|
||||||
@Value("${server.port}")
|
@Value("${server.port}")
|
||||||
private String serverPort;
|
private String serverPort;
|
||||||
|
|
||||||
|
@ -106,7 +97,6 @@ public class ZLMRunner implements CommandLineRunner {
|
||||||
|
|
||||||
private void saveZLMConfig() {
|
private void saveZLMConfig() {
|
||||||
logger.info("设置zlm...");
|
logger.info("设置zlm...");
|
||||||
if (StringUtils.isEmpty(mediaConfig.getHookIp())) mediaConfig.setHookIp(sipConfig.getSipIp());
|
|
||||||
String protocol = sslEnabled ? "https" : "http";
|
String protocol = sslEnabled ? "https" : "http";
|
||||||
String hookPrex = String.format("%s://%s:%s/index/hook", protocol, mediaConfig.getHookIp(), serverPort);
|
String hookPrex = String.format("%s://%s:%s/index/hook", protocol, mediaConfig.getHookIp(), serverPort);
|
||||||
String recordHookPrex = null;
|
String recordHookPrex = null;
|
||||||
|
@ -149,7 +139,7 @@ public class ZLMRunner implements CommandLineRunner {
|
||||||
logger.info( "[ id: " + zlmServerConfig.getGeneralMediaServerId() + "] zlm接入成功...");
|
logger.info( "[ id: " + zlmServerConfig.getGeneralMediaServerId() + "] zlm接入成功...");
|
||||||
// 关闭循环获取zlm配置
|
// 关闭循环获取zlm配置
|
||||||
startGetMedia = false;
|
startGetMedia = false;
|
||||||
if (mediaConfig.getAutoConfig()) saveZLMConfig();
|
if (mediaConfig.isAutoConfig()) saveZLMConfig();
|
||||||
zlmServerManger.updateServerCatch(zlmServerConfig);
|
zlmServerManger.updateServerCatch(zlmServerConfig);
|
||||||
|
|
||||||
// 清空所有session
|
// 清空所有session
|
||||||
|
|
|
@ -39,6 +39,8 @@ public class ZLMServerConfig {
|
||||||
|
|
||||||
private String sdpIp;
|
private String sdpIp;
|
||||||
|
|
||||||
|
private String streamIp;
|
||||||
|
|
||||||
private long updateTime;
|
private long updateTime;
|
||||||
|
|
||||||
@JSONField(name = "hls.fileBufSize")
|
@JSONField(name = "hls.fileBufSize")
|
||||||
|
@ -765,4 +767,12 @@ public class ZLMServerConfig {
|
||||||
public void setSdpIp(String sdpIp) {
|
public void setSdpIp(String sdpIp) {
|
||||||
this.sdpIp = sdpIp;
|
this.sdpIp = sdpIp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getStreamIp() {
|
||||||
|
return streamIp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStreamIp(String streamIp) {
|
||||||
|
this.streamIp = streamIp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ public class ZLMServerManger {
|
||||||
public void updateServerCatch(ZLMServerConfig zlmServerConfig) {
|
public void updateServerCatch(ZLMServerConfig zlmServerConfig) {
|
||||||
|
|
||||||
zlmServerConfig.setIp(mediaConfig.getIp());
|
zlmServerConfig.setIp(mediaConfig.getIp());
|
||||||
|
zlmServerConfig.setStreamIp(mediaConfig.getStreamIp());
|
||||||
zlmServerConfig.setSdpIp(mediaConfig.getSdpIp());
|
zlmServerConfig.setSdpIp(mediaConfig.getSdpIp());
|
||||||
zlmServerConfig.setHttpPort(mediaConfig.getHttpPort());
|
zlmServerConfig.setHttpPort(mediaConfig.getHttpPort());
|
||||||
|
|
||||||
|
|
|
@ -32,17 +32,17 @@ public class MediaServiceImpl implements IMediaService {
|
||||||
StreamInfo streamInfoResult = new StreamInfo();
|
StreamInfo streamInfoResult = new StreamInfo();
|
||||||
streamInfoResult.setStreamId(stream);
|
streamInfoResult.setStreamId(stream);
|
||||||
streamInfoResult.setApp(app);
|
streamInfoResult.setApp(app);
|
||||||
streamInfoResult.setRtmp(String.format("rtmp://%s:%s/%s/%s", mediaInfo.getIp(), mediaInfo.getRtmpPort(), app, stream));
|
streamInfoResult.setRtmp(String.format("rtmp://%s:%s/%s/%s", mediaInfo.getStreamIp(), mediaInfo.getRtmpPort(), app, stream));
|
||||||
streamInfoResult.setRtsp(String.format("rtsp://%s:%s/%s/%s", mediaInfo.getIp(), mediaInfo.getRtspPort(), app, stream));
|
streamInfoResult.setRtsp(String.format("rtsp://%s:%s/%s/%s", mediaInfo.getStreamIp(), mediaInfo.getRtspPort(), app, stream));
|
||||||
streamInfoResult.setFlv(String.format("http://%s:%s/%s/%s.flv", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream));
|
streamInfoResult.setFlv(String.format("http://%s:%s/%s/%s.flv", mediaInfo.getStreamIp(), mediaInfo.getHttpPort(), app, stream));
|
||||||
streamInfoResult.setWs_flv(String.format("ws://%s:%s/%s/%s.flv", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream));
|
streamInfoResult.setWs_flv(String.format("ws://%s:%s/%s/%s.flv", mediaInfo.getStreamIp(), mediaInfo.getHttpPort(), app, stream));
|
||||||
streamInfoResult.setHls(String.format("http://%s:%s/%s/%s/hls.m3u8", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream));
|
streamInfoResult.setHls(String.format("http://%s:%s/%s/%s/hls.m3u8", mediaInfo.getStreamIp(), mediaInfo.getHttpPort(), app, stream));
|
||||||
streamInfoResult.setWs_hls(String.format("ws://%s:%s/%s/%s/hls.m3u8", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream));
|
streamInfoResult.setWs_hls(String.format("ws://%s:%s/%s/%s/hls.m3u8", mediaInfo.getStreamIp(), mediaInfo.getHttpPort(), app, stream));
|
||||||
streamInfoResult.setFmp4(String.format("http://%s:%s/%s/%s.live.mp4", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream));
|
streamInfoResult.setFmp4(String.format("http://%s:%s/%s/%s.live.mp4", mediaInfo.getStreamIp(), mediaInfo.getHttpPort(), app, stream));
|
||||||
streamInfoResult.setWs_fmp4(String.format("ws://%s:%s/%s/%s.live.mp4", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream));
|
streamInfoResult.setWs_fmp4(String.format("ws://%s:%s/%s/%s.live.mp4", mediaInfo.getStreamIp(), mediaInfo.getHttpPort(), app, stream));
|
||||||
streamInfoResult.setTs(String.format("http://%s:%s/%s/%s.live.ts", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream));
|
streamInfoResult.setTs(String.format("http://%s:%s/%s/%s.live.ts", mediaInfo.getStreamIp(), mediaInfo.getHttpPort(), app, stream));
|
||||||
streamInfoResult.setWs_ts(String.format("ws://%s:%s/%s/%s.live.ts", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream));
|
streamInfoResult.setWs_ts(String.format("ws://%s:%s/%s/%s.live.ts", mediaInfo.getStreamIp(), mediaInfo.getHttpPort(), app, stream));
|
||||||
streamInfoResult.setRtc(String.format("http://%s:%s/index/api/webrtc?app=%s&stream=%s&type=play", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream));
|
streamInfoResult.setRtc(String.format("http://%s:%s/index/api/webrtc?app=%s&stream=%s&type=play", mediaInfo.getStreamIp(), mediaInfo.getHttpPort(), app, stream));
|
||||||
streamInfoResult.setTracks(tracks);
|
streamInfoResult.setTracks(tracks);
|
||||||
return streamInfoResult;
|
return streamInfoResult;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,10 +68,12 @@ sip:
|
||||||
# [可选] 心跳超时时间, 建议设置为心跳周期的三倍
|
# [可选] 心跳超时时间, 建议设置为心跳周期的三倍
|
||||||
keepaliveTimeOut: 180
|
keepaliveTimeOut: 180
|
||||||
|
|
||||||
#zlm服务器配置
|
#zlm 默认服务器配置
|
||||||
media:
|
media:
|
||||||
# [必须修改] zlm服务器的内网IP
|
# [必须修改] zlm服务器的内网IP
|
||||||
ip: 192.168.0.100
|
ip: 192.168.0.100
|
||||||
|
# [可选] 返回流地址时的ip,置空使用 media.ip
|
||||||
|
streamIp:
|
||||||
# [可选] wvp在国标信令中使用的ip,此ip为摄像机可以访问到的ip, 置空使用 media.ip
|
# [可选] wvp在国标信令中使用的ip,此ip为摄像机可以访问到的ip, 置空使用 media.ip
|
||||||
sdpIp:
|
sdpIp:
|
||||||
# [可选] zlm服务器的hook所使用的IP, 默认使用sip.ip
|
# [可选] zlm服务器的hook所使用的IP, 默认使用sip.ip
|
||||||
|
|
|
@ -42,7 +42,7 @@ sip:
|
||||||
# [可选] 默认设备认证密码,后续扩展使用设备单独密码, 移除密码将不进行校验
|
# [可选] 默认设备认证密码,后续扩展使用设备单独密码, 移除密码将不进行校验
|
||||||
password: admin123
|
password: admin123
|
||||||
|
|
||||||
#zlm服务器配置
|
#zlm 默认服务器配置
|
||||||
media:
|
media:
|
||||||
# [必须修改] zlm服务器的内网IP
|
# [必须修改] zlm服务器的内网IP
|
||||||
ip: 192.168.0.100
|
ip: 192.168.0.100
|
||||||
|
|
Loading…
Reference in New Issue