| | |
| | | @Value("${media.sdpIp:${media.ip}}") |
| | | private String sdpIp; |
| | | |
| | | @Value("${media.streamIp:${media.ip}}") |
| | | private String streamIp; |
| | | |
| | | @Value("${media.httpPort}") |
| | | private String httpPort; |
| | | |
| | |
| | | return ip; |
| | | } |
| | | |
| | | public void setIp(String ip) { |
| | | this.ip = ip; |
| | | } |
| | | |
| | | public String getHookIp() { |
| | | return hookIp; |
| | | } |
| | | |
| | | public void setHookIp(String hookIp) { |
| | | this.hookIp = hookIp; |
| | | public String getSdpIp() { |
| | | return sdpIp; |
| | | } |
| | | |
| | | public String getStreamIp() { |
| | | return streamIp; |
| | | } |
| | | |
| | | public String getHttpPort() { |
| | | 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() { |
| | | return httpSSlPort; |
| | | } |
| | | |
| | | public void setHttpSSlPort(String httpSSlPort) { |
| | | this.httpSSlPort = httpSSlPort; |
| | | } |
| | | |
| | | public String getRtmpPort() { |
| | | return rtmpPort; |
| | | } |
| | | |
| | | public void setRtmpPort(String rtmpPort) { |
| | | this.rtmpPort = rtmpPort; |
| | | } |
| | | |
| | | public String getRtmpSSlPort() { |
| | | return rtmpSSlPort; |
| | | } |
| | | |
| | | public void setRtmpSSlPort(String rtmpSSlPort) { |
| | | this.rtmpSSlPort = rtmpSSlPort; |
| | | } |
| | | |
| | | public String getRtpProxyPort() { |
| | | return rtpProxyPort; |
| | | } |
| | | |
| | | public void setRtpProxyPort(String rtpProxyPort) { |
| | | this.rtpProxyPort = rtpProxyPort; |
| | | } |
| | | |
| | | public String getRtspPort() { |
| | | return rtspPort; |
| | | } |
| | | |
| | | public void setRtspPort(String rtspPort) { |
| | | this.rtspPort = rtspPort; |
| | | } |
| | | |
| | | public String getRtspSSLPort() { |
| | | return rtspSSLPort; |
| | | } |
| | | |
| | | public void setRtspSSLPort(String rtspSSLPort) { |
| | | this.rtspSSLPort = rtspSSLPort; |
| | | public boolean isAutoConfig() { |
| | | 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() { |
| | | 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; |
| | | } |
| | | } |
| | |
| | | */
|
| | | public class AckRequestProcessor extends SIPRequestAbstractProcessor {
|
| | |
|
| | |
|
| | | private Logger logger = LoggerFactory.getLogger(AckRequestProcessor.class);
|
| | |
|
| | | private IRedisCatchStorage redisCatchStorage;
|
| | |
| | | public static boolean isDouble(String str) { |
| | | try { |
| | | Double num2 = Double.valueOf(str); |
| | | logger.debug(num2 + " is a valid numeric string!"); |
| | | // logger.debug(num2 + " is a valid numeric string!"); |
| | | return true; |
| | | } catch (Exception e) { |
| | | logger.debug(str + " is an invalid numeric string!"); |
| | | // logger.debug(str + " is an invalid numeric string!"); |
| | | return false; |
| | | } |
| | | } |
| | |
| | | public static boolean isInteger(String str) { |
| | | try { |
| | | int num2 = Integer.valueOf(str); |
| | | logger.debug(num2 + " is an integer!"); |
| | | // logger.debug(num2 + " is an integer!"); |
| | | return true; |
| | | } catch (Exception e) { |
| | | logger.debug(str + " is not an integer!"); |
| | | // logger.debug(str + " is not an integer!"); |
| | | return false; |
| | | } |
| | | } |
| | |
| | | import com.genersoft.iot.vmp.conf.MediaConfig; |
| | | import com.genersoft.iot.vmp.conf.SipConfig; |
| | | 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.service.IStreamProxyService; |
| | | import org.slf4j.Logger; |
| | |
| | | import org.springframework.boot.CommandLineRunner; |
| | | import org.springframework.core.annotation.Order; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | private IVideoManagerStorager storager; |
| | | |
| | | @Autowired |
| | | private IRedisCatchStorage redisCatchStorage; |
| | | |
| | | @Autowired |
| | | private MediaConfig mediaConfig; |
| | | |
| | | @Autowired |
| | | private SipConfig sipConfig; |
| | | |
| | | @Value("${server.port}") |
| | | private String serverPort; |
| | |
| | | |
| | | private void saveZLMConfig() { |
| | | logger.info("设置zlm..."); |
| | | if (StringUtils.isEmpty(mediaConfig.getHookIp())) mediaConfig.setHookIp(sipConfig.getSipIp()); |
| | | String protocol = sslEnabled ? "https" : "http"; |
| | | String hookPrex = String.format("%s://%s:%s/index/hook", protocol, mediaConfig.getHookIp(), serverPort); |
| | | String recordHookPrex = null; |
| | |
| | | logger.info( "[ id: " + zlmServerConfig.getGeneralMediaServerId() + "] zlm接入成功..."); |
| | | // 关闭循环获取zlm配置 |
| | | startGetMedia = false; |
| | | if (mediaConfig.getAutoConfig()) saveZLMConfig(); |
| | | if (mediaConfig.isAutoConfig()) saveZLMConfig(); |
| | | zlmServerManger.updateServerCatch(zlmServerConfig); |
| | | |
| | | // 清空所有session |
| | |
| | | |
| | | private String sdpIp; |
| | | |
| | | private String streamIp; |
| | | |
| | | private long updateTime; |
| | | |
| | | @JSONField(name = "hls.fileBufSize") |
| | |
| | | public void setSdpIp(String sdpIp) { |
| | | this.sdpIp = sdpIp; |
| | | } |
| | | |
| | | public String getStreamIp() { |
| | | return streamIp; |
| | | } |
| | | |
| | | public void setStreamIp(String streamIp) { |
| | | this.streamIp = streamIp; |
| | | } |
| | | } |
| | |
| | | public void updateServerCatch(ZLMServerConfig zlmServerConfig) { |
| | | |
| | | zlmServerConfig.setIp(mediaConfig.getIp()); |
| | | zlmServerConfig.setStreamIp(mediaConfig.getStreamIp()); |
| | | zlmServerConfig.setSdpIp(mediaConfig.getSdpIp()); |
| | | zlmServerConfig.setHttpPort(mediaConfig.getHttpPort()); |
| | | |
| | |
| | | StreamInfo streamInfoResult = new StreamInfo(); |
| | | streamInfoResult.setStreamId(stream); |
| | | streamInfoResult.setApp(app); |
| | | streamInfoResult.setRtmp(String.format("rtmp://%s:%s/%s/%s", mediaInfo.getIp(), mediaInfo.getRtmpPort(), app, stream)); |
| | | streamInfoResult.setRtsp(String.format("rtsp://%s:%s/%s/%s", mediaInfo.getIp(), mediaInfo.getRtspPort(), app, stream)); |
| | | streamInfoResult.setFlv(String.format("http://%s:%s/%s/%s.flv", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream)); |
| | | streamInfoResult.setWs_flv(String.format("ws://%s:%s/%s/%s.flv", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream)); |
| | | streamInfoResult.setHls(String.format("http://%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.getIp(), mediaInfo.getHttpPort(), app, stream)); |
| | | streamInfoResult.setFmp4(String.format("http://%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.getIp(), mediaInfo.getHttpPort(), app, stream)); |
| | | streamInfoResult.setTs(String.format("http://%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.getIp(), 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.setRtmp(String.format("rtmp://%s:%s/%s/%s", mediaInfo.getStreamIp(), mediaInfo.getRtmpPort(), 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.getStreamIp(), 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.getStreamIp(), 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.getStreamIp(), 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.getStreamIp(), 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.getStreamIp(), mediaInfo.getHttpPort(), app, stream)); |
| | | streamInfoResult.setTracks(tracks); |
| | | return streamInfoResult; |
| | | } |
| | |
| | | # [可选] 心跳超时时间, 建议设置为心跳周期的三倍 |
| | | keepaliveTimeOut: 180 |
| | | |
| | | #zlm服务器配置 |
| | | #zlm 默认服务器配置 |
| | | media: |
| | | # [必须修改] zlm服务器的内网IP |
| | | ip: 192.168.0.100 |
| | | # [可选] 返回流地址时的ip,置空使用 media.ip |
| | | streamIp: |
| | | # [可选] wvp在国标信令中使用的ip,此ip为摄像机可以访问到的ip, 置空使用 media.ip |
| | | sdpIp: |
| | | # [可选] zlm服务器的hook所使用的IP, 默认使用sip.ip |
| | |
| | | # [可选] 默认设备认证密码,后续扩展使用设备单独密码, 移除密码将不进行校验 |
| | | password: admin123 |
| | | |
| | | #zlm服务器配置 |
| | | #zlm 默认服务器配置 |
| | | media: |
| | | # [必须修改] zlm服务器的内网IP |
| | | ip: 192.168.0.100 |