From 2c0240e16f837aef6ce94aa48d862cc48e2c0cf0 Mon Sep 17 00:00:00 2001 From: lawrencehj <1934378145@qq.com> Date: 星期三, 23 六月 2021 16:01:28 +0800 Subject: [PATCH] 屏蔽测试代码 --- src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java | 23 ++++++++--------------- 1 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java index 2570c1b..f9171c3 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java @@ -4,10 +4,7 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; 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; @@ -17,7 +14,6 @@ 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; @@ -33,18 +29,12 @@ private IVideoManagerStorager storager; @Autowired - private IRedisCatchStorage redisCatchStorage; - - @Autowired private MediaConfig mediaConfig; - - @Autowired - private SipConfig sipConfig; @Value("${server.port}") private String serverPort; - @Value("${server.ssl.enabled}") + @Value("${server.ssl.enabled:false}") private boolean sslEnabled; private boolean startGetMedia = false; @@ -106,9 +96,12 @@ 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; + if (mediaConfig.getRecordAssistPort() != 0) { + recordHookPrex = String.format("http://127.0.0.1:%s/api/record", mediaConfig.getRecordAssistPort()); + } Map<String, Object> param = new HashMap<>(); param.put("api.secret",mediaConfig.getSecret()); // -profile:v Baseline param.put("ffmpeg.cmd","%s -fflags nobuffer -rtsp_transport tcp -i %s -c:a aac -strict -2 -ar 44100 -ab 48k -c:v libx264 -f flv %s"); @@ -116,8 +109,8 @@ param.put("hook.on_flow_report",""); param.put("hook.on_play",String.format("%s/on_play", hookPrex)); param.put("hook.on_http_access",""); - param.put("hook.on_publish",String.format("%s/on_publish", hookPrex)); - param.put("hook.on_record_mp4",""); + param.put("hook.on_publish", String.format("%s/on_publish", hookPrex)); + param.put("hook.on_record_mp4",recordHookPrex != null? String.format("%s/on_record_mp4", recordHookPrex): ""); param.put("hook.on_record_ts",""); param.put("hook.on_rtsp_auth",""); param.put("hook.on_rtsp_realm",""); @@ -145,7 +138,7 @@ logger.info( "[ id: " + zlmServerConfig.getGeneralMediaServerId() + "] zlm鎺ュ叆鎴愬姛..."); // 鍏抽棴寰幆鑾峰彇zlm閰嶇疆 startGetMedia = false; - if (mediaConfig.getAutoConfig()) saveZLMConfig(); + if (mediaConfig.isAutoConfig()) saveZLMConfig(); zlmServerManger.updateServerCatch(zlmServerConfig); // 娓呯┖鎵�鏈塻ession -- Gitblit v1.8.0