| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | } |
| | | 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"); |
| | | 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"); |
| | | param.put("hook.enable","1"); |
| | | param.put("hook.on_flow_report",""); |
| | | param.put("hook.on_play",String.format("%s/on_play", hookPrex)); |
| | |
| | | logger.info( "[ id: " + zlmServerConfig.getGeneralMediaServerId() + "] zlm接入成功..."); |
| | | // 关闭循环获取zlm配置 |
| | | startGetMedia = false; |
| | | if (mediaConfig.getAutoConfig()) saveZLMConfig(); |
| | | if (mediaConfig.isAutoConfig()) saveZLMConfig(); |
| | | zlmServerManger.updateServerCatch(zlmServerConfig); |
| | | |
| | | // 清空所有session |