支持配置 assistant 的ip
This commit is contained in:
parent
869cb772d9
commit
19f7dc21a1
@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.conf;
|
|||||||
|
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||||
|
import lombok.Data;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@ -16,6 +17,7 @@ import java.util.regex.Pattern;
|
|||||||
|
|
||||||
@Configuration("mediaConfig")
|
@Configuration("mediaConfig")
|
||||||
@Order(0)
|
@Order(0)
|
||||||
|
@Data
|
||||||
public class MediaConfig{
|
public class MediaConfig{
|
||||||
|
|
||||||
private final static Logger logger = LoggerFactory.getLogger(MediaConfig.class);
|
private final static Logger logger = LoggerFactory.getLogger(MediaConfig.class);
|
||||||
@ -78,6 +80,9 @@ public class MediaConfig{
|
|||||||
@Value("${media.rtp.send-port-range}")
|
@Value("${media.rtp.send-port-range}")
|
||||||
private String rtpSendPortRange;
|
private String rtpSendPortRange;
|
||||||
|
|
||||||
|
@Value("${media.record-assist-ip:127.0.0.1}")
|
||||||
|
private String recordAssistIp = "127.0.0.1";
|
||||||
|
|
||||||
@Value("${media.record-assist-port:0}")
|
@Value("${media.record-assist-port:0}")
|
||||||
private Integer recordAssistPort = 0;
|
private Integer recordAssistPort = 0;
|
||||||
|
|
||||||
@ -210,6 +215,7 @@ public class MediaConfig{
|
|||||||
mediaServerItem.setRtpEnable(rtpEnable);
|
mediaServerItem.setRtpEnable(rtpEnable);
|
||||||
mediaServerItem.setRtpPortRange(rtpPortRange);
|
mediaServerItem.setRtpPortRange(rtpPortRange);
|
||||||
mediaServerItem.setSendRtpPortRange(rtpSendPortRange);
|
mediaServerItem.setSendRtpPortRange(rtpSendPortRange);
|
||||||
|
mediaServerItem.setRecordAssistIp(recordAssistIp);
|
||||||
mediaServerItem.setRecordAssistPort(recordAssistPort);
|
mediaServerItem.setRecordAssistPort(recordAssistPort);
|
||||||
mediaServerItem.setHookAliveInterval(30.00f);
|
mediaServerItem.setHookAliveInterval(30.00f);
|
||||||
|
|
||||||
|
@ -510,7 +510,8 @@ public class SIPCommander implements ISIPCommander {
|
|||||||
content.append("c=IN IP4 " + sdpIp + "\r\n");
|
content.append("c=IN IP4 " + sdpIp + "\r\n");
|
||||||
content.append("t=" + DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime) + " "
|
content.append("t=" + DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime) + " "
|
||||||
+ DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime) + "\r\n");
|
+ DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime) + "\r\n");
|
||||||
|
logger.debug("起止时间: {} ~ {}",startTime, endTime);
|
||||||
|
logger.debug("t={} {}",DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime), DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime));
|
||||||
String streamMode = device.getStreamMode().toUpperCase();
|
String streamMode = device.getStreamMode().toUpperCase();
|
||||||
|
|
||||||
if (userSetting.isSeniorSdp()) {
|
if (userSetting.isSeniorSdp()) {
|
||||||
|
@ -3,8 +3,10 @@ package com.genersoft.iot.vmp.media.zlm.dto;
|
|||||||
|
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig;
|
import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
|
@Data
|
||||||
@Schema(description = "流媒体服务信息")
|
@Schema(description = "流媒体服务信息")
|
||||||
public class MediaServerItem{
|
public class MediaServerItem{
|
||||||
|
|
||||||
@ -65,6 +67,9 @@ public class MediaServerItem{
|
|||||||
@Schema(description = "RTP发流端口范围")
|
@Schema(description = "RTP发流端口范围")
|
||||||
private String sendRtpPortRange;
|
private String sendRtpPortRange;
|
||||||
|
|
||||||
|
@Schema(description = "assist服务ip")
|
||||||
|
private String recordAssistIp;
|
||||||
|
|
||||||
@Schema(description = "assist服务端口")
|
@Schema(description = "assist服务端口")
|
||||||
private int recordAssistPort;
|
private int recordAssistPort;
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
import com.genersoft.iot.vmp.common.CommonCallback;
|
import com.genersoft.iot.vmp.common.CommonCallback;
|
||||||
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
||||||
import com.genersoft.iot.vmp.conf.DynamicTask;
|
import com.genersoft.iot.vmp.conf.DynamicTask;
|
||||||
|
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.conf.UserSetting;
|
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||||
@ -25,6 +26,7 @@ import com.genersoft.iot.vmp.utils.JsonUtil;
|
|||||||
import com.genersoft.iot.vmp.utils.redis.RedisUtil;
|
import com.genersoft.iot.vmp.utils.redis.RedisUtil;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.RecordFile;
|
import com.genersoft.iot.vmp.vmanager.bean.RecordFile;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
@ -53,6 +55,7 @@ import java.util.concurrent.ExecutionException;
|
|||||||
* 媒体服务器节点管理
|
* 媒体服务器节点管理
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class MediaServerServiceImpl implements IMediaServerService {
|
public class MediaServerServiceImpl implements IMediaServerService {
|
||||||
|
|
||||||
private final static Logger logger = LoggerFactory.getLogger(MediaServerServiceImpl.class);
|
private final static Logger logger = LoggerFactory.getLogger(MediaServerServiceImpl.class);
|
||||||
@ -115,7 +118,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ThreadPoolTaskExecutor taskExecutor;
|
private ThreadPoolTaskExecutor taskExecutor;
|
||||||
|
|
||||||
|
private final MediaConfig mediaConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化
|
* 初始化
|
||||||
@ -588,7 +591,12 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
|||||||
param.put("hook.on_send_rtp_stopped",String.format("%s/on_send_rtp_stopped", hookPrex));
|
param.put("hook.on_send_rtp_stopped",String.format("%s/on_send_rtp_stopped", hookPrex));
|
||||||
param.put("hook.on_rtp_server_timeout",String.format("%s/on_rtp_server_timeout", hookPrex));
|
param.put("hook.on_rtp_server_timeout",String.format("%s/on_rtp_server_timeout", hookPrex));
|
||||||
if (mediaServerItem.getRecordAssistPort() > 0) {
|
if (mediaServerItem.getRecordAssistPort() > 0) {
|
||||||
|
if(mediaConfig.getRecordAssistIp().equals("127.0.0.1")){
|
||||||
param.put("hook.on_record_mp4",String.format("http://127.0.0.1:%s/api/record/on_record_mp4", mediaServerItem.getRecordAssistPort()));
|
param.put("hook.on_record_mp4",String.format("http://127.0.0.1:%s/api/record/on_record_mp4", mediaServerItem.getRecordAssistPort()));
|
||||||
|
} else {
|
||||||
|
param.put("hook.on_record_mp4",String.format("http://%s:%s/api/record/on_record_mp4", mediaConfig.getRecordAssistIp(),mediaServerItem.getRecordAssistPort()));
|
||||||
|
}
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
param.put("hook.on_record_mp4","");
|
param.put("hook.on_record_mp4","");
|
||||||
}
|
}
|
||||||
|
@ -670,6 +670,7 @@ public class PlayServiceImpl implements IPlayService {
|
|||||||
null);
|
null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
logger.debug("startTime => {}, endTime => {}",startTime,endTime);
|
||||||
logger.info("[录像下载] deviceId: {}, channelId: {}, 下载速度:{}, 收流端口:{}, 收流模式:{}, SSRC: {}, SSRC校验:{}", device.getDeviceId(), channelId, downloadSpeed, ssrcInfo.getPort(), device.getStreamMode(), ssrcInfo.getSsrc(), device.isSsrcCheck());
|
logger.info("[录像下载] deviceId: {}, channelId: {}, 下载速度:{}, 收流端口:{}, 收流模式:{}, SSRC: {}, SSRC校验:{}", device.getDeviceId(), channelId, downloadSpeed, ssrcInfo.getPort(), device.getStreamMode(), ssrcInfo.getSsrc(), device.isSsrcCheck());
|
||||||
// 初始化redis中的invite消息状态
|
// 初始化redis中的invite消息状态
|
||||||
InviteInfo inviteInfo = InviteInfo.getInviteInfo(device.getDeviceId(), channelId, ssrcInfo.getStream(), ssrcInfo,
|
InviteInfo inviteInfo = InviteInfo.getInviteInfo(device.getDeviceId(), channelId, ssrcInfo.getStream(), ssrcInfo,
|
||||||
@ -714,6 +715,7 @@ public class PlayServiceImpl implements IPlayService {
|
|||||||
}
|
}
|
||||||
callback.run(InviteErrorCode.SUCCESS.getCode(), InviteErrorCode.SUCCESS.getMsg(), streamInfo);
|
callback.run(InviteErrorCode.SUCCESS.getCode(), InviteErrorCode.SUCCESS.getMsg(), streamInfo);
|
||||||
logger.info("[录像下载] 调用成功 deviceId: {}, channelId: {}, 开始时间: {}, 结束时间: {}", device.getDeviceId(), channelId, startTime, endTime);
|
logger.info("[录像下载] 调用成功 deviceId: {}, channelId: {}, 开始时间: {}, 结束时间: {}", device.getDeviceId(), channelId, startTime, endTime);
|
||||||
|
logger.debug("streamInfo => {}",streamInfo);
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
cmder.downloadStreamCmd(mediaServerItem, ssrcInfo, device, channelId, startTime, endTime, downloadSpeed,
|
cmder.downloadStreamCmd(mediaServerItem, ssrcInfo, device, channelId, startTime, endTime, downloadSpeed,
|
||||||
|
Loading…
Reference in New Issue
Block a user