优化代码,升级版本号为2.7.1
parent
cf8320e749
commit
54b878d2e1
2
pom.xml
2
pom.xml
|
@ -11,7 +11,7 @@
|
|||
|
||||
<groupId>com.genersoft</groupId>
|
||||
<artifactId>wvp-pro</artifactId>
|
||||
<version>2.7.0</version>
|
||||
<version>2.7.1</version>
|
||||
<name>web video platform</name>
|
||||
<description>国标28181视频平台</description>
|
||||
<packaging>${project.packaging}</packaging>
|
||||
|
|
|
@ -3,6 +3,9 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl;
|
|||
import com.alibaba.fastjson2.JSONObject;
|
||||
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.SsrcTransactionNotFoundException;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.AudioBroadcastCatch;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
|
||||
|
@ -25,12 +28,15 @@ import org.springframework.beans.factory.InitializingBean;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.sip.InvalidArgumentException;
|
||||
import javax.sip.RequestEvent;
|
||||
import javax.sip.SipException;
|
||||
import javax.sip.address.SipURI;
|
||||
import javax.sip.header.CallIdHeader;
|
||||
import javax.sip.header.FromHeader;
|
||||
import javax.sip.header.HeaderAddress;
|
||||
import javax.sip.header.ToHeader;
|
||||
import java.text.ParseException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -115,19 +121,24 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In
|
|||
ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(fromUserId);
|
||||
|
||||
if (parentPlatform != null) {
|
||||
Map<String, Object> param = getSendRtpParam(sendRtpItem);
|
||||
if (!userSetting.getServerId().equals(sendRtpItem.getServerId())) {
|
||||
RequestPushStreamMsg requestPushStreamMsg = RequestPushStreamMsg.getInstance(
|
||||
sendRtpItem.getMediaServerId(), sendRtpItem.getApp(), sendRtpItem.getStream(),
|
||||
sendRtpItem.getIp(), sendRtpItem.getPort(), sendRtpItem.getSsrc(), sendRtpItem.isTcp(),
|
||||
sendRtpItem.getLocalPort(), sendRtpItem.getPt(), sendRtpItem.isUsePs(), sendRtpItem.isOnlyAudio());
|
||||
redisGbPlayMsgListener.sendMsgForStartSendRtpStream(sendRtpItem.getServerId(), requestPushStreamMsg, json -> {
|
||||
playService.startSendRtpStreamHand(sendRtpItem, parentPlatform, json, param, callIdHeader);
|
||||
playService.startSendRtpStreamFailHand(sendRtpItem, parentPlatform, callIdHeader);
|
||||
});
|
||||
} else {
|
||||
JSONObject startSendRtpStreamResult = sendRtp(sendRtpItem, mediaInfo, param);
|
||||
if (startSendRtpStreamResult != null) {
|
||||
playService.startSendRtpStreamHand(sendRtpItem, parentPlatform, startSendRtpStreamResult, param, callIdHeader);
|
||||
try {
|
||||
if (sendRtpItem.isTcpActive()) {
|
||||
mediaServerService.startSendRtpPassive(mediaInfo, parentPlatform, sendRtpItem, null);
|
||||
} else {
|
||||
mediaServerService.startSendRtpStream(mediaInfo, parentPlatform, sendRtpItem);
|
||||
}
|
||||
}catch (ControllerException e) {
|
||||
logger.error("RTP推流失败: {}", e.getMessage());
|
||||
playService.startSendRtpStreamFailHand(sendRtpItem, parentPlatform, callIdHeader);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
|
@ -144,56 +155,17 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In
|
|||
logger.warn("[收到ACK]:来自{},目标为({})的推流信息为找到流体服务[{}]信息",fromUserId, toUserId, sendRtpItem.getMediaServerId());
|
||||
return;
|
||||
}
|
||||
Map<String, Object> param = getSendRtpParam(sendRtpItem);
|
||||
JSONObject startSendRtpStreamResult = sendRtp(sendRtpItem, mediaInfo, param);
|
||||
if (startSendRtpStreamResult != null) {
|
||||
playService.startSendRtpStreamHand(sendRtpItem, device, startSendRtpStreamResult, param, callIdHeader);
|
||||
try {
|
||||
if (sendRtpItem.isTcpActive()) {
|
||||
mediaServerService.startSendRtpPassive(mediaInfo, null, sendRtpItem, null);
|
||||
} else {
|
||||
mediaServerService.startSendRtpStream(mediaInfo, null, sendRtpItem);
|
||||
}
|
||||
}catch (ControllerException e) {
|
||||
logger.error("RTP推流失败: {}", e.getMessage());
|
||||
playService.startSendRtpStreamFailHand(sendRtpItem, null, callIdHeader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, Object> getSendRtpParam(SendRtpItem sendRtpItem) {
|
||||
String isUdp = sendRtpItem.isTcp() ? "0" : "1";
|
||||
Map<String, Object> param = new HashMap<>(12);
|
||||
param.put("vhost","__defaultVhost__");
|
||||
param.put("app",sendRtpItem.getApp());
|
||||
param.put("stream",sendRtpItem.getStream());
|
||||
param.put("ssrc", sendRtpItem.getSsrc());
|
||||
param.put("dst_url",sendRtpItem.getIp());
|
||||
param.put("dst_port", sendRtpItem.getPort());
|
||||
param.put("src_port", sendRtpItem.getLocalPort());
|
||||
param.put("pt", sendRtpItem.getPt());
|
||||
param.put("use_ps", sendRtpItem.isUsePs() ? "1" : "0");
|
||||
param.put("only_audio", sendRtpItem.isOnlyAudio() ? "1" : "0");
|
||||
param.put("is_udp", isUdp);
|
||||
if (!sendRtpItem.isTcp()) {
|
||||
// udp模式下开启rtcp保活
|
||||
param.put("udp_rtcp_timeout", sendRtpItem.isRtcp()? "1":"0");
|
||||
}
|
||||
return param;
|
||||
}
|
||||
|
||||
private JSONObject sendRtp(SendRtpItem sendRtpItem, MediaServer mediaInfo, Map<String, Object> param){
|
||||
JSONObject startSendRtpStreamResult = null;
|
||||
if (sendRtpItem.getLocalPort() != 0) {
|
||||
if (sendRtpItem.isTcpActive()) {
|
||||
startSendRtpStreamResult = zlmServerFactory.startSendRtpPassive(mediaInfo, param);
|
||||
}else {
|
||||
param.put("dst_url", sendRtpItem.getIp());
|
||||
param.put("dst_port", sendRtpItem.getPort());
|
||||
startSendRtpStreamResult = zlmServerFactory.startSendRtpStream(mediaInfo, param);
|
||||
}
|
||||
}else {
|
||||
if (sendRtpItem.isTcpActive()) {
|
||||
startSendRtpStreamResult = zlmServerFactory.startSendRtpPassive(mediaInfo, param);
|
||||
}else {
|
||||
param.put("dst_url", sendRtpItem.getIp());
|
||||
param.put("dst_port", sendRtpItem.getPort());
|
||||
startSendRtpStreamResult = zlmServerFactory.startSendRtpStream(mediaInfo, param);
|
||||
}
|
||||
}
|
||||
return startSendRtpStreamResult;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -641,7 +641,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
|||
CallIdHeader callIdHeader, MediaServer mediaServerItem,
|
||||
int port, Boolean tcpActive, boolean mediaTransmissionTCP,
|
||||
String channelId, String addressStr, String ssrc, String requesterId) {
|
||||
Boolean streamReady = zlmServerFactory.isStreamReady(mediaServerItem, gbStream.getApp(), gbStream.getStream());
|
||||
Boolean streamReady = mediaServerService.isStreamReady(mediaServerItem, gbStream.getApp(), gbStream.getStream());
|
||||
if (streamReady != null && streamReady) {
|
||||
// 自平台内容
|
||||
SendRtpItem sendRtpItem = zlmServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId,
|
||||
|
@ -681,7 +681,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
|||
String channelId, String addressStr, String ssrc, String requesterId) {
|
||||
// 推流
|
||||
if (streamPushItem.isSelf()) {
|
||||
Boolean streamReady = zlmServerFactory.isStreamReady(mediaServerItem, gbStream.getApp(), gbStream.getStream());
|
||||
Boolean streamReady = mediaServerService.isStreamReady(mediaServerItem, gbStream.getApp(), gbStream.getStream());
|
||||
if (streamReady != null && streamReady) {
|
||||
// 自平台内容
|
||||
SendRtpItem sendRtpItem = zlmServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId,
|
||||
|
@ -1108,7 +1108,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
|||
|
||||
redisCatchStorage.updateSendRTPSever(sendRtpItem);
|
||||
|
||||
Boolean streamReady = zlmServerFactory.isStreamReady(mediaServerItem, broadcastCatch.getApp(), broadcastCatch.getStream());
|
||||
Boolean streamReady = mediaServerService.isStreamReady(mediaServerItem, broadcastCatch.getApp(), broadcastCatch.getStream());
|
||||
if (streamReady) {
|
||||
sendOk(device, sendRtpItem, sdp, request, mediaServerItem, mediaTransmissionTCP, gb28181Sdp.getSsrc());
|
||||
} else {
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.media.service;
|
|||
|
||||
import com.genersoft.iot.vmp.common.CommonCallback;
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
|
||||
import com.genersoft.iot.vmp.media.bean.MediaInfo;
|
||||
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||
|
@ -53,4 +54,8 @@ public interface IMediaNodeServerService {
|
|||
Boolean delStreamProxy(MediaServer mediaServer, String streamKey);
|
||||
|
||||
Map<String, String> getFFmpegCMDs(MediaServer mediaServer);
|
||||
|
||||
void startSendRtpPassive(MediaServer mediaServer, SendRtpItem sendRtpItem, Integer timeout);
|
||||
|
||||
void startSendRtpStream(MediaServer mediaServer, SendRtpItem sendRtpItem);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ package com.genersoft.iot.vmp.media.service;
|
|||
|
||||
import com.genersoft.iot.vmp.common.CommonCallback;
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
|
||||
import com.genersoft.iot.vmp.media.bean.MediaInfo;
|
||||
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||
import com.genersoft.iot.vmp.service.bean.MediaServerLoad;
|
||||
|
@ -133,5 +135,11 @@ public interface IMediaServerService {
|
|||
* @param stream
|
||||
* @return
|
||||
*/
|
||||
StreamInfo getStreamInfoByAppAndStream(MediaServer mediaServerItem, String app, String stream, MediaInfo mediaInfo, String addr, String callId, boolean isPlay);
|
||||
StreamInfo getStreamInfoByAppAndStream(MediaServer mediaServer, String app, String stream, MediaInfo mediaInfo, String addr, String callId, boolean isPlay);
|
||||
|
||||
Boolean isStreamReady(MediaServer mediaServer, String rtp, String streamId);
|
||||
|
||||
void startSendRtpPassive(MediaServer mediaServer, ParentPlatform platform, SendRtpItem sendRtpItem, Integer timeout);
|
||||
|
||||
void startSendRtpStream(MediaServer mediaServer, ParentPlatform platform, SendRtpItem sendRtpItem);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,9 @@ import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
|||
import com.genersoft.iot.vmp.conf.MediaConfig;
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.InviteStreamType;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
|
||||
import com.genersoft.iot.vmp.gb28181.session.SSRCFactory;
|
||||
import com.genersoft.iot.vmp.media.bean.MediaInfo;
|
||||
import com.genersoft.iot.vmp.media.event.media.MediaArrivalEvent;
|
||||
|
@ -19,6 +22,7 @@ import com.genersoft.iot.vmp.media.bean.MediaServer;
|
|||
import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
|
||||
import com.genersoft.iot.vmp.service.IInviteStreamService;
|
||||
import com.genersoft.iot.vmp.service.bean.MediaServerLoad;
|
||||
import com.genersoft.iot.vmp.service.bean.MessageForPushChannel;
|
||||
import com.genersoft.iot.vmp.service.bean.SSRCInfo;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.storager.dao.MediaServerMapper;
|
||||
|
@ -784,4 +788,50 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
|||
streamInfoResult.setMediaInfo(mediaInfo);
|
||||
return streamInfoResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean isStreamReady(MediaServer mediaServer, String rtp, String streamId) {
|
||||
IMediaNodeServerService mediaNodeServerService = nodeServerServiceMap.get(mediaServer.getType());
|
||||
if (mediaNodeServerService == null) {
|
||||
logger.info("[isStreamReady] 失败, mediaServer的类型: {},未找到对应的实现类", mediaServer.getType());
|
||||
return false;
|
||||
}
|
||||
MediaInfo mediaInfo = mediaNodeServerService.getMediaInfo(mediaServer, rtp, streamId);
|
||||
return mediaInfo != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startSendRtpPassive(MediaServer mediaServer, ParentPlatform platform, SendRtpItem sendRtpItem, Integer timeout) {
|
||||
IMediaNodeServerService mediaNodeServerService = nodeServerServiceMap.get(mediaServer.getType());
|
||||
if (mediaNodeServerService == null) {
|
||||
logger.info("[startSendRtpPassive] 失败, mediaServer的类型: {},未找到对应的实现类", mediaServer.getType());
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到mediaServer对应的实现类");
|
||||
}
|
||||
mediaNodeServerService.startSendRtpPassive(mediaServer, sendRtpItem, timeout);
|
||||
sendPlatformStartPlayMsg(platform, sendRtpItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startSendRtpStream(MediaServer mediaServer, ParentPlatform platform, SendRtpItem sendRtpItem) {
|
||||
IMediaNodeServerService mediaNodeServerService = nodeServerServiceMap.get(mediaServer.getType());
|
||||
if (mediaNodeServerService == null) {
|
||||
logger.info("[startSendRtpStream] 失败, mediaServer的类型: {},未找到对应的实现类", mediaServer.getType());
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到mediaServer对应的实现类");
|
||||
}
|
||||
logger.info("[开始推流] rtp/{}, 目标={}:{},SSRC={}, RTCP={}", sendRtpItem.getStream(),
|
||||
sendRtpItem.getIp(), sendRtpItem.getPort(), sendRtpItem.getSsrc(), sendRtpItem.isRtcp());
|
||||
mediaNodeServerService.startSendRtpStream(mediaServer, sendRtpItem);
|
||||
sendPlatformStartPlayMsg(platform, sendRtpItem);
|
||||
|
||||
}
|
||||
|
||||
private void sendPlatformStartPlayMsg(ParentPlatform platform, SendRtpItem sendRtpItem) {
|
||||
if (sendRtpItem.getPlayType() == InviteStreamType.PUSH && platform != null) {
|
||||
MessageForPushChannel messageForPushChannel = MessageForPushChannel.getInstance(0, sendRtpItem.getApp(), sendRtpItem.getStream(),
|
||||
sendRtpItem.getChannelId(), platform.getServerGBId(), platform.getName(), userSetting.getServerId(),
|
||||
sendRtpItem.getMediaServerId());
|
||||
messageForPushChannel.setPlatFormIndex(platform.getId());
|
||||
redisCatchStorage.sendPlatformStartPlayMsg(messageForPushChannel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ public class ZLMMediaListManager {
|
|||
public void sendStreamEvent(String app, String stream, String mediaServerId) {
|
||||
MediaServer mediaServerItem = mediaServerService.getOne(mediaServerId);
|
||||
// 查看推流状态
|
||||
Boolean streamReady = zlmServerFactory.isStreamReady(mediaServerItem, app, stream);
|
||||
Boolean streamReady = mediaServerService.isStreamReady(mediaServerItem, app, stream);
|
||||
if (streamReady != null && streamReady) {
|
||||
ChannelOnlineEvent channelOnlineEventLister = getChannelOnlineEventLister(app, stream);
|
||||
if (channelOnlineEventLister != null) {
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.alibaba.fastjson2.JSONObject;
|
|||
import com.genersoft.iot.vmp.common.CommonCallback;
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
|
||||
import com.genersoft.iot.vmp.media.bean.MediaInfo;
|
||||
import com.genersoft.iot.vmp.media.service.IMediaNodeServerService;
|
||||
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||
|
@ -298,4 +299,51 @@ public class ZLMMediaNodeServerService implements IMediaNodeServerService {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startSendRtpPassive(MediaServer mediaServer, SendRtpItem sendRtpItem, Integer timeout) {
|
||||
Map<String, Object> param = new HashMap<>(12);
|
||||
param.put("vhost","__defaultVhost__");
|
||||
param.put("app", sendRtpItem.getApp());
|
||||
param.put("stream", sendRtpItem.getStream());
|
||||
param.put("ssrc", sendRtpItem.getSsrc());
|
||||
param.put("src_port", sendRtpItem.getLocalPort());
|
||||
param.put("pt", sendRtpItem.getPt());
|
||||
param.put("use_ps", sendRtpItem.isUsePs() ? "1" : "0");
|
||||
param.put("only_audio", sendRtpItem.isOnlyAudio() ? "1" : "0");
|
||||
param.put("is_udp", sendRtpItem.isTcp() ? "0" : "1");
|
||||
param.put("recv_stream_id", sendRtpItem.getReceiveStream());
|
||||
if (timeout != null) {
|
||||
param.put("close_delay_ms", timeout);
|
||||
}
|
||||
|
||||
JSONObject jsonObject = zlmServerFactory.startSendRtpPassive(mediaServer, param, null);
|
||||
if (jsonObject == null || jsonObject.getInteger("code") != 0 ) {
|
||||
throw new ControllerException(jsonObject.getInteger("code"), jsonObject.getString("msg"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startSendRtpStream(MediaServer mediaServer, SendRtpItem sendRtpItem) {
|
||||
Map<String, Object> param = new HashMap<>(12);
|
||||
param.put("vhost", "__defaultVhost__");
|
||||
param.put("app", sendRtpItem.getApp());
|
||||
param.put("stream", sendRtpItem.getStream());
|
||||
param.put("ssrc", sendRtpItem.getSsrc());
|
||||
param.put("src_port", sendRtpItem.getLocalPort());
|
||||
param.put("pt", sendRtpItem.getPt());
|
||||
param.put("use_ps", sendRtpItem.isUsePs() ? "1" : "0");
|
||||
param.put("only_audio", sendRtpItem.isOnlyAudio() ? "1" : "0");
|
||||
param.put("is_udp", sendRtpItem.isTcp() ? "0" : "1");
|
||||
if (!sendRtpItem.isTcp()) {
|
||||
// udp模式下开启rtcp保活
|
||||
param.put("udp_rtcp_timeout", sendRtpItem.isRtcp() ? "1" : "0");
|
||||
}
|
||||
param.put("dst_url", sendRtpItem.getIp());
|
||||
param.put("dst_port", sendRtpItem.getPort());
|
||||
JSONObject jsonObject = zlmServerFactory.startSendRtpStream(mediaServer, param);
|
||||
if (jsonObject == null || jsonObject.getInteger("code") != 0 ) {
|
||||
throw new ControllerException(jsonObject.getInteger("code"), jsonObject.getString("msg"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,8 +59,7 @@ public interface IPlayService {
|
|||
|
||||
void startPushStream(SendRtpItem sendRtpItem, SIPResponse sipResponse, ParentPlatform platform, CallIdHeader callIdHeader);
|
||||
|
||||
void startSendRtpStreamHand(SendRtpItem sendRtpItem, Object correlationInfo,
|
||||
JSONObject jsonObject, Map<String, Object> param, CallIdHeader callIdHeader);
|
||||
void startSendRtpStreamFailHand(SendRtpItem sendRtpItem,ParentPlatform platform, CallIdHeader callIdHeader);
|
||||
|
||||
void talkCmd(Device device, String channelId, MediaServer mediaServerItem, String stream, AudioBroadcastEvent event);
|
||||
|
||||
|
|
|
@ -512,7 +512,7 @@ public class PlatformServiceImpl implements IPlatformService {
|
|||
// 如果zlm不存在这个流,则删除数据即可
|
||||
MediaServer mediaServerItemForStreamInfo = mediaServerService.getOne(inviteInfoForOld.getStreamInfo().getMediaServerId());
|
||||
if (mediaServerItemForStreamInfo != null) {
|
||||
Boolean ready = zlmServerFactory.isStreamReady(mediaServerItemForStreamInfo, inviteInfoForOld.getStreamInfo().getApp(), inviteInfoForOld.getStreamInfo().getStream());
|
||||
Boolean ready = mediaServerService.isStreamReady(mediaServerItemForStreamInfo, inviteInfoForOld.getStreamInfo().getApp(), inviteInfoForOld.getStreamInfo().getStream());
|
||||
if (!ready) {
|
||||
// 错误存在于redis中的数据
|
||||
inviteStreamService.removeInviteInfo(inviteInfoForOld);
|
||||
|
|
|
@ -84,9 +84,6 @@ public class PlayServiceImpl implements IPlayService {
|
|||
@Autowired
|
||||
private IRedisCatchStorage redisCatchStorage;
|
||||
|
||||
@Autowired
|
||||
private ZLMServerFactory zlmServerFactory;
|
||||
|
||||
@Autowired
|
||||
private IInviteStreamService inviteStreamService;
|
||||
|
||||
|
@ -302,8 +299,7 @@ public class PlayServiceImpl implements IPlayService {
|
|||
}
|
||||
String mediaServerId = streamInfo.getMediaServerId();
|
||||
MediaServer mediaInfo = mediaServerService.getOne(mediaServerId);
|
||||
|
||||
Boolean ready = zlmServerFactory.isStreamReady(mediaInfo, "rtp", streamId);
|
||||
Boolean ready = mediaServerService.isStreamReady(mediaInfo, "rtp", streamId);
|
||||
if (ready != null && ready) {
|
||||
callback.run(InviteErrorCode.SUCCESS.getCode(), InviteErrorCode.SUCCESS.getMsg(), streamInfo);
|
||||
inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channelId, null,
|
||||
|
@ -391,28 +387,15 @@ public class PlayServiceImpl implements IPlayService {
|
|||
}
|
||||
}, userSetting.getPlayTimeout());
|
||||
|
||||
Map<String, Object> param = new HashMap<>(12);
|
||||
param.put("vhost","__defaultVhost__");
|
||||
param.put("app", sendRtpItem.getApp());
|
||||
param.put("stream", sendRtpItem.getStream());
|
||||
param.put("ssrc", sendRtpItem.getSsrc());
|
||||
param.put("src_port", sendRtpItem.getLocalPort());
|
||||
param.put("pt", sendRtpItem.getPt());
|
||||
param.put("use_ps", sendRtpItem.isUsePs() ? "1" : "0");
|
||||
param.put("only_audio", sendRtpItem.isOnlyAudio() ? "1" : "0");
|
||||
param.put("is_udp", sendRtpItem.isTcp() ? "0" : "1");
|
||||
param.put("recv_stream_id", sendRtpItem.getReceiveStream());
|
||||
param.put("close_delay_ms", userSetting.getPlayTimeout() * 1000);
|
||||
|
||||
zlmServerFactory.startSendRtpPassive(mediaServerItem, param, jsonObject -> {
|
||||
if (jsonObject == null || jsonObject.getInteger("code") != 0 ) {
|
||||
mediaServerService.releaseSsrc(mediaServerItem.getId(), sendRtpItem.getSsrc());
|
||||
logger.info("[语音对讲]失败 deviceId: {}, channelId: {}", device.getDeviceId(), channelId);
|
||||
audioEvent.call("失败, " + jsonObject.getString("msg"));
|
||||
// 查看是否已经建立了通道,存在则发送bye
|
||||
stopTalk(device, channelId);
|
||||
}
|
||||
});
|
||||
try {
|
||||
mediaServerService.startSendRtpPassive(mediaServerItem, null, sendRtpItem, userSetting.getPlayTimeout() * 1000);
|
||||
}catch (ControllerException e) {
|
||||
mediaServerService.releaseSsrc(mediaServerItem.getId(), sendRtpItem.getSsrc());
|
||||
logger.info("[语音对讲]失败 deviceId: {}, channelId: {}", device.getDeviceId(), channelId);
|
||||
audioEvent.call("失败, " + e.getMessage());
|
||||
// 查看是否已经建立了通道,存在则发送bye
|
||||
stopTalk(device, channelId);
|
||||
}
|
||||
|
||||
|
||||
// 查看设备是否已经在推流
|
||||
|
@ -1238,7 +1221,7 @@ public class PlayServiceImpl implements IPlayService {
|
|||
SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(device.getDeviceId(), channelId, null, null);
|
||||
if (sendRtpItem != null && sendRtpItem.isOnlyAudio()) {
|
||||
// 查询流是否存在,不存在则认为是异常状态
|
||||
Boolean streamReady = zlmServerFactory.isStreamReady(mediaServerItem, sendRtpItem.getApp(), sendRtpItem.getStream());
|
||||
Boolean streamReady = mediaServerService.isStreamReady(mediaServerItem, sendRtpItem.getApp(), sendRtpItem.getStream());
|
||||
if (streamReady) {
|
||||
logger.warn("语音广播已经开启: {}", channelId);
|
||||
event.call("语音广播已经开启");
|
||||
|
@ -1248,18 +1231,6 @@ public class PlayServiceImpl implements IPlayService {
|
|||
}
|
||||
}
|
||||
}
|
||||
// SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(device.getDeviceId(), channelId, null, null);
|
||||
// if (sendRtpItem != null) {
|
||||
// MediaServerItem mediaServer = mediaServerService.getOne(sendRtpItem.getMediaServerId());
|
||||
// Boolean streamReady = zlmServerFactory.isStreamReady(mediaServer, sendRtpItem.getApp(), sendRtpItem.getStream());
|
||||
// if (streamReady) {
|
||||
// logger.warn("[语音对讲] 进行中: {}", channelId);
|
||||
// event.call("语音对讲进行中");
|
||||
// return false;
|
||||
// } else {
|
||||
// stopTalk(device, channelId);
|
||||
// }
|
||||
// }
|
||||
|
||||
// 发送通知
|
||||
cmder.audioBroadcastCmd(device, channelId, eventResultForOk -> {
|
||||
|
@ -1291,7 +1262,7 @@ public class PlayServiceImpl implements IPlayService {
|
|||
if (sendRtpItem != null && sendRtpItem.isOnlyAudio()) {
|
||||
// 查询流是否存在,不存在则认为是异常状态
|
||||
MediaServer mediaServerServiceOne = mediaServerService.getOne(sendRtpItem.getMediaServerId());
|
||||
Boolean streamReady = zlmServerFactory.isStreamReady(mediaServerServiceOne, sendRtpItem.getApp(), sendRtpItem.getStream());
|
||||
Boolean streamReady = mediaServerService.isStreamReady(mediaServerServiceOne, sendRtpItem.getApp(), sendRtpItem.getStream());
|
||||
if (streamReady) {
|
||||
logger.warn("语音广播通道使用中: {}", channelId);
|
||||
return true;
|
||||
|
@ -1447,24 +1418,7 @@ public class PlayServiceImpl implements IPlayService {
|
|||
@Override
|
||||
public void startPushStream(SendRtpItem sendRtpItem, SIPResponse sipResponse, ParentPlatform platform, CallIdHeader callIdHeader) {
|
||||
// 开始发流
|
||||
String is_Udp = sendRtpItem.isTcp() ? "0" : "1";
|
||||
MediaServer mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId());
|
||||
logger.info("[开始推流] rtp/{}, 目标={}:{},SSRC={}, RTCP={}", sendRtpItem.getStream(),
|
||||
sendRtpItem.getIp(), sendRtpItem.getPort(), sendRtpItem.getSsrc(), sendRtpItem.isRtcp());
|
||||
Map<String, Object> param = new HashMap<>(12);
|
||||
param.put("vhost", "__defaultVhost__");
|
||||
param.put("app", sendRtpItem.getApp());
|
||||
param.put("stream", sendRtpItem.getStream());
|
||||
param.put("ssrc", sendRtpItem.getSsrc());
|
||||
param.put("src_port", sendRtpItem.getLocalPort());
|
||||
param.put("pt", sendRtpItem.getPt());
|
||||
param.put("use_ps", sendRtpItem.isUsePs() ? "1" : "0");
|
||||
param.put("only_audio", sendRtpItem.isOnlyAudio() ? "1" : "0");
|
||||
param.put("is_udp", is_Udp);
|
||||
if (!sendRtpItem.isTcp()) {
|
||||
// udp模式下开启rtcp保活
|
||||
param.put("udp_rtcp_timeout", sendRtpItem.isRtcp() ? "1" : "0");
|
||||
}
|
||||
|
||||
if (mediaInfo == null) {
|
||||
RequestPushStreamMsg requestPushStreamMsg = RequestPushStreamMsg.getInstance(
|
||||
|
@ -1472,75 +1426,50 @@ public class PlayServiceImpl implements IPlayService {
|
|||
sendRtpItem.getIp(), sendRtpItem.getPort(), sendRtpItem.getSsrc(), sendRtpItem.isTcp(),
|
||||
sendRtpItem.getLocalPort(), sendRtpItem.getPt(), sendRtpItem.isUsePs(), sendRtpItem.isOnlyAudio());
|
||||
redisGbPlayMsgListener.sendMsgForStartSendRtpStream(sendRtpItem.getServerId(), requestPushStreamMsg, json -> {
|
||||
startSendRtpStreamHand(sendRtpItem, platform, json, param, callIdHeader);
|
||||
startSendRtpStreamFailHand(sendRtpItem, platform, callIdHeader);
|
||||
});
|
||||
} else {
|
||||
// 如果是严格模式,需要关闭端口占用
|
||||
JSONObject startSendRtpStreamResult = null;
|
||||
if (sendRtpItem.getLocalPort() != 0) {
|
||||
try {
|
||||
if (sendRtpItem.isTcpActive()) {
|
||||
startSendRtpStreamResult = zlmServerFactory.startSendRtpPassive(mediaInfo, param);
|
||||
mediaServerService.startSendRtpPassive(mediaInfo, platform, sendRtpItem, null);
|
||||
} else {
|
||||
param.put("dst_url", sendRtpItem.getIp());
|
||||
param.put("dst_port", sendRtpItem.getPort());
|
||||
startSendRtpStreamResult = zlmServerFactory.startSendRtpStream(mediaInfo, param);
|
||||
}
|
||||
} else {
|
||||
if (sendRtpItem.isTcpActive()) {
|
||||
startSendRtpStreamResult = zlmServerFactory.startSendRtpPassive(mediaInfo, param);
|
||||
} else {
|
||||
param.put("dst_url", sendRtpItem.getIp());
|
||||
param.put("dst_port", sendRtpItem.getPort());
|
||||
startSendRtpStreamResult = zlmServerFactory.startSendRtpStream(mediaInfo, param);
|
||||
mediaServerService.startSendRtpStream(mediaInfo, platform, sendRtpItem);
|
||||
}
|
||||
}catch (ControllerException e) {
|
||||
logger.error("RTP推流失败: {}", e.getMessage());
|
||||
startSendRtpStreamFailHand(sendRtpItem, platform, callIdHeader);
|
||||
return;
|
||||
}
|
||||
if (startSendRtpStreamResult != null) {
|
||||
startSendRtpStreamHand(sendRtpItem, platform, startSendRtpStreamResult, param, callIdHeader);
|
||||
}
|
||||
|
||||
logger.info("RTP推流成功[ {}/{} ],{}, ", sendRtpItem.getApp(), sendRtpItem.getStream(),
|
||||
sendRtpItem.isTcpActive()?"被动发流": sendRtpItem.getIp() + ":" + sendRtpItem.getPort());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startSendRtpStreamHand(SendRtpItem sendRtpItem, Object correlationInfo,
|
||||
JSONObject jsonObject, Map<String, Object> param, CallIdHeader callIdHeader) {
|
||||
if (jsonObject == null) {
|
||||
logger.error("RTP推流失败: 请检查ZLM服务");
|
||||
} else if (jsonObject.getInteger("code") == 0) {
|
||||
logger.info("调用ZLM推流接口, 结果: {}", jsonObject);
|
||||
logger.info("RTP推流成功[ {}/{} ],{}->{}, ", param.get("app"), param.get("stream"), jsonObject.getString("local_port"),
|
||||
sendRtpItem.isTcpActive()?"被动发流": param.get("dst_url") + ":" + param.get("dst_port"));
|
||||
if (sendRtpItem.getPlayType() == InviteStreamType.PUSH && correlationInfo instanceof ParentPlatform) {
|
||||
ParentPlatform platform = (ParentPlatform)correlationInfo;
|
||||
MessageForPushChannel messageForPushChannel = MessageForPushChannel.getInstance(0, sendRtpItem.getApp(), sendRtpItem.getStream(),
|
||||
sendRtpItem.getChannelId(), platform.getServerGBId(), platform.getName(), userSetting.getServerId(),
|
||||
sendRtpItem.getMediaServerId());
|
||||
messageForPushChannel.setPlatFormIndex(platform.getId());
|
||||
redisCatchStorage.sendPlatformStartPlayMsg(messageForPushChannel);
|
||||
public void startSendRtpStreamFailHand(SendRtpItem sendRtpItem, ParentPlatform platform, CallIdHeader callIdHeader) {
|
||||
if (sendRtpItem.isOnlyAudio()) {
|
||||
Device device = deviceService.getDevice(sendRtpItem.getDeviceId());
|
||||
AudioBroadcastCatch audioBroadcastCatch = audioBroadcastManager.get(sendRtpItem.getDeviceId(), sendRtpItem.getChannelId());
|
||||
if (audioBroadcastCatch != null) {
|
||||
try {
|
||||
cmder.streamByeCmd(device, sendRtpItem.getChannelId(), audioBroadcastCatch.getSipTransactionInfo(), null);
|
||||
} catch (SipException | ParseException | InvalidArgumentException |
|
||||
SsrcTransactionNotFoundException exception) {
|
||||
logger.error("[命令发送失败] 停止语音对讲: {}", exception.getMessage());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.error("RTP推流失败: {}, 参数:{}", jsonObject.getString("msg"), JSONObject.toJSONString(param));
|
||||
if (sendRtpItem.isOnlyAudio()) {
|
||||
Device device = deviceService.getDevice(sendRtpItem.getDeviceId());
|
||||
AudioBroadcastCatch audioBroadcastCatch = audioBroadcastManager.get(sendRtpItem.getDeviceId(), sendRtpItem.getChannelId());
|
||||
if (audioBroadcastCatch != null) {
|
||||
try {
|
||||
cmder.streamByeCmd(device, sendRtpItem.getChannelId(), audioBroadcastCatch.getSipTransactionInfo(), null);
|
||||
} catch (SipException | ParseException | InvalidArgumentException |
|
||||
SsrcTransactionNotFoundException e) {
|
||||
logger.error("[命令发送失败] 停止语音对讲: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (platform != null) {
|
||||
// 向上级平台
|
||||
if (correlationInfo instanceof ParentPlatform) {
|
||||
try {
|
||||
ParentPlatform parentPlatform = (ParentPlatform)correlationInfo;
|
||||
commanderForPlatform.streamByeCmd(parentPlatform, callIdHeader.getCallId());
|
||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||
logger.error("[命令发送失败] 国标级联 发送BYE: {}", e.getMessage());
|
||||
}
|
||||
try {
|
||||
commanderForPlatform.streamByeCmd(platform, callIdHeader.getCallId());
|
||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||
logger.error("[命令发送失败] 国标级联 发送BYE: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1563,7 +1492,7 @@ public class PlayServiceImpl implements IPlayService {
|
|||
if (sendRtpItem != null && sendRtpItem.isOnlyAudio()) {
|
||||
// 查询流是否存在,不存在则认为是异常状态
|
||||
MediaServer mediaServer = mediaServerService.getOne(sendRtpItem.getMediaServerId());
|
||||
Boolean streamReady = zlmServerFactory.isStreamReady(mediaServer, sendRtpItem.getApp(), sendRtpItem.getStream());
|
||||
Boolean streamReady = mediaServerService.isStreamReady(mediaServer, sendRtpItem.getApp(), sendRtpItem.getStream());
|
||||
if (streamReady) {
|
||||
logger.warn("[语音对讲] 正在语音广播,无法开启语音通话: {}", channelId);
|
||||
event.call("正在语音广播");
|
||||
|
@ -1577,7 +1506,7 @@ public class PlayServiceImpl implements IPlayService {
|
|||
SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(device.getDeviceId(), channelId, stream, null);
|
||||
if (sendRtpItem != null) {
|
||||
MediaServer mediaServer = mediaServerService.getOne(sendRtpItem.getMediaServerId());
|
||||
Boolean streamReady = zlmServerFactory.isStreamReady(mediaServer, "rtp", sendRtpItem.getReceiveStream());
|
||||
Boolean streamReady = mediaServerService.isStreamReady(mediaServer, "rtp", sendRtpItem.getReceiveStream());
|
||||
if (streamReady) {
|
||||
logger.warn("[语音对讲] 进行中: {}", channelId);
|
||||
event.call("语音对讲进行中");
|
||||
|
@ -1624,12 +1553,7 @@ public class PlayServiceImpl implements IPlayService {
|
|||
MediaServer mediaServer = mediaServerService.getOne(mediaServerId);
|
||||
|
||||
if (streamIsReady == null || streamIsReady) {
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put("vhost", "__defaultVhost__");
|
||||
param.put("app", sendRtpItem.getApp());
|
||||
param.put("stream", sendRtpItem.getStream());
|
||||
param.put("ssrc", sendRtpItem.getSsrc());
|
||||
zlmServerFactory.stopSendRtpStream(mediaServer, param);
|
||||
mediaServerService.stopSendRtp(mediaServer, sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getSsrc());
|
||||
}
|
||||
|
||||
ssrcFactory.releaseSsrc(mediaServerId, sendRtpItem.getSsrc());
|
||||
|
|
|
@ -349,7 +349,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
|||
if (mediaServer == null) {
|
||||
return null;
|
||||
}
|
||||
if (zlmServerFactory.isStreamReady(mediaServer, param.getApp(), param.getStream())) {
|
||||
if (mediaServerService.isStreamReady(mediaServer, param.getApp(), param.getStream())) {
|
||||
mediaServerService.closeStreams(mediaServer, param.getApp(), param.getStream());
|
||||
}
|
||||
String msgResult;
|
||||
|
|
|
@ -274,7 +274,7 @@ public class RedisGbPlayMsgListener implements MessageListener {
|
|||
return;
|
||||
}
|
||||
// 确定流是否在线
|
||||
Boolean streamReady = zlmServerFactory.isStreamReady(mediaServerItem, content.getApp(), content.getStream());
|
||||
Boolean streamReady = mediaServerService.isStreamReady(mediaServerItem, content.getApp(), content.getStream());
|
||||
if (streamReady != null && streamReady) {
|
||||
logger.info("[回复推流信息] {}/{}", content.getApp(), content.getStream());
|
||||
responseSendItem(mediaServerItem, content, toId, serial);
|
||||
|
|
|
@ -224,7 +224,7 @@ public class PsController {
|
|||
param.put("src_port", sendInfo.getSendLocalPort());
|
||||
|
||||
|
||||
Boolean streamReady = zlmServerFactory.isStreamReady(mediaServerItem, app, stream);
|
||||
Boolean streamReady = mediaServerService.isStreamReady(mediaServerItem, app, stream);
|
||||
if (streamReady) {
|
||||
JSONObject jsonObject = zlmServerFactory.startSendRtpStream(mediaServerItem, param);
|
||||
if (jsonObject.getInteger("code") == 0) {
|
||||
|
|
|
@ -275,7 +275,7 @@ public class RtpController {
|
|||
paramForVideo = null;
|
||||
}
|
||||
|
||||
Boolean streamReady = zlmServerFactory.isStreamReady(mediaServer, app, stream);
|
||||
Boolean streamReady = mediaServerService.isStreamReady(mediaServer, app, stream);
|
||||
if (streamReady) {
|
||||
if (paramForVideo != null) {
|
||||
JSONObject jsonObject = zlmServerFactory.startSendRtpStream(mediaServer, paramForVideo);
|
||||
|
|
|
@ -2,4 +2,4 @@ spring:
|
|||
application:
|
||||
name: wvp
|
||||
profiles:
|
||||
active: local
|
||||
active: abl
|
|
@ -203,6 +203,7 @@ create table wvp_platform (
|
|||
update_time character varying(50),
|
||||
as_message_channel bool default false,
|
||||
auto_push_channel bool default false,
|
||||
send_stream_ip character varying(50),
|
||||
constraint uk_platform_unique_server_gb_id unique (server_gb_id)
|
||||
);
|
||||
|
|
@ -203,6 +203,7 @@ create table wvp_platform (
|
|||
update_time character varying(50),
|
||||
as_message_channel bool default false,
|
||||
auto_push_channel bool default false,
|
||||
send_stream_ip character varying(50),
|
||||
constraint uk_platform_unique_server_gb_id unique (server_gb_id)
|
||||
);
|
||||
|
|
@ -8,4 +8,4 @@ alter table wvp_media_server
|
|||
alter table wvp_media_server
|
||||
add ws_flv_port integer;
|
||||
alter table wvp_media_server
|
||||
add ws_flv_ssl_port integer;
|
||||
add ws_flv_ssl_port integer;
|
|
@ -1,324 +0,0 @@
|
|||
/*建表*/
|
||||
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),
|
||||
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');
|
||||
|
||||
|
||||
|
|
@ -1,324 +0,0 @@
|
|||
/*建表*/
|
||||
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),
|
||||
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');
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue