优化媒体节点服务的代码结构
parent
97dc926b28
commit
1768565ce0
|
@ -2,13 +2,11 @@ package com.genersoft.iot.vmp.conf;
|
||||||
|
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.genersoft.iot.vmp.media.zlm.AssistRESTfulUtils;
|
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.bean.CloudRecordItem;
|
import com.genersoft.iot.vmp.service.bean.CloudRecordItem;
|
||||||
import com.genersoft.iot.vmp.storager.dao.CloudRecordServiceMapper;
|
import com.genersoft.iot.vmp.storager.dao.CloudRecordServiceMapper;
|
||||||
import com.genersoft.iot.vmp.vmanager.cloudRecord.CloudRecordController;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -16,7 +14,6 @@ import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.genersoft.iot.vmp.conf;
|
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.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import org.apache.http.HttpHost;
|
import org.apache.http.HttpHost;
|
||||||
import org.apache.http.HttpRequest;
|
import org.apache.http.HttpRequest;
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.genersoft.iot.vmp.conf;
|
package com.genersoft.iot.vmp.conf;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
@ -14,9 +13,6 @@ public class WVPTimerTask {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IRedisCatchStorage redisCatchStorage;
|
private IRedisCatchStorage redisCatchStorage;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IMediaServerService mediaServerService;
|
|
||||||
|
|
||||||
@Value("${server.port}")
|
@Value("${server.port}")
|
||||||
private int serverPort;
|
private int serverPort;
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@ import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.device.RequestTimeoutEvent;
|
import com.genersoft.iot.vmp.gb28181.event.device.RequestTimeoutEvent;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.record.RecordEndEvent;
|
import com.genersoft.iot.vmp.gb28181.event.record.RecordEndEvent;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
||||||
import com.genersoft.iot.vmp.media.zlm.event.ZLMOfflineEvent;
|
import com.genersoft.iot.vmp.media.zlm.event.MediaServerOfflineEvent;
|
||||||
import com.genersoft.iot.vmp.media.zlm.event.ZLMOnlineEvent;
|
import com.genersoft.iot.vmp.media.zlm.event.MediaServerOnlineEvent;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.ApplicationEventPublisher;
|
import org.springframework.context.ApplicationEventPublisher;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -40,13 +40,13 @@ public class EventPublisher {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void zlmOfflineEventPublish(String mediaServerId){
|
public void zlmOfflineEventPublish(String mediaServerId){
|
||||||
ZLMOfflineEvent outEvent = new ZLMOfflineEvent(this);
|
MediaServerOfflineEvent outEvent = new MediaServerOfflineEvent(this);
|
||||||
outEvent.setMediaServerId(mediaServerId);
|
outEvent.setMediaServerId(mediaServerId);
|
||||||
applicationEventPublisher.publishEvent(outEvent);
|
applicationEventPublisher.publishEvent(outEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void zlmOnlineEventPublish(String mediaServerId) {
|
public void mediaServerOnlineEventPublish(String mediaServerId) {
|
||||||
ZLMOnlineEvent outEvent = new ZLMOnlineEvent(this);
|
MediaServerOnlineEvent outEvent = new MediaServerOnlineEvent(this);
|
||||||
outEvent.setMediaServerId(mediaServerId);
|
outEvent.setMediaServerId(mediaServerId);
|
||||||
applicationEventPublisher.publishEvent(outEvent);
|
applicationEventPublisher.publishEvent(outEvent);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.service.IDeviceService;
|
import com.genersoft.iot.vmp.service.IDeviceService;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.IPlatformService;
|
import com.genersoft.iot.vmp.service.IPlatformService;
|
||||||
import com.genersoft.iot.vmp.service.impl.PlatformServiceImpl;
|
import com.genersoft.iot.vmp.service.impl.PlatformServiceImpl;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
|
|
|
@ -25,7 +25,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamPush;
|
import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamPush;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.HookParam;
|
import com.genersoft.iot.vmp.media.zlm.dto.hook.HookParam;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.bean.SSRCInfo;
|
import com.genersoft.iot.vmp.service.bean.SSRCInfo;
|
||||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||||
import gov.nist.javax.sip.message.SIPRequest;
|
import gov.nist.javax.sip.message.SIPRequest;
|
||||||
|
@ -44,7 +44,6 @@ import javax.sip.SipFactory;
|
||||||
import javax.sip.header.CallIdHeader;
|
import javax.sip.header.CallIdHeader;
|
||||||
import javax.sip.message.Request;
|
import javax.sip.message.Request;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -19,7 +19,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange;
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
|
import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.HookParam;
|
import com.genersoft.iot.vmp.media.zlm.dto.hook.HookParam;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||||
import com.genersoft.iot.vmp.service.bean.SSRCInfo;
|
import com.genersoft.iot.vmp.service.bean.SSRCInfo;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
|
|
|
@ -13,7 +13,7 @@ import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
|
import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.service.IDeviceService;
|
import com.genersoft.iot.vmp.service.IDeviceService;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.IPlayService;
|
import com.genersoft.iot.vmp.service.IPlayService;
|
||||||
import com.genersoft.iot.vmp.service.bean.RequestPushStreamMsg;
|
import com.genersoft.iot.vmp.service.bean.RequestPushStreamMsg;
|
||||||
import com.genersoft.iot.vmp.service.redisMsg.RedisGbPlayMsgListener;
|
import com.genersoft.iot.vmp.service.redisMsg.RedisGbPlayMsgListener;
|
||||||
|
|
|
@ -13,6 +13,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor;
|
import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
|
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
|
||||||
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
|
import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.service.*;
|
import com.genersoft.iot.vmp.service.*;
|
||||||
|
|
|
@ -18,6 +18,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor;
|
import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
|
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
|
||||||
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
||||||
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMMediaListManager;
|
import com.genersoft.iot.vmp.media.zlm.ZLMMediaListManager;
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
|
import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
|
import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd;
|
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||||
import com.genersoft.iot.vmp.gb28181.session.AudioBroadcastManager;
|
import com.genersoft.iot.vmp.gb28181.session.AudioBroadcastManager;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
||||||
|
@ -12,7 +11,7 @@ import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
||||||
import com.genersoft.iot.vmp.service.IDeviceService;
|
import com.genersoft.iot.vmp.service.IDeviceService;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.IPlatformService;
|
import com.genersoft.iot.vmp.service.IPlatformService;
|
||||||
import com.genersoft.iot.vmp.service.IPlayService;
|
import com.genersoft.iot.vmp.service.IPlayService;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.genersoft.iot.vmp.media;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.common.CommonCallback;
|
||||||
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
|
|
||||||
|
public interface IMediaNodeServerService {
|
||||||
|
int createRTPServer(MediaServerItem mediaServerItem, String streamId, long ssrc, Integer port, Boolean onlyAuto, Boolean reUsePort, Integer tcpMode);
|
||||||
|
|
||||||
|
void closeRtpServer(MediaServerItem mediaServerItem, String streamId);
|
||||||
|
|
||||||
|
void closeRtpServer(MediaServerItem mediaServerItem, String streamId, CommonCallback<Boolean> callback);
|
||||||
|
|
||||||
|
void closeStreams(MediaServerItem mediaServerItem, String rtp, String streamId);
|
||||||
|
|
||||||
|
Boolean updateRtpServerSSRC(MediaServerItem mediaServerItem, String streamId, String ssrc);
|
||||||
|
|
||||||
|
boolean checkNodeId(MediaServerItem mediaServerItem);
|
||||||
|
|
||||||
|
void online(MediaServerItem mediaServerItem);
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.genersoft.iot.vmp.service;
|
package com.genersoft.iot.vmp.media;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.common.CommonCallback;
|
import com.genersoft.iot.vmp.common.CommonCallback;
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig;
|
import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig;
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.genersoft.iot.vmp.media.abl;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.media.IMediaNodeServerService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service("abl")
|
||||||
|
public class ABLMediaNodeServerService implements IMediaNodeServerService {
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.genersoft.iot.vmp.service.impl;
|
package com.genersoft.iot.vmp.media.impl;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONArray;
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
|
@ -12,11 +12,12 @@ import com.genersoft.iot.vmp.conf.UserSetting;
|
||||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
||||||
import com.genersoft.iot.vmp.gb28181.session.SSRCFactory;
|
import com.genersoft.iot.vmp.gb28181.session.SSRCFactory;
|
||||||
|
import com.genersoft.iot.vmp.media.IMediaNodeServerService;
|
||||||
import com.genersoft.iot.vmp.media.zlm.*;
|
import com.genersoft.iot.vmp.media.zlm.*;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.ServerKeepaliveData;
|
import com.genersoft.iot.vmp.media.zlm.dto.ServerKeepaliveData;
|
||||||
import com.genersoft.iot.vmp.service.IInviteStreamService;
|
import com.genersoft.iot.vmp.service.IInviteStreamService;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.bean.MediaServerLoad;
|
import com.genersoft.iot.vmp.service.bean.MediaServerLoad;
|
||||||
import com.genersoft.iot.vmp.service.bean.SSRCInfo;
|
import com.genersoft.iot.vmp.service.bean.SSRCInfo;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
|
@ -25,30 +26,23 @@ import com.genersoft.iot.vmp.utils.DateUtil;
|
||||||
import com.genersoft.iot.vmp.utils.JsonUtil;
|
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 okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
|
||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.TransactionDefinition;
|
import org.springframework.transaction.TransactionDefinition;
|
||||||
import org.springframework.transaction.TransactionStatus;
|
import org.springframework.transaction.TransactionStatus;
|
||||||
import org.springframework.util.Assert;
|
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 媒体服务器节点管理
|
* 媒体服务器节点管理
|
||||||
|
@ -82,9 +76,6 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private AssistRESTfulUtils assistRESTfulUtils;
|
private AssistRESTfulUtils assistRESTfulUtils;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ZLMRESTfulUtils zlmresTfulUtils;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MediaServerMapper mediaServerMapper;
|
private MediaServerMapper mediaServerMapper;
|
||||||
|
|
||||||
|
@ -113,20 +104,16 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisTemplate<Object, Object> redisTemplate;
|
private RedisTemplate<Object, Object> redisTemplate;
|
||||||
|
|
||||||
@Qualifier("taskExecutor")
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ThreadPoolTaskExecutor taskExecutor;
|
private Map<String, IMediaNodeServerService> nodeServerServiceMap;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化
|
* 初始化
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void updateVmServer(List<MediaServerItem> mediaServerItemList) {
|
public void updateVmServer(List<MediaServerItem> mediaServerItemList) {
|
||||||
logger.info("[zlm] 缓存初始化 ");
|
logger.info("[媒体服务节点] 缓存初始化 ");
|
||||||
for (MediaServerItem mediaServerItem : mediaServerItemList) {
|
for (MediaServerItem mediaServerItem : mediaServerItemList) {
|
||||||
if (ObjectUtils.isEmpty(mediaServerItem.getId())) {
|
if (ObjectUtils.isEmpty(mediaServerItem.getId())) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -173,7 +160,12 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||||
}
|
}
|
||||||
int rtpServerPort;
|
int rtpServerPort;
|
||||||
if (mediaServerItem.isRtpEnable()) {
|
if (mediaServerItem.isRtpEnable()) {
|
||||||
rtpServerPort = zlmServerFactory.createRTPServer(mediaServerItem, streamId, ssrcCheck ? Long.parseLong(ssrc) : 0, port, onlyAuto, reUsePort, tcpMode);
|
IMediaNodeServerService mediaNodeServerService = nodeServerServiceMap.get(mediaServerItem.getType());
|
||||||
|
if (mediaNodeServerService == null) {
|
||||||
|
logger.info("[openRTPServer] 失败, mediaServerItem的类型: {},未找到对应的实现类", mediaServerItem.getType());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
rtpServerPort = mediaNodeServerService.createRTPServer(mediaServerItem, streamId, ssrcCheck ? Long.parseLong(ssrc) : 0, port, onlyAuto, reUsePort, tcpMode);
|
||||||
} else {
|
} else {
|
||||||
rtpServerPort = mediaServerItem.getRtpProxyPort();
|
rtpServerPort = mediaServerItem.getRtpProxyPort();
|
||||||
}
|
}
|
||||||
|
@ -191,7 +183,12 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||||
if (mediaServerItem == null) {
|
if (mediaServerItem == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
zlmServerFactory.closeRtpServer(mediaServerItem, streamId);
|
IMediaNodeServerService mediaNodeServerService = nodeServerServiceMap.get(mediaServerItem.getType());
|
||||||
|
if (mediaNodeServerService == null) {
|
||||||
|
logger.info("[closeRTPServer] 失败, mediaServerItem的类型: {},未找到对应的实现类", mediaServerItem.getType());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mediaNodeServerService.closeRtpServer(mediaServerItem, streamId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -200,21 +197,42 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||||
callback.run(false);
|
callback.run(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
zlmServerFactory.closeRtpServer(mediaServerItem, streamId, callback);
|
IMediaNodeServerService mediaNodeServerService = nodeServerServiceMap.get(mediaServerItem.getType());
|
||||||
|
if (mediaNodeServerService == null) {
|
||||||
|
logger.info("[closeRTPServer] 失败, mediaServerItem的类型: {},未找到对应的实现类", mediaServerItem.getType());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mediaNodeServerService.closeRtpServer(mediaServerItem, streamId, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void closeRTPServer(String mediaServerId, String streamId) {
|
public void closeRTPServer(String mediaServerId, String streamId) {
|
||||||
MediaServerItem mediaServerItem = this.getOne(mediaServerId);
|
MediaServerItem mediaServerItem = this.getOne(mediaServerId);
|
||||||
if (mediaServerItem != null && mediaServerItem.isRtpEnable()) {
|
if (mediaServerItem == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (mediaServerItem.isRtpEnable()) {
|
||||||
closeRTPServer(mediaServerItem, streamId);
|
closeRTPServer(mediaServerItem, streamId);
|
||||||
}
|
}
|
||||||
zlmresTfulUtils.closeStreams(mediaServerItem, "rtp", streamId);
|
IMediaNodeServerService mediaNodeServerService = nodeServerServiceMap.get(mediaServerItem.getType());
|
||||||
|
if (mediaNodeServerService == null) {
|
||||||
|
logger.info("[closeRTPServer] 失败, mediaServerItem的类型: {},未找到对应的实现类", mediaServerItem.getType());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mediaNodeServerService.closeStreams(mediaServerItem, "rtp", streamId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean updateRtpServerSSRC(MediaServerItem mediaServerItem, String streamId, String ssrc) {
|
public Boolean updateRtpServerSSRC(MediaServerItem mediaServerItem, String streamId, String ssrc) {
|
||||||
return zlmServerFactory.updateRtpServerSSRC(mediaServerItem, streamId, ssrc);
|
if (mediaServerItem == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
IMediaNodeServerService mediaNodeServerService = nodeServerServiceMap.get(mediaServerItem.getType());
|
||||||
|
if (mediaNodeServerService == null) {
|
||||||
|
logger.info("[updateRtpServerSSRC] 失败, mediaServerItem的类型: {},未找到对应的实现类", mediaServerItem.getType());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return mediaNodeServerService.updateRtpServerSSRC(mediaServerItem, streamId, ssrc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -227,12 +245,11 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* zlm 重启后重置他的推流信息, TODO 给正在使用的设备发送停止命令
|
* 媒体服务节点 重启后重置他的推流信息, TODO 给正在使用的设备发送停止命令
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void clearRTPServer(MediaServerItem mediaServerItem) {
|
public void clearRTPServer(MediaServerItem mediaServerItem) {
|
||||||
ssrcFactory.reset(mediaServerItem.getId());
|
ssrcFactory.reset(mediaServerItem.getId());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -301,7 +318,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取单个zlm服务器
|
* 获取单个媒体服务节点服务器
|
||||||
* @param mediaServerId 服务id
|
* @param mediaServerId 服务id
|
||||||
* @return MediaServerItem
|
* @return MediaServerItem
|
||||||
*/
|
*/
|
||||||
|
@ -331,24 +348,20 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||||
mediaServerItem.setCreateTime(DateUtil.getNow());
|
mediaServerItem.setCreateTime(DateUtil.getNow());
|
||||||
mediaServerItem.setUpdateTime(DateUtil.getNow());
|
mediaServerItem.setUpdateTime(DateUtil.getNow());
|
||||||
mediaServerItem.setHookAliveInterval(30f);
|
mediaServerItem.setHookAliveInterval(30f);
|
||||||
JSONObject responseJSON = zlmresTfulUtils.getMediaServerConfig(mediaServerItem);
|
if (mediaServerItem.getType() == null) {
|
||||||
if (responseJSON != null) {
|
logger.info("[添加媒体节点] 失败, mediaServerItem的类型:为空");
|
||||||
JSONArray data = responseJSON.getJSONArray("data");
|
return;
|
||||||
if (data != null && data.size() > 0) {
|
}
|
||||||
ZLMServerConfig zlmServerConfig= JSON.parseObject(JSON.toJSONString(data.get(0)), ZLMServerConfig.class);
|
IMediaNodeServerService mediaNodeServerService = nodeServerServiceMap.get(mediaServerItem.getType());
|
||||||
if (mediaServerMapper.queryOne(zlmServerConfig.getGeneralMediaServerId()) != null) {
|
if (mediaNodeServerService == null) {
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(),"保存失败,媒体服务ID [ " + zlmServerConfig.getGeneralMediaServerId() + " ] 已存在,请修改媒体服务器配置");
|
logger.info("[添加媒体节点] 失败, mediaServerItem的类型: {},未找到对应的实现类", mediaServerItem.getType());
|
||||||
}
|
return;
|
||||||
mediaServerItem.setId(zlmServerConfig.getGeneralMediaServerId());
|
}
|
||||||
zlmServerConfig.setIp(mediaServerItem.getIp());
|
if (mediaNodeServerService.checkNodeId(mediaServerItem)) {
|
||||||
mediaServerMapper.add(mediaServerItem);
|
mediaServerMapper.add(mediaServerItem);
|
||||||
zlmServerOnline(zlmServerConfig);
|
mediaNodeServerService.online(mediaServerItem);
|
||||||
}else {
|
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(),"连接失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(),"连接失败");
|
throw new ControllerException(ErrorCode.ERROR100.getCode(),"保存失败,媒体服务ID [ " + mediaServerItem.getId() + " ] 已存在,请修改媒体服务器配置");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,7 +377,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||||
TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
|
TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
|
||||||
int delResult = mediaServerMapper.delDefault();
|
int delResult = mediaServerMapper.delDefault();
|
||||||
if (delResult == 0) {
|
if (delResult == 0) {
|
||||||
logger.error("移除数据库默认zlm节点失败");
|
logger.error("移除数据库默认媒体服务节点节点失败");
|
||||||
//事务回滚
|
//事务回滚
|
||||||
dataSourceTransactionManager.rollback(transactionStatus);
|
dataSourceTransactionManager.rollback(transactionStatus);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -378,19 +391,19 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理zlm上线
|
* 处理媒体服务节点上线
|
||||||
* @param zlmServerConfig zlm上线携带的参数
|
* @param zlmServerConfig 媒体服务节点上线携带的参数
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void zlmServerOnline(ZLMServerConfig zlmServerConfig) {
|
public void zlmServerOnline(ZLMServerConfig zlmServerConfig) {
|
||||||
|
|
||||||
MediaServerItem serverItem = mediaServerMapper.queryOne(zlmServerConfig.getGeneralMediaServerId());
|
MediaServerItem serverItem = mediaServerMapper.queryOne(zlmServerConfig.getGeneralMediaServerId());
|
||||||
if (serverItem == null) {
|
if (serverItem == null) {
|
||||||
logger.warn("[未注册的zlm] 拒接接入:{}来自{}:{}", zlmServerConfig.getGeneralMediaServerId(), zlmServerConfig.getIp(),zlmServerConfig.getHttpPort() );
|
logger.warn("[未注册的媒体服务节点] 拒接接入:{}来自{}:{}", zlmServerConfig.getGeneralMediaServerId(), zlmServerConfig.getIp(),zlmServerConfig.getHttpPort() );
|
||||||
logger.warn("请检查ZLM的<general.mediaServerId>配置是否与WVP的<media.id>一致");
|
logger.warn("请检查媒体服务节点的ID配置是否与WVP的<media.id>一致");
|
||||||
return;
|
return;
|
||||||
}else {
|
}else {
|
||||||
logger.info("[ZLM] 正在连接 : {} -> {}:{}",
|
logger.info("[媒体服务节点] 正在连接 : {} -> {}:{}",
|
||||||
zlmServerConfig.getGeneralMediaServerId(), zlmServerConfig.getIp(), zlmServerConfig.getHttpPort());
|
zlmServerConfig.getGeneralMediaServerId(), zlmServerConfig.getIp(), zlmServerConfig.getHttpPort());
|
||||||
}
|
}
|
||||||
serverItem.setHookAliveInterval(zlmServerConfig.getHookAliveInterval());
|
serverItem.setHookAliveInterval(zlmServerConfig.getHookAliveInterval());
|
||||||
|
@ -418,7 +431,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||||
serverItem.setStatus(true);
|
serverItem.setStatus(true);
|
||||||
|
|
||||||
if (ObjectUtils.isEmpty(serverItem.getId())) {
|
if (ObjectUtils.isEmpty(serverItem.getId())) {
|
||||||
logger.warn("[未注册的zlm] serverItem缺少ID, 无法接入:{}:{}", zlmServerConfig.getIp(),zlmServerConfig.getHttpPort() );
|
logger.warn("[未注册的媒体服务节点] serverItem缺少ID, 无法接入:{}:{}", zlmServerConfig.getIp(),zlmServerConfig.getHttpPort() );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mediaServerMapper.update(serverItem);
|
mediaServerMapper.update(serverItem);
|
||||||
|
@ -436,9 +449,9 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||||
final String zlmKeepaliveKey = zlmKeepaliveKeyPrefix + serverItem.getId();
|
final String zlmKeepaliveKey = zlmKeepaliveKeyPrefix + serverItem.getId();
|
||||||
dynamicTask.stop(zlmKeepaliveKey);
|
dynamicTask.stop(zlmKeepaliveKey);
|
||||||
dynamicTask.startDelay(zlmKeepaliveKey, new KeepAliveTimeoutRunnable(serverItem), (serverItem.getHookAliveInterval().intValue() + 5) * 1000);
|
dynamicTask.startDelay(zlmKeepaliveKey, new KeepAliveTimeoutRunnable(serverItem), (serverItem.getHookAliveInterval().intValue() + 5) * 1000);
|
||||||
publisher.zlmOnlineEventPublish(serverItem.getId());
|
publisher.mediaServerOnlineEventPublish(serverItem.getId());
|
||||||
|
|
||||||
logger.info("[ZLM] 连接成功 {} - {}:{} ",
|
logger.info("[媒体服务节点] 连接成功 {} - {}:{} ",
|
||||||
zlmServerConfig.getGeneralMediaServerId(), zlmServerConfig.getIp(), zlmServerConfig.getHttpPort());
|
zlmServerConfig.getGeneralMediaServerId(), zlmServerConfig.getIp(), zlmServerConfig.getHttpPort());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -452,12 +465,12 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
logger.info("[zlm心跳到期]:" + serverItem.getId());
|
logger.info("[媒体服务节点心跳到期]:" + serverItem.getId());
|
||||||
// 发起http请求验证zlm是否确实无法连接,如果确实无法连接则发送离线事件,否则不作处理
|
// 发起http请求验证zlm是否确实无法连接,如果确实无法连接则发送离线事件,否则不作处理
|
||||||
JSONObject mediaServerConfig = zlmresTfulUtils.getMediaServerConfig(serverItem);
|
JSONObject mediaServerConfig = zlmresTfulUtils.getMediaServerConfig(serverItem);
|
||||||
if (mediaServerConfig != null && mediaServerConfig.getInteger("code") == 0) {
|
if (mediaServerConfig != null && mediaServerConfig.getInteger("code") == 0) {
|
||||||
logger.info("[zlm心跳到期]:{}验证后zlm仍在线,恢复心跳信息,请检查zlm是否可以正常向wvp发送心跳", serverItem.getId());
|
logger.info("[媒体服务节点心跳到期]:{}验证后媒体服务节点仍在线,恢复心跳信息,请检查媒体服务节点是否可以正常向wvp发送心跳", serverItem.getId());
|
||||||
// 添加zlm信息
|
// 添加媒体服务节点信息
|
||||||
updateMediaServerKeepalive(serverItem.getId(), null);
|
updateMediaServerKeepalive(serverItem.getId(), null);
|
||||||
}else {
|
}else {
|
||||||
publisher.zlmOfflineEventPublish(serverItem.getId());
|
publisher.zlmOfflineEventPublish(serverItem.getId());
|
||||||
|
@ -556,13 +569,13 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对zlm服务器进行基础配置
|
* 对媒体服务节点服务器进行基础配置
|
||||||
* @param mediaServerItem 服务ID
|
* @param mediaServerItem 服务ID
|
||||||
* @param restart 是否重启zlm
|
* @param restart 是否重启媒体服务节点
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setZLMConfig(MediaServerItem mediaServerItem, boolean restart) {
|
public void setZLMConfig(MediaServerItem mediaServerItem, boolean restart) {
|
||||||
logger.info("[ZLM] 正在设置 :{} -> {}:{}",
|
logger.info("[媒体服务节点] 正在设置 :{} -> {}:{}",
|
||||||
mediaServerItem.getId(), mediaServerItem.getIp(), mediaServerItem.getHttpPort());
|
mediaServerItem.getId(), mediaServerItem.getIp(), mediaServerItem.getHttpPort());
|
||||||
String protocol = sslEnabled ? "https" : "http";
|
String protocol = sslEnabled ? "https" : "http";
|
||||||
String hookPrefix = String.format("%s://%s:%s/index/hook", protocol, mediaServerItem.getHookIp(), serverPort);
|
String hookPrefix = String.format("%s://%s:%s/index/hook", protocol, mediaServerItem.getHookIp(), serverPort);
|
||||||
|
@ -612,17 +625,17 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||||
|
|
||||||
if (responseJSON != null && responseJSON.getInteger("code") == 0) {
|
if (responseJSON != null && responseJSON.getInteger("code") == 0) {
|
||||||
if (restart) {
|
if (restart) {
|
||||||
logger.info("[ZLM] 设置成功,开始重启以保证配置生效 {} -> {}:{}",
|
logger.info("[媒体服务节点] 设置成功,开始重启以保证配置生效 {} -> {}:{}",
|
||||||
mediaServerItem.getId(), mediaServerItem.getIp(), mediaServerItem.getHttpPort());
|
mediaServerItem.getId(), mediaServerItem.getIp(), mediaServerItem.getHttpPort());
|
||||||
zlmresTfulUtils.restartServer(mediaServerItem);
|
zlmresTfulUtils.restartServer(mediaServerItem);
|
||||||
}else {
|
}else {
|
||||||
logger.info("[ZLM] 设置成功 {} -> {}:{}",
|
logger.info("[媒体服务节点] 设置成功 {} -> {}:{}",
|
||||||
mediaServerItem.getId(), mediaServerItem.getIp(), mediaServerItem.getHttpPort());
|
mediaServerItem.getId(), mediaServerItem.getIp(), mediaServerItem.getHttpPort());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
logger.info("[ZLM] 设置zlm失败 {} -> {}:{}",
|
logger.info("[媒体服务节点] 设置媒体服务节点失败 {} -> {}:{}",
|
||||||
mediaServerItem.getId(), mediaServerItem.getIp(), mediaServerItem.getHttpPort());
|
mediaServerItem.getId(), mediaServerItem.getIp(), mediaServerItem.getHttpPort());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -701,11 +714,11 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||||
// 缓存不存在,从数据库查询,如果数据库不存在则是错误的
|
// 缓存不存在,从数据库查询,如果数据库不存在则是错误的
|
||||||
mediaServerItem = getOneFromDatabase(mediaServerId);
|
mediaServerItem = getOneFromDatabase(mediaServerId);
|
||||||
if (mediaServerItem == null) {
|
if (mediaServerItem == null) {
|
||||||
logger.warn("[更新ZLM 保活信息] 流媒体{}尚未加入使用,请检查节点中是否含有此流媒体 ", mediaServerId);
|
logger.warn("[更新媒体服务节点 保活信息] 流媒体{}尚未加入使用,请检查节点中是否含有此流媒体 ", mediaServerId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// zlm连接重试
|
// 媒体服务节点连接重试
|
||||||
logger.warn("[更新ZLM 保活信息]尝试链接zml id {}", mediaServerId);
|
logger.warn("[更新媒体服务节点 保活信息]尝试链接zml id {}", mediaServerId);
|
||||||
ssrcFactory.initMediaServerSSRC(mediaServerItem.getId(), null);
|
ssrcFactory.initMediaServerSSRC(mediaServerItem.getId(), null);
|
||||||
String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItem.getId();
|
String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItem.getId();
|
||||||
redisTemplate.opsForValue().set(key, mediaServerItem);
|
redisTemplate.opsForValue().set(key, mediaServerItem);
|
|
@ -18,6 +18,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
|
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
|
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
|
||||||
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.HookType;
|
import com.genersoft.iot.vmp.media.zlm.dto.HookType;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.genersoft.iot.vmp.conf.UserSetting;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.*;
|
import com.genersoft.iot.vmp.media.zlm.dto.*;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.IStreamProxyService;
|
import com.genersoft.iot.vmp.service.IStreamProxyService;
|
||||||
import com.genersoft.iot.vmp.service.IStreamPushService;
|
import com.genersoft.iot.vmp.service.IStreamPushService;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.genersoft.iot.vmp.media.zlm;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.media.IMediaNodeServerService;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service("zlm")
|
||||||
|
public class ZLMMediaNodeServerService implements IMediaNodeServerService {
|
||||||
|
}
|
|
@ -9,8 +9,7 @@ import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory;
|
import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForServerStarted;
|
import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForServerStarted;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
|
@ -85,6 +85,8 @@ public class MediaServerItem{
|
||||||
|
|
||||||
@Schema(description = "录像存储路径")
|
@Schema(description = "录像存储路径")
|
||||||
private String recordPath;
|
private String recordPath;
|
||||||
|
@Schema(description = "类型: zlm/abl")
|
||||||
|
private String type;
|
||||||
|
|
||||||
public MediaServerItem() {
|
public MediaServerItem() {
|
||||||
}
|
}
|
||||||
|
@ -318,4 +320,12 @@ public class MediaServerItem{
|
||||||
public void setRecordPath(String recordPath) {
|
public void setRecordPath(String recordPath) {
|
||||||
this.recordPath = recordPath;
|
this.recordPath = recordPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
package com.genersoft.iot.vmp.media.zlm.event;
|
package com.genersoft.iot.vmp.media.zlm.event;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig;
|
|
||||||
import org.springframework.context.ApplicationEvent;
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
|
||||||
public abstract class ZLMEventAbstract extends ApplicationEvent {
|
public abstract class MediaServerEventAbstract extends ApplicationEvent {
|
||||||
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -11,7 +10,7 @@ public abstract class ZLMEventAbstract extends ApplicationEvent {
|
||||||
private String mediaServerId;
|
private String mediaServerId;
|
||||||
|
|
||||||
|
|
||||||
public ZLMEventAbstract(Object source) {
|
public MediaServerEventAbstract(Object source) {
|
||||||
super(source);
|
super(source);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.genersoft.iot.vmp.media.zlm.event;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* zlm离线事件类
|
||||||
|
*/
|
||||||
|
public class MediaServerOfflineEvent extends MediaServerEventAbstract {
|
||||||
|
|
||||||
|
public MediaServerOfflineEvent(Object source) {
|
||||||
|
super(source);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.genersoft.iot.vmp.media.zlm.event;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* zlm在线事件
|
||||||
|
*/
|
||||||
|
public class MediaServerOnlineEvent extends MediaServerEventAbstract {
|
||||||
|
|
||||||
|
public MediaServerOnlineEvent(Object source) {
|
||||||
|
super(source);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
package com.genersoft.iot.vmp.media.zlm.event;
|
package com.genersoft.iot.vmp.media.zlm.event;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.IPlayService;
|
import com.genersoft.iot.vmp.service.IPlayService;
|
||||||
import com.genersoft.iot.vmp.service.IStreamProxyService;
|
import com.genersoft.iot.vmp.service.IStreamProxyService;
|
||||||
import com.genersoft.iot.vmp.service.IStreamPushService;
|
import com.genersoft.iot.vmp.service.IStreamPushService;
|
||||||
|
@ -20,9 +20,9 @@ import org.springframework.stereotype.Component;
|
||||||
* @date: 2020年5月6日 下午1:51:23
|
* @date: 2020年5月6日 下午1:51:23
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class ZLMStatusEventListener {
|
public class MediaServerStatusEventListener {
|
||||||
|
|
||||||
private final static Logger logger = LoggerFactory.getLogger(ZLMStatusEventListener.class);
|
private final static Logger logger = LoggerFactory.getLogger(MediaServerStatusEventListener.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IStreamPushService streamPushService;
|
private IStreamPushService streamPushService;
|
||||||
|
@ -38,7 +38,7 @@ public class ZLMStatusEventListener {
|
||||||
|
|
||||||
@Async("taskExecutor")
|
@Async("taskExecutor")
|
||||||
@EventListener
|
@EventListener
|
||||||
public void onApplicationEvent(ZLMOnlineEvent event) {
|
public void onApplicationEvent(MediaServerOnlineEvent event) {
|
||||||
logger.info("[ZLM] 上线 ID:" + event.getMediaServerId());
|
logger.info("[ZLM] 上线 ID:" + event.getMediaServerId());
|
||||||
streamPushService.zlmServerOnline(event.getMediaServerId());
|
streamPushService.zlmServerOnline(event.getMediaServerId());
|
||||||
streamProxyService.zlmServerOnline(event.getMediaServerId());
|
streamProxyService.zlmServerOnline(event.getMediaServerId());
|
||||||
|
@ -47,7 +47,7 @@ public class ZLMStatusEventListener {
|
||||||
|
|
||||||
@Async("taskExecutor")
|
@Async("taskExecutor")
|
||||||
@EventListener
|
@EventListener
|
||||||
public void onApplicationEvent(ZLMOfflineEvent event) {
|
public void onApplicationEvent(MediaServerOfflineEvent event) {
|
||||||
|
|
||||||
logger.info("[ZLM] 离线,ID:" + event.getMediaServerId());
|
logger.info("[ZLM] 离线,ID:" + event.getMediaServerId());
|
||||||
// 处理ZLM离线
|
// 处理ZLM离线
|
|
@ -1,11 +0,0 @@
|
||||||
package com.genersoft.iot.vmp.media.zlm.event;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* zlm离线事件类
|
|
||||||
*/
|
|
||||||
public class ZLMOfflineEvent extends ZLMEventAbstract {
|
|
||||||
|
|
||||||
public ZLMOfflineEvent(Object source) {
|
|
||||||
super(source);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
package com.genersoft.iot.vmp.media.zlm.event;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* zlm在线事件
|
|
||||||
*/
|
|
||||||
public class ZLMOnlineEvent extends ZLMEventAbstract {
|
|
||||||
|
|
||||||
public ZLMOnlineEvent(Object source) {
|
|
||||||
super(source);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -10,7 +10,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnRecordMp4HookParam;
|
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnRecordMp4HookParam;
|
||||||
import com.genersoft.iot.vmp.service.ICloudRecordService;
|
import com.genersoft.iot.vmp.service.ICloudRecordService;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.bean.CloudRecordItem;
|
import com.genersoft.iot.vmp.service.bean.CloudRecordItem;
|
||||||
import com.genersoft.iot.vmp.service.bean.DownloadFileInfo;
|
import com.genersoft.iot.vmp.service.bean.DownloadFileInfo;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
|
|
|
@ -19,7 +19,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.service.IDeviceChannelService;
|
import com.genersoft.iot.vmp.service.IDeviceChannelService;
|
||||||
import com.genersoft.iot.vmp.service.IDeviceService;
|
import com.genersoft.iot.vmp.service.IDeviceService;
|
||||||
import com.genersoft.iot.vmp.service.IInviteStreamService;
|
import com.genersoft.iot.vmp.service.IInviteStreamService;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
|
import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
|
||||||
import com.genersoft.iot.vmp.storager.dao.DeviceMapper;
|
import com.genersoft.iot.vmp.storager.dao.DeviceMapper;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.genersoft.iot.vmp.service.impl;
|
package com.genersoft.iot.vmp.service.impl;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
|
||||||
import com.alibaba.fastjson2.JSONArray;
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||||
|
@ -8,7 +7,7 @@ import com.genersoft.iot.vmp.conf.MediaConfig;
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.IMediaService;
|
import com.genersoft.iot.vmp.service.IMediaService;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||||
|
@ -22,13 +21,9 @@ public class MediaServiceImpl implements IMediaService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IRedisCatchStorage redisCatchStorage;
|
private IRedisCatchStorage redisCatchStorage;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IVideoManagerStorage storager;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IMediaServerService mediaServerService;
|
private IMediaServerService mediaServerService;
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MediaConfig mediaConfig;
|
private MediaConfig mediaConfig;
|
||||||
|
|
||||||
|
@ -36,7 +31,6 @@ public class MediaServiceImpl implements IMediaService {
|
||||||
private ZLMRESTfulUtils zlmresTfulUtils;
|
private ZLMRESTfulUtils zlmresTfulUtils;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String callId) {
|
public StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String callId) {
|
||||||
return getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, null, callId, true);
|
return getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, null, callId, true);
|
||||||
|
|
|
@ -15,14 +15,12 @@ import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform;
|
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform;
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
|
import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory;
|
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
|
import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
||||||
import com.genersoft.iot.vmp.service.IInviteStreamService;
|
import com.genersoft.iot.vmp.service.IInviteStreamService;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.IPlatformService;
|
import com.genersoft.iot.vmp.service.IPlatformService;
|
||||||
import com.genersoft.iot.vmp.service.IPlayService;
|
import com.genersoft.iot.vmp.service.IPlayService;
|
||||||
import com.genersoft.iot.vmp.service.bean.*;
|
import com.genersoft.iot.vmp.service.bean.*;
|
||||||
|
@ -31,7 +29,6 @@ import com.genersoft.iot.vmp.storager.dao.*;
|
||||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import gov.nist.javax.sip.message.SIPRequest;
|
|
||||||
import gov.nist.javax.sip.message.SIPResponse;
|
import gov.nist.javax.sip.message.SIPResponse;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -41,17 +38,12 @@ import org.springframework.stereotype.Service;
|
||||||
import javax.sdp.*;
|
import javax.sdp.*;
|
||||||
import javax.sip.InvalidArgumentException;
|
import javax.sip.InvalidArgumentException;
|
||||||
import javax.sip.ResponseEvent;
|
import javax.sip.ResponseEvent;
|
||||||
import javax.sip.PeerUnavailableException;
|
|
||||||
import javax.sip.SipException;
|
import javax.sip.SipException;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -18,6 +18,7 @@ import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander;
|
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
||||||
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
||||||
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.media.zlm.SendRtpPortManager;
|
import com.genersoft.iot.vmp.media.zlm.SendRtpPortManager;
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
|
import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
|
||||||
|
|
|
@ -8,7 +8,6 @@ import com.genersoft.iot.vmp.common.StreamInfo;
|
||||||
import com.genersoft.iot.vmp.conf.DynamicTask;
|
import com.genersoft.iot.vmp.conf.DynamicTask;
|
||||||
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;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
|
import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
|
||||||
|
@ -19,13 +18,12 @@ import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
||||||
import com.genersoft.iot.vmp.service.IGbStreamService;
|
import com.genersoft.iot.vmp.service.IGbStreamService;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.IMediaService;
|
import com.genersoft.iot.vmp.service.IMediaService;
|
||||||
import com.genersoft.iot.vmp.service.IStreamProxyService;
|
import com.genersoft.iot.vmp.service.IStreamProxyService;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||||
import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
|
import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
|
||||||
import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper;
|
|
||||||
import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper;
|
import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper;
|
||||||
import com.genersoft.iot.vmp.storager.dao.StreamProxyMapper;
|
import com.genersoft.iot.vmp.storager.dao.StreamProxyMapper;
|
||||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||||
|
|
|
@ -15,7 +15,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.*;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OriginType;
|
import com.genersoft.iot.vmp.media.zlm.dto.hook.OriginType;
|
||||||
import com.genersoft.iot.vmp.service.IGbStreamService;
|
import com.genersoft.iot.vmp.service.IGbStreamService;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.IStreamPushService;
|
import com.genersoft.iot.vmp.service.IStreamPushService;
|
||||||
import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis;
|
import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
|
|
|
@ -11,7 +11,7 @@ import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory;
|
import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange;
|
import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.bean.*;
|
import com.genersoft.iot.vmp.service.bean.*;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.utils.redis.RedisUtil;
|
import com.genersoft.iot.vmp.utils.redis.RedisUtil;
|
||||||
|
|
|
@ -9,7 +9,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
|
import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.IStreamPushService;
|
import com.genersoft.iot.vmp.service.IStreamPushService;
|
||||||
import com.genersoft.iot.vmp.service.bean.MessageForPushChannel;
|
import com.genersoft.iot.vmp.service.bean.MessageForPushChannel;
|
||||||
import com.genersoft.iot.vmp.service.bean.MessageForPushChannelResponse;
|
import com.genersoft.iot.vmp.service.bean.MessageForPushChannelResponse;
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||||
import com.genersoft.iot.vmp.service.IGbStreamService;
|
import com.genersoft.iot.vmp.service.IGbStreamService;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.IStreamPushService;
|
import com.genersoft.iot.vmp.service.IStreamPushService;
|
||||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
|
@ -1,15 +1,11 @@
|
||||||
package com.genersoft.iot.vmp.vmanager.cloudRecord;
|
package com.genersoft.iot.vmp.vmanager.cloudRecord;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSONArray;
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
import com.genersoft.iot.vmp.conf.DynamicTask;
|
|
||||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
|
||||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||||
import com.genersoft.iot.vmp.conf.security.JwtUtils;
|
import com.genersoft.iot.vmp.conf.security.JwtUtils;
|
||||||
import com.genersoft.iot.vmp.media.zlm.SendRtpPortManager;
|
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
|
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.service.ICloudRecordService;
|
import com.genersoft.iot.vmp.service.ICloudRecordService;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.bean.CloudRecordItem;
|
import com.genersoft.iot.vmp.service.bean.CloudRecordItem;
|
||||||
import com.genersoft.iot.vmp.service.bean.DownloadFileInfo;
|
import com.genersoft.iot.vmp.service.bean.DownloadFileInfo;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||||
|
@ -22,7 +18,6 @@ import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
|
@ -19,7 +19,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.service.IInviteStreamService;
|
import com.genersoft.iot.vmp.service.IInviteStreamService;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.IMediaService;
|
import com.genersoft.iot.vmp.service.IMediaService;
|
||||||
import com.genersoft.iot.vmp.service.IPlayService;
|
import com.genersoft.iot.vmp.service.IPlayService;
|
||||||
import com.genersoft.iot.vmp.service.bean.InviteErrorCode;
|
import com.genersoft.iot.vmp.service.bean.InviteErrorCode;
|
||||||
|
|
|
@ -14,7 +14,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForRtpServerTimeout;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange;
|
import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnRtpServerTimeoutHookParam;
|
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnRtpServerTimeoutHookParam;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
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.OtherPsSendInfo;
|
import com.genersoft.iot.vmp.vmanager.bean.OtherPsSendInfo;
|
||||||
|
|
|
@ -14,7 +14,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForRtpServerTimeout;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange;
|
import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnRtpServerTimeoutHookParam;
|
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnRtpServerTimeoutHookParam;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
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.OtherRtpSendInfo;
|
import com.genersoft.iot.vmp.vmanager.bean.OtherRtpSendInfo;
|
||||||
|
|
|
@ -9,6 +9,7 @@ import com.genersoft.iot.vmp.conf.UserSetting;
|
||||||
import com.genersoft.iot.vmp.conf.VersionInfo;
|
import com.genersoft.iot.vmp.conf.VersionInfo;
|
||||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||||
import com.genersoft.iot.vmp.conf.security.JwtUtils;
|
import com.genersoft.iot.vmp.conf.security.JwtUtils;
|
||||||
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.media.zlm.SendRtpPortManager;
|
import com.genersoft.iot.vmp.media.zlm.SendRtpPortManager;
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
|
import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.IHookSubscribe;
|
import com.genersoft.iot.vmp.media.zlm.dto.IHookSubscribe;
|
||||||
|
|
|
@ -9,7 +9,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
|
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.IStreamProxyService;
|
import com.genersoft.iot.vmp.service.IStreamProxyService;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
|
import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
|
||||||
|
|
|
@ -13,7 +13,7 @@ import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
|
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
|
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.IMediaService;
|
import com.genersoft.iot.vmp.service.IMediaService;
|
||||||
import com.genersoft.iot.vmp.service.IStreamPushService;
|
import com.genersoft.iot.vmp.service.IStreamPushService;
|
||||||
import com.genersoft.iot.vmp.service.impl.StreamPushUploadFileHandler;
|
import com.genersoft.iot.vmp.service.impl.StreamPushUploadFileHandler;
|
||||||
|
|
|
@ -0,0 +1,325 @@
|
||||||
|
/*建表*/
|
||||||
|
create table wvp_device (
|
||||||
|
id serial primary key ,
|
||||||
|
device_id character varying(50) not null ,
|
||||||
|
name character varying(255),
|
||||||
|
manufacturer character varying(255),
|
||||||
|
model character varying(255),
|
||||||
|
firmware character varying(255),
|
||||||
|
transport character varying(50),
|
||||||
|
stream_mode character varying(50),
|
||||||
|
on_line bool default false,
|
||||||
|
register_time character varying(50),
|
||||||
|
keepalive_time character varying(50),
|
||||||
|
ip character varying(50),
|
||||||
|
create_time character varying(50),
|
||||||
|
update_time character varying(50),
|
||||||
|
port integer,
|
||||||
|
expires integer,
|
||||||
|
subscribe_cycle_for_catalog integer DEFAULT 0,
|
||||||
|
subscribe_cycle_for_mobile_position integer DEFAULT 0,
|
||||||
|
mobile_position_submission_interval integer DEFAULT 5,
|
||||||
|
subscribe_cycle_for_alarm integer DEFAULT 0,
|
||||||
|
host_address character varying(50),
|
||||||
|
charset character varying(50),
|
||||||
|
ssrc_check bool default false,
|
||||||
|
geo_coord_sys character varying(50),
|
||||||
|
media_server_id character varying(50),
|
||||||
|
custom_name character varying(255),
|
||||||
|
sdp_ip character varying(50),
|
||||||
|
local_ip character varying(50),
|
||||||
|
password character varying(255),
|
||||||
|
as_message_channel bool default false,
|
||||||
|
keepalive_interval_time integer,
|
||||||
|
switch_primary_sub_stream bool default false,
|
||||||
|
broadcast_push_after_ack bool default false,
|
||||||
|
constraint uk_device_device unique (device_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table wvp_device_alarm (
|
||||||
|
id serial primary key ,
|
||||||
|
device_id character varying(50) not null,
|
||||||
|
channel_id character varying(50) not null,
|
||||||
|
alarm_priority character varying(50),
|
||||||
|
alarm_method character varying(50),
|
||||||
|
alarm_time character varying(50),
|
||||||
|
alarm_description character varying(255),
|
||||||
|
longitude double precision,
|
||||||
|
latitude double precision,
|
||||||
|
alarm_type character varying(50),
|
||||||
|
create_time character varying(50) not null
|
||||||
|
);
|
||||||
|
|
||||||
|
create table wvp_device_channel (
|
||||||
|
id serial primary key ,
|
||||||
|
channel_id character varying(50) not null,
|
||||||
|
name character varying(255),
|
||||||
|
custom_name character varying(255),
|
||||||
|
manufacture character varying(50),
|
||||||
|
model character varying(50),
|
||||||
|
owner character varying(50),
|
||||||
|
civil_code character varying(50),
|
||||||
|
block character varying(50),
|
||||||
|
address character varying(50),
|
||||||
|
parent_id character varying(50),
|
||||||
|
safety_way integer,
|
||||||
|
register_way integer,
|
||||||
|
cert_num character varying(50),
|
||||||
|
certifiable integer,
|
||||||
|
err_code integer,
|
||||||
|
end_time character varying(50),
|
||||||
|
secrecy character varying(50),
|
||||||
|
ip_address character varying(50),
|
||||||
|
port integer,
|
||||||
|
password character varying(255),
|
||||||
|
ptz_type integer,
|
||||||
|
custom_ptz_type integer,
|
||||||
|
status bool default false,
|
||||||
|
longitude double precision,
|
||||||
|
custom_longitude double precision,
|
||||||
|
latitude double precision,
|
||||||
|
custom_latitude double precision,
|
||||||
|
stream_id character varying(255),
|
||||||
|
device_id character varying(50) not null,
|
||||||
|
parental character varying(50),
|
||||||
|
has_audio bool default false,
|
||||||
|
create_time character varying(50) not null,
|
||||||
|
update_time character varying(50) not null,
|
||||||
|
sub_count integer,
|
||||||
|
longitude_gcj02 double precision,
|
||||||
|
latitude_gcj02 double precision,
|
||||||
|
longitude_wgs84 double precision,
|
||||||
|
latitude_wgs84 double precision,
|
||||||
|
business_group_id character varying(50),
|
||||||
|
gps_time character varying(50),
|
||||||
|
stream_identification character varying(50),
|
||||||
|
constraint uk_wvp_device_channel_unique_device_channel unique (device_id, channel_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table wvp_device_mobile_position (
|
||||||
|
id serial primary key,
|
||||||
|
device_id character varying(50) not null,
|
||||||
|
channel_id character varying(50) not null,
|
||||||
|
device_name character varying(255),
|
||||||
|
time character varying(50),
|
||||||
|
longitude double precision,
|
||||||
|
latitude double precision,
|
||||||
|
altitude double precision,
|
||||||
|
speed double precision,
|
||||||
|
direction double precision,
|
||||||
|
report_source character varying(50),
|
||||||
|
longitude_gcj02 double precision,
|
||||||
|
latitude_gcj02 double precision,
|
||||||
|
longitude_wgs84 double precision,
|
||||||
|
latitude_wgs84 double precision,
|
||||||
|
create_time character varying(50)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table wvp_gb_stream (
|
||||||
|
gb_stream_id serial primary key,
|
||||||
|
app character varying(255) not null,
|
||||||
|
stream character varying(255) not null,
|
||||||
|
gb_id character varying(50) not null,
|
||||||
|
name character varying(255),
|
||||||
|
longitude double precision,
|
||||||
|
latitude double precision,
|
||||||
|
stream_type character varying(50),
|
||||||
|
media_server_id character varying(50),
|
||||||
|
create_time character varying(50),
|
||||||
|
constraint uk_gb_stream_unique_gb_id unique (gb_id),
|
||||||
|
constraint uk_gb_stream_unique_app_stream unique (app, stream)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table wvp_log (
|
||||||
|
id serial primary key ,
|
||||||
|
name character varying(50),
|
||||||
|
type character varying(50),
|
||||||
|
uri character varying(200),
|
||||||
|
address character varying(50),
|
||||||
|
result character varying(50),
|
||||||
|
timing bigint,
|
||||||
|
username character varying(50),
|
||||||
|
create_time character varying(50)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table wvp_media_server (
|
||||||
|
id character varying(255) primary key ,
|
||||||
|
ip character varying(50),
|
||||||
|
hook_ip character varying(50),
|
||||||
|
sdp_ip character varying(50),
|
||||||
|
stream_ip character varying(50),
|
||||||
|
http_port integer,
|
||||||
|
http_ssl_port integer,
|
||||||
|
rtmp_port integer,
|
||||||
|
rtmp_ssl_port integer,
|
||||||
|
rtp_proxy_port integer,
|
||||||
|
rtsp_port integer,
|
||||||
|
rtsp_ssl_port integer,
|
||||||
|
auto_config bool default false,
|
||||||
|
secret character varying(50),
|
||||||
|
type character varying(50) default 'zlm',
|
||||||
|
rtp_enable bool default false,
|
||||||
|
rtp_port_range character varying(50),
|
||||||
|
send_rtp_port_range character varying(50),
|
||||||
|
record_assist_port integer,
|
||||||
|
default_server bool default false,
|
||||||
|
create_time character varying(50),
|
||||||
|
update_time character varying(50),
|
||||||
|
hook_alive_interval integer,
|
||||||
|
record_path character varying(255),
|
||||||
|
record_day integer default 7,
|
||||||
|
constraint uk_media_server_unique_ip_http_port unique (ip, http_port)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table wvp_platform (
|
||||||
|
id serial primary key ,
|
||||||
|
enable bool default false,
|
||||||
|
name character varying(255),
|
||||||
|
server_gb_id character varying(50),
|
||||||
|
server_gb_domain character varying(50),
|
||||||
|
server_ip character varying(50),
|
||||||
|
server_port integer,
|
||||||
|
device_gb_id character varying(50),
|
||||||
|
device_ip character varying(50),
|
||||||
|
device_port character varying(50),
|
||||||
|
username character varying(255),
|
||||||
|
password character varying(50),
|
||||||
|
expires character varying(50),
|
||||||
|
keep_timeout character varying(50),
|
||||||
|
transport character varying(50),
|
||||||
|
character_set character varying(50),
|
||||||
|
catalog_id character varying(50),
|
||||||
|
ptz bool default false,
|
||||||
|
rtcp bool default false,
|
||||||
|
status bool default false,
|
||||||
|
start_offline_push bool default false,
|
||||||
|
administrative_division character varying(50),
|
||||||
|
catalog_group integer,
|
||||||
|
create_time character varying(50),
|
||||||
|
update_time character varying(50),
|
||||||
|
as_message_channel bool default false,
|
||||||
|
auto_push_channel bool default false,
|
||||||
|
constraint uk_platform_unique_server_gb_id unique (server_gb_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table wvp_platform_catalog (
|
||||||
|
id character varying(50),
|
||||||
|
platform_id character varying(50),
|
||||||
|
name character varying(255),
|
||||||
|
parent_id character varying(50),
|
||||||
|
civil_code character varying(50),
|
||||||
|
business_group_id character varying(50),
|
||||||
|
constraint uk_platform_catalog_id_platform_id unique (id, platform_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table wvp_platform_gb_channel (
|
||||||
|
id serial primary key ,
|
||||||
|
platform_id character varying(50),
|
||||||
|
catalog_id character varying(50),
|
||||||
|
device_channel_id integer,
|
||||||
|
constraint uk_platform_gb_channel_platform_id_catalog_id_device_channel_id unique (platform_id, catalog_id, device_channel_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table wvp_platform_gb_stream (
|
||||||
|
id serial primary key,
|
||||||
|
platform_id character varying(50),
|
||||||
|
catalog_id character varying(50),
|
||||||
|
gb_stream_id integer,
|
||||||
|
constraint uk_platform_gb_stream_platform_id_catalog_id_gb_stream_id unique (platform_id, catalog_id, gb_stream_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table wvp_stream_proxy (
|
||||||
|
id serial primary key,
|
||||||
|
type character varying(50),
|
||||||
|
app character varying(255),
|
||||||
|
stream character varying(255),
|
||||||
|
url character varying(255),
|
||||||
|
src_url character varying(255),
|
||||||
|
dst_url character varying(255),
|
||||||
|
timeout_ms integer,
|
||||||
|
ffmpeg_cmd_key character varying(255),
|
||||||
|
rtp_type character varying(50),
|
||||||
|
media_server_id character varying(50),
|
||||||
|
enable_audio bool default false,
|
||||||
|
enable_mp4 bool default false,
|
||||||
|
enable bool default false,
|
||||||
|
status boolean,
|
||||||
|
enable_remove_none_reader bool default false,
|
||||||
|
create_time character varying(50),
|
||||||
|
name character varying(255),
|
||||||
|
update_time character varying(50),
|
||||||
|
stream_key character varying(255),
|
||||||
|
enable_disable_none_reader bool default false,
|
||||||
|
constraint uk_stream_proxy_app_stream unique (app, stream)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table wvp_stream_push (
|
||||||
|
id serial primary key,
|
||||||
|
app character varying(255),
|
||||||
|
stream character varying(255),
|
||||||
|
total_reader_count character varying(50),
|
||||||
|
origin_type integer,
|
||||||
|
origin_type_str character varying(50),
|
||||||
|
create_time character varying(50),
|
||||||
|
alive_second integer,
|
||||||
|
media_server_id character varying(50),
|
||||||
|
server_id character varying(50),
|
||||||
|
push_time character varying(50),
|
||||||
|
status bool default false,
|
||||||
|
update_time character varying(50),
|
||||||
|
push_ing bool default false,
|
||||||
|
self bool default false,
|
||||||
|
constraint uk_stream_push_app_stream unique (app, stream)
|
||||||
|
);
|
||||||
|
create table wvp_cloud_record (
|
||||||
|
id serial primary key,
|
||||||
|
app character varying(255),
|
||||||
|
stream character varying(255),
|
||||||
|
call_id character varying(255),
|
||||||
|
start_time bigint,
|
||||||
|
end_time bigint,
|
||||||
|
media_server_id character varying(50),
|
||||||
|
file_name character varying(255),
|
||||||
|
folder character varying(255),
|
||||||
|
file_path character varying(255),
|
||||||
|
collect bool default false,
|
||||||
|
file_size bigint,
|
||||||
|
time_len bigint,
|
||||||
|
constraint uk_stream_push_app_stream_path unique (app, stream, file_path)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table wvp_user (
|
||||||
|
id serial primary key,
|
||||||
|
username character varying(255),
|
||||||
|
password character varying(255),
|
||||||
|
role_id integer,
|
||||||
|
create_time character varying(50),
|
||||||
|
update_time character varying(50),
|
||||||
|
push_key character varying(50),
|
||||||
|
constraint uk_user_username unique (username)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table wvp_user_role (
|
||||||
|
id serial primary key,
|
||||||
|
name character varying(50),
|
||||||
|
authority character varying(50),
|
||||||
|
create_time character varying(50),
|
||||||
|
update_time character varying(50)
|
||||||
|
);
|
||||||
|
create table wvp_resources_tree (
|
||||||
|
id serial primary key ,
|
||||||
|
is_catalog bool default true,
|
||||||
|
device_channel_id integer ,
|
||||||
|
gb_stream_id integer,
|
||||||
|
name character varying(255),
|
||||||
|
parentId integer,
|
||||||
|
path character varying(255)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/*初始数据*/
|
||||||
|
INSERT INTO wvp_user VALUES (1, 'admin','21232f297a57a5a743894a0e4a801fc3',1,'2021-04-13 14:14:57','2021-04-13 14:14:57','3e80d1762a324d5b0ff636e0bd16f1e3');
|
||||||
|
INSERT INTO wvp_user_role VALUES (1, 'admin','0','2021-04-13 14:14:57','2021-04-13 14:14:57');
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,325 @@
|
||||||
|
/*建表*/
|
||||||
|
create table wvp_device (
|
||||||
|
id serial primary key ,
|
||||||
|
device_id character varying(50) not null ,
|
||||||
|
name character varying(255),
|
||||||
|
manufacturer character varying(255),
|
||||||
|
model character varying(255),
|
||||||
|
firmware character varying(255),
|
||||||
|
transport character varying(50),
|
||||||
|
stream_mode character varying(50),
|
||||||
|
on_line bool default false,
|
||||||
|
register_time character varying(50),
|
||||||
|
keepalive_time character varying(50),
|
||||||
|
ip character varying(50),
|
||||||
|
create_time character varying(50),
|
||||||
|
update_time character varying(50),
|
||||||
|
port integer,
|
||||||
|
expires integer,
|
||||||
|
subscribe_cycle_for_catalog integer DEFAULT 0,
|
||||||
|
subscribe_cycle_for_mobile_position integer DEFAULT 0,
|
||||||
|
mobile_position_submission_interval integer DEFAULT 5,
|
||||||
|
subscribe_cycle_for_alarm integer DEFAULT 0,
|
||||||
|
host_address character varying(50),
|
||||||
|
charset character varying(50),
|
||||||
|
ssrc_check bool default false,
|
||||||
|
geo_coord_sys character varying(50),
|
||||||
|
media_server_id character varying(50),
|
||||||
|
custom_name character varying(255),
|
||||||
|
sdp_ip character varying(50),
|
||||||
|
local_ip character varying(50),
|
||||||
|
password character varying(255),
|
||||||
|
as_message_channel bool default false,
|
||||||
|
keepalive_interval_time integer,
|
||||||
|
switch_primary_sub_stream bool default false,
|
||||||
|
broadcast_push_after_ack bool default false,
|
||||||
|
constraint uk_device_device unique (device_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table wvp_device_alarm (
|
||||||
|
id serial primary key ,
|
||||||
|
device_id character varying(50) not null,
|
||||||
|
channel_id character varying(50) not null,
|
||||||
|
alarm_priority character varying(50),
|
||||||
|
alarm_method character varying(50),
|
||||||
|
alarm_time character varying(50),
|
||||||
|
alarm_description character varying(255),
|
||||||
|
longitude double precision,
|
||||||
|
latitude double precision,
|
||||||
|
alarm_type character varying(50),
|
||||||
|
create_time character varying(50) not null
|
||||||
|
);
|
||||||
|
|
||||||
|
create table wvp_device_channel (
|
||||||
|
id serial primary key ,
|
||||||
|
channel_id character varying(50) not null,
|
||||||
|
name character varying(255),
|
||||||
|
custom_name character varying(255),
|
||||||
|
manufacture character varying(50),
|
||||||
|
model character varying(50),
|
||||||
|
owner character varying(50),
|
||||||
|
civil_code character varying(50),
|
||||||
|
block character varying(50),
|
||||||
|
address character varying(50),
|
||||||
|
parent_id character varying(50),
|
||||||
|
safety_way integer,
|
||||||
|
register_way integer,
|
||||||
|
cert_num character varying(50),
|
||||||
|
certifiable integer,
|
||||||
|
err_code integer,
|
||||||
|
end_time character varying(50),
|
||||||
|
secrecy character varying(50),
|
||||||
|
ip_address character varying(50),
|
||||||
|
port integer,
|
||||||
|
password character varying(255),
|
||||||
|
ptz_type integer,
|
||||||
|
custom_ptz_type integer,
|
||||||
|
status bool default false,
|
||||||
|
longitude double precision,
|
||||||
|
custom_longitude double precision,
|
||||||
|
latitude double precision,
|
||||||
|
custom_latitude double precision,
|
||||||
|
stream_id character varying(255),
|
||||||
|
device_id character varying(50) not null,
|
||||||
|
parental character varying(50),
|
||||||
|
has_audio bool default false,
|
||||||
|
create_time character varying(50) not null,
|
||||||
|
update_time character varying(50) not null,
|
||||||
|
sub_count integer,
|
||||||
|
longitude_gcj02 double precision,
|
||||||
|
latitude_gcj02 double precision,
|
||||||
|
longitude_wgs84 double precision,
|
||||||
|
latitude_wgs84 double precision,
|
||||||
|
business_group_id character varying(50),
|
||||||
|
gps_time character varying(50),
|
||||||
|
stream_identification character varying(50),
|
||||||
|
constraint uk_wvp_device_channel_unique_device_channel unique (device_id, channel_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table wvp_device_mobile_position (
|
||||||
|
id serial primary key,
|
||||||
|
device_id character varying(50) not null,
|
||||||
|
channel_id character varying(50) not null,
|
||||||
|
device_name character varying(255),
|
||||||
|
time character varying(50),
|
||||||
|
longitude double precision,
|
||||||
|
latitude double precision,
|
||||||
|
altitude double precision,
|
||||||
|
speed double precision,
|
||||||
|
direction double precision,
|
||||||
|
report_source character varying(50),
|
||||||
|
longitude_gcj02 double precision,
|
||||||
|
latitude_gcj02 double precision,
|
||||||
|
longitude_wgs84 double precision,
|
||||||
|
latitude_wgs84 double precision,
|
||||||
|
create_time character varying(50)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table wvp_gb_stream (
|
||||||
|
gb_stream_id serial primary key,
|
||||||
|
app character varying(255) not null,
|
||||||
|
stream character varying(255) not null,
|
||||||
|
gb_id character varying(50) not null,
|
||||||
|
name character varying(255),
|
||||||
|
longitude double precision,
|
||||||
|
latitude double precision,
|
||||||
|
stream_type character varying(50),
|
||||||
|
media_server_id character varying(50),
|
||||||
|
create_time character varying(50),
|
||||||
|
constraint uk_gb_stream_unique_gb_id unique (gb_id),
|
||||||
|
constraint uk_gb_stream_unique_app_stream unique (app, stream)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table wvp_log (
|
||||||
|
id serial primary key ,
|
||||||
|
name character varying(50),
|
||||||
|
type character varying(50),
|
||||||
|
uri character varying(200),
|
||||||
|
address character varying(50),
|
||||||
|
result character varying(50),
|
||||||
|
timing bigint,
|
||||||
|
username character varying(50),
|
||||||
|
create_time character varying(50)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table wvp_media_server (
|
||||||
|
id character varying(255) primary key ,
|
||||||
|
ip character varying(50),
|
||||||
|
hook_ip character varying(50),
|
||||||
|
sdp_ip character varying(50),
|
||||||
|
stream_ip character varying(50),
|
||||||
|
http_port integer,
|
||||||
|
http_ssl_port integer,
|
||||||
|
rtmp_port integer,
|
||||||
|
rtmp_ssl_port integer,
|
||||||
|
rtp_proxy_port integer,
|
||||||
|
rtsp_port integer,
|
||||||
|
rtsp_ssl_port integer,
|
||||||
|
auto_config bool default false,
|
||||||
|
secret character varying(50),
|
||||||
|
type character varying(50) default 'zlm',
|
||||||
|
rtp_enable bool default false,
|
||||||
|
rtp_port_range character varying(50),
|
||||||
|
send_rtp_port_range character varying(50),
|
||||||
|
record_assist_port integer,
|
||||||
|
default_server bool default false,
|
||||||
|
create_time character varying(50),
|
||||||
|
update_time character varying(50),
|
||||||
|
hook_alive_interval integer,
|
||||||
|
record_path character varying(255),
|
||||||
|
record_day integer default 7,
|
||||||
|
constraint uk_media_server_unique_ip_http_port unique (ip, http_port)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table wvp_platform (
|
||||||
|
id serial primary key ,
|
||||||
|
enable bool default false,
|
||||||
|
name character varying(255),
|
||||||
|
server_gb_id character varying(50),
|
||||||
|
server_gb_domain character varying(50),
|
||||||
|
server_ip character varying(50),
|
||||||
|
server_port integer,
|
||||||
|
device_gb_id character varying(50),
|
||||||
|
device_ip character varying(50),
|
||||||
|
device_port character varying(50),
|
||||||
|
username character varying(255),
|
||||||
|
password character varying(50),
|
||||||
|
expires character varying(50),
|
||||||
|
keep_timeout character varying(50),
|
||||||
|
transport character varying(50),
|
||||||
|
character_set character varying(50),
|
||||||
|
catalog_id character varying(50),
|
||||||
|
ptz bool default false,
|
||||||
|
rtcp bool default false,
|
||||||
|
status bool default false,
|
||||||
|
start_offline_push bool default false,
|
||||||
|
administrative_division character varying(50),
|
||||||
|
catalog_group integer,
|
||||||
|
create_time character varying(50),
|
||||||
|
update_time character varying(50),
|
||||||
|
as_message_channel bool default false,
|
||||||
|
auto_push_channel bool default false,
|
||||||
|
constraint uk_platform_unique_server_gb_id unique (server_gb_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table wvp_platform_catalog (
|
||||||
|
id character varying(50),
|
||||||
|
platform_id character varying(50),
|
||||||
|
name character varying(255),
|
||||||
|
parent_id character varying(50),
|
||||||
|
civil_code character varying(50),
|
||||||
|
business_group_id character varying(50),
|
||||||
|
constraint uk_platform_catalog_id_platform_id unique (id, platform_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table wvp_platform_gb_channel (
|
||||||
|
id serial primary key ,
|
||||||
|
platform_id character varying(50),
|
||||||
|
catalog_id character varying(50),
|
||||||
|
device_channel_id integer,
|
||||||
|
constraint uk_platform_gb_channel_platform_id_catalog_id_device_channel_id unique (platform_id, catalog_id, device_channel_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table wvp_platform_gb_stream (
|
||||||
|
id serial primary key,
|
||||||
|
platform_id character varying(50),
|
||||||
|
catalog_id character varying(50),
|
||||||
|
gb_stream_id integer,
|
||||||
|
constraint uk_platform_gb_stream_platform_id_catalog_id_gb_stream_id unique (platform_id, catalog_id, gb_stream_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table wvp_stream_proxy (
|
||||||
|
id serial primary key,
|
||||||
|
type character varying(50),
|
||||||
|
app character varying(255),
|
||||||
|
stream character varying(255),
|
||||||
|
url character varying(255),
|
||||||
|
src_url character varying(255),
|
||||||
|
dst_url character varying(255),
|
||||||
|
timeout_ms integer,
|
||||||
|
ffmpeg_cmd_key character varying(255),
|
||||||
|
rtp_type character varying(50),
|
||||||
|
media_server_id character varying(50),
|
||||||
|
enable_audio bool default false,
|
||||||
|
enable_mp4 bool default false,
|
||||||
|
enable bool default false,
|
||||||
|
status boolean,
|
||||||
|
enable_remove_none_reader bool default false,
|
||||||
|
create_time character varying(50),
|
||||||
|
name character varying(255),
|
||||||
|
update_time character varying(50),
|
||||||
|
stream_key character varying(255),
|
||||||
|
enable_disable_none_reader bool default false,
|
||||||
|
constraint uk_stream_proxy_app_stream unique (app, stream)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table wvp_stream_push (
|
||||||
|
id serial primary key,
|
||||||
|
app character varying(255),
|
||||||
|
stream character varying(255),
|
||||||
|
total_reader_count character varying(50),
|
||||||
|
origin_type integer,
|
||||||
|
origin_type_str character varying(50),
|
||||||
|
create_time character varying(50),
|
||||||
|
alive_second integer,
|
||||||
|
media_server_id character varying(50),
|
||||||
|
server_id character varying(50),
|
||||||
|
push_time character varying(50),
|
||||||
|
status bool default false,
|
||||||
|
update_time character varying(50),
|
||||||
|
push_ing bool default false,
|
||||||
|
self bool default false,
|
||||||
|
constraint uk_stream_push_app_stream unique (app, stream)
|
||||||
|
);
|
||||||
|
create table wvp_cloud_record (
|
||||||
|
id serial primary key,
|
||||||
|
app character varying(255),
|
||||||
|
stream character varying(255),
|
||||||
|
call_id character varying(255),
|
||||||
|
start_time int8,
|
||||||
|
end_time int8,
|
||||||
|
media_server_id character varying(50),
|
||||||
|
file_name character varying(255),
|
||||||
|
folder character varying(255),
|
||||||
|
file_path character varying(255),
|
||||||
|
collect bool default false,
|
||||||
|
file_size int8,
|
||||||
|
time_len int8,
|
||||||
|
constraint uk_stream_push_app_stream_path unique (app, stream, file_path)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table wvp_user (
|
||||||
|
id serial primary key,
|
||||||
|
username character varying(255),
|
||||||
|
password character varying(255),
|
||||||
|
role_id integer,
|
||||||
|
create_time character varying(50),
|
||||||
|
update_time character varying(50),
|
||||||
|
push_key character varying(50),
|
||||||
|
constraint uk_user_username unique (username)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table wvp_user_role (
|
||||||
|
id serial primary key,
|
||||||
|
name character varying(50),
|
||||||
|
authority character varying(50),
|
||||||
|
create_time character varying(50),
|
||||||
|
update_time character varying(50)
|
||||||
|
);
|
||||||
|
create table wvp_resources_tree (
|
||||||
|
id serial primary key ,
|
||||||
|
is_catalog bool default true,
|
||||||
|
device_channel_id integer ,
|
||||||
|
gb_stream_id integer,
|
||||||
|
name character varying(255),
|
||||||
|
parentId integer,
|
||||||
|
path character varying(255)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/*初始数据*/
|
||||||
|
INSERT INTO wvp_user VALUES (1, 'admin','21232f297a57a5a743894a0e4a801fc3',1,'2021-04-13 14:14:57','2021-04-13 14:14:57','3e80d1762a324d5b0ff636e0bd16f1e3');
|
||||||
|
INSERT INTO wvp_user_role VALUES (1, 'admin','0','2021-04-13 14:14:57','2021-04-13 14:14:57');
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
alter table wvp_media_server
|
||||||
|
add type character varying(50) default 'zlm',;
|
|
@ -0,0 +1,2 @@
|
||||||
|
alter table wvp_media_server
|
||||||
|
add type character varying(50) default 'zlm',;
|
Loading…
Reference in New Issue