From 2f76fa98bb839ede5b47a3c3e1bb6fe499952203 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期四, 08 九月 2022 09:46:35 +0800
Subject: [PATCH] Merge branch 'wvp-28181-2.0'
---
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java | 13
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java | 4
src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamProxyItem.java | 10 +
src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java | 2
web_src/src/components/dialog/chooseChannelForCatalog.vue | 7
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/SubscribeRequestProcessor.java | 2
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java | 1
web_src/src/components/dialog/getCatalog.vue | 16 +
src/main/java/com/genersoft/iot/vmp/media/zlm/AssistRESTfulUtils.java | 2
src/main/resources/logback-spring-local.xml | 5
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java | 2
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java | 20 +-
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java | 18 ++
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java | 2
src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java | 2
src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java | 2
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java | 14 +
web_src/src/components/dialog/platformEdit.vue | 41 ++--
src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java | 7
web_src/static/file/推流通道导入.zip | 0
src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java | 3
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java | 144 +++++++++++++----
web_src/src/components/ParentPlatformList.vue | 3
src/main/java/com/genersoft/iot/vmp/service/IMediaServerService.java | 2
src/main/java/com/genersoft/iot/vmp/service/impl/RedisPushStreamListMsgListener.java | 1
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java | 4
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java | 17 +
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java | 4
web_src/src/components/dialog/chooseChannel.vue | 7
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java | 59 ++++++-
src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java | 1
src/main/java/com/genersoft/iot/vmp/vmanager/bean/StreamPushExcelDto.java | 15 +
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java | 14 +
33 files changed, 330 insertions(+), 114 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java
index 00a16f9..b056cc7 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java
@@ -53,7 +53,7 @@
/**
* 璁惧鍥芥爣缂栧彿
*/
- @Schema(description = "11111")
+ @Schema(description = "璁惧鍥芥爣缂栧彿")
private String deviceGBId;
/**
@@ -113,7 +113,6 @@
/**
* RTCP娴佷繚娲�
- * TODO 棰勭暀, 鏆備笉瀹炵幇
*/
@Schema(description = "RTCP娴佷繚娲�")
private boolean rtcp;
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java
index b5cc514..07eb0c2 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java
@@ -108,7 +108,7 @@
* @param startTime 寮�濮嬫椂闂�,鏍煎紡瑕佹眰锛歽yyy-MM-dd HH:mm:ss
* @param endTime 缁撴潫鏃堕棿,鏍煎紡瑕佹眰锛歽yyy-MM-dd HH:mm:ss
*/
- void playbackStreamCmd(MediaServerItem mediaServerItem, SSRCInfo ssrcInf, Device device, String channelId, String startTime, String endTime,InviteStreamCallback inviteStreamCallback, InviteStreamCallback event, SipSubscribe.Event errorEvent);
+ void playbackStreamCmd(MediaServerItem mediaServerItem, SSRCInfo ssrcInf, Device device, String channelId, String startTime, String endTime,InviteStreamCallback inviteStreamCallback, InviteStreamCallback event, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent);
/**
* 璇锋眰鍘嗗彶濯掍綋涓嬭浇
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
index b42426a..3cf2881 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
@@ -358,7 +358,7 @@
// String streamMode = device.getStreamMode().toUpperCase();
logger.info("{} 鍒嗛厤鐨刏LM涓�: {} [{}:{}]", stream, mediaServerItem.getId(), mediaServerItem.getIp(), ssrcInfo.getPort());
- HookSubscribeForStreamChange hookSubscribe = HookSubscribeFactory.on_stream_changed("rtp", stream, true, "rtmp", mediaServerItem.getId());
+ HookSubscribeForStreamChange hookSubscribe = HookSubscribeFactory.on_stream_changed("rtp", stream, true, "rtsp", mediaServerItem.getId());
subscribe.addSubscribe(hookSubscribe, (MediaServerItem mediaServerItemInUse, JSONObject json)->{
if (event != null) {
event.response(mediaServerItemInUse, json);
@@ -458,7 +458,7 @@
@Override
public void playbackStreamCmd(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, String channelId,
String startTime, String endTime, InviteStreamCallback inviteStreamCallback, InviteStreamCallback hookEvent,
- SipSubscribe.Event errorEvent) {
+ SipSubscribe.Event okEvent,SipSubscribe.Event errorEvent) {
try {
logger.info("{} 鍒嗛厤鐨刏LM涓�: {} [{}:{}]", ssrcInfo.getStream(), mediaServerItem.getId(), mediaServerItem.getIp(), ssrcInfo.getPort());
@@ -526,7 +526,7 @@
CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
: udpSipProvider.getNewCallId();
- HookSubscribeForStreamChange hookSubscribe = HookSubscribeFactory.on_stream_changed("rtp", ssrcInfo.getStream(), true, "rtmp", mediaServerItem.getId());
+ HookSubscribeForStreamChange hookSubscribe = HookSubscribeFactory.on_stream_changed("rtp", ssrcInfo.getStream(), true, "rtsp", mediaServerItem.getId());
// 娣诲姞璁㈤槄
subscribe.addSubscribe(hookSubscribe, (MediaServerItem mediaServerItemInUse, JSONObject json)->{
if (hookEvent != null) {
@@ -537,10 +537,11 @@
});
Request request = headerProvider.createPlaybackInviteRequest(device, channelId, content.toString(), null, "fromplybck" + tm, null, callIdHeader, ssrcInfo.getSsrc());
- transmitRequest(device, request, errorEvent, okEvent -> {
- ResponseEvent responseEvent = (ResponseEvent) okEvent.event;
+ transmitRequest(device, request, errorEvent, event -> {
+ ResponseEvent responseEvent = (ResponseEvent) event.event;
streamSession.put(device.getDeviceId(), channelId, callIdHeader.getCallId(), ssrcInfo.getStream(), ssrcInfo.getSsrc(), mediaServerItem.getId(), responseEvent.getClientTransaction(), VideoStreamSessionManager.SessionType.playback);
- streamSession.put(device.getDeviceId(), channelId, callIdHeader.getCallId(), okEvent.dialog);
+ streamSession.put(device.getDeviceId(), channelId, callIdHeader.getCallId(), event.dialog);
+ okEvent.response(event);
});
if (inviteStreamCallback != null) {
inviteStreamCallback.call(new InviteStreamInfo(mediaServerItem, null, callIdHeader.getCallId(), "rtp", ssrcInfo.getStream()));
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java
index 2b7fec2..d49cce3 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java
@@ -121,6 +121,10 @@
param.put("pt", sendRtpItem.getPt());
param.put("use_ps", sendRtpItem.isUsePs() ? "1" : "0");
param.put("only_audio", sendRtpItem.isOnlyAudio() ? "1" : "0");
+ if (!sendRtpItem.isTcp() && parentPlatform.isRtcp()) {
+ // 寮�鍚痳tcp淇濇椿
+ param.put("udp_rtcp_timeout", "1");
+ }
JSONObject jsonObject;
if (sendRtpItem.isTcpActive()) {
jsonObject = zlmrtpServerFactory.startSendRtpPassive(mediaInfo, param);
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java
index 9c45788..b34fa34 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java
@@ -104,6 +104,8 @@
MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId());
zlmrtpServerFactory.stopSendRtpStream(mediaInfo, param);
redisCatchStorage.deleteSendRTPServer(platformGbId, sendRtpItem.getChannelId(), callIdHeader.getCallId(), null);
+ redisCatchStorage.deleteSendRTPServer(platformGbId, channelId, callIdHeader.getCallId(), null);
+ zlmrtpServerFactory.stopSendRtpStream(mediaInfo, param);
int totalReaderCount = zlmrtpServerFactory.totalReaderCount(mediaInfo, sendRtpItem.getApp(), streamId);
if (totalReaderCount <= 0) {
logger.info("鏀跺埌bye: {} 鏃犲叾瀹冭鐪嬭�咃紝閫氱煡璁惧鍋滄鎺ㄦ祦", streamId);
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
index bd3d4df..b0ba264 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
@@ -111,6 +111,9 @@
private ZLMRESTfulUtils zlmresTfulUtils;
@Autowired
+ private ZlmHttpHookSubscribe zlmHttpHookSubscribe;
+
+ @Autowired
private SIPProcessorObserver sipProcessorObserver;
@Autowired
@@ -430,7 +433,14 @@
if (playTransaction != null) {
Boolean streamReady = zlmrtpServerFactory.isStreamReady(mediaServerItem, "rtp", playTransaction.getStream());
if (!streamReady) {
- playTransaction = null;
+ boolean hasRtpServer = mediaServerService.checkRtpServer(mediaServerItem, "rtp", playTransaction.getStream());
+ if (hasRtpServer) {
+ logger.info("[涓婄骇鐐规挱]宸茬粡寮�鍚痳tpServer浣嗘槸灏氭湭鏀跺埌娴侊紝寮�鍚洃鍚祦鐨勫埌鏉�");
+ HookSubscribeForStreamChange hookSubscribe = HookSubscribeFactory.on_stream_changed("rtp", playTransaction.getStream(), true, "rtsp", mediaServerItem.getId());
+ zlmHttpHookSubscribe.addSubscribe(hookSubscribe, hookEvent);
+ }else {
+ playTransaction = null;
+ }
}
}
if (playTransaction == null) {
@@ -593,7 +603,8 @@
responseAck(evt, Response.BAD_REQUEST, "channel [" + gbStream.getGbId() + "] offline");
} else if ("push".equals(gbStream.getStreamType())) {
if (!platform.isStartOfflinePush()) {
- responseAck(evt, Response.TEMPORARILY_UNAVAILABLE, "channel unavailable");
+ // 骞冲彴璁剧疆涓叧闂簡鎷夎捣绂荤嚎鐨勬帹娴佸垯鐩存帴鍥炲
+ responseAck(evt, Response.TEMPORARILY_UNAVAILABLE, "channel stream not pushing");
return;
}
// 鍙戦�乺edis娑堟伅浠ヤ娇璁惧涓婄嚎
@@ -629,7 +640,7 @@
app, stream, channelId, mediaTransmissionTCP);
if (sendRtpItem == null) {
- logger.warn("鏈嶅姟鍣ㄧ鍙h祫婧愪笉瓒�");
+ logger.warn("涓婄骇鐐规椂鍒涘缓sendRTPItem澶辫触锛屽彲鑳芥槸鏈嶅姟鍣ㄧ鍙h祫婧愪笉瓒�");
try {
responseAck(evt, Response.BUSY_HERE);
} catch (SipException e) {
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/SubscribeRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/SubscribeRequestProcessor.java
index 4b7629c..8c04368 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/SubscribeRequestProcessor.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/SubscribeRequestProcessor.java
@@ -211,7 +211,6 @@
}else if (subscribeInfo.getExpires() == 0) {
subscribeHolder.removeCatalogSubscribe(platformId);
}
-
try {
ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformId);
responseXmlAck(evt, resultXml.toString(), parentPlatform);
@@ -219,5 +218,4 @@
e.printStackTrace();
}
}
-
}
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java b/src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java
index 733f78a..2d568a1 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java
@@ -203,6 +203,12 @@
return null;
}
deviceChannel.setChannelId(channelId);
+ int channelTypeCode = Integer.parseInt(channelId.substring(10, 13));
+ if (channelTypeCode == 136 || channelTypeCode == 137 || channelTypeCode == 138) {
+ deviceChannel.setHasAudio(true);
+ }else {
+ deviceChannel.setHasAudio(false);
+ }
if (event != null && !event.equals(CatalogEvent.ADD) && !event.equals(CatalogEvent.UPDATE)) {
// 闄や簡ADD鍜寀pdate鎯呭喌涓嬮渶瑕佽瘑鍒叏閮ㄥ唴瀹癸紝
return deviceChannel;
@@ -396,7 +402,6 @@
} else {
deviceChannel.setPTZType(Integer.parseInt(XmlUtil.getText(itemDevice, "PTZType")));
}
- deviceChannel.setHasAudio(true); // 榛樿鍚湁闊抽锛屾挱鏀炬椂鍐嶆鏌ユ槸鍚︽湁闊抽鍙婃槸鍚AC
return deviceChannel;
}
}
\ No newline at end of file
diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/AssistRESTfulUtils.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/AssistRESTfulUtils.java
index 2d11754..345ea1e 100644
--- a/src/main/java/com/genersoft/iot/vmp/media/zlm/AssistRESTfulUtils.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/AssistRESTfulUtils.java
@@ -50,7 +50,7 @@
if (mediaServerItem == null) {
return null;
}
- if (mediaServerItem.getRecordAssistPort() > 0) {
+ if (mediaServerItem.getRecordAssistPort() <= 0) {
logger.warn("鏈惎鐢ˋssist鏈嶅姟");
return null;
}
diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
index 78b59d9..b789974 100644
--- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
@@ -19,8 +19,6 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PostMapping;
@@ -544,6 +542,8 @@
for (SendRtpItem sendRtpItem : sendRtpItems) {
ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(sendRtpItem.getPlatformId());
commanderFroPlatform.streamByeCmd(parentPlatform, sendRtpItem.getCallId());
+ redisCatchStorage.deleteSendRTPServer(parentPlatform.getServerGBId(), sendRtpItem.getChannelId(),
+ sendRtpItem.getCallId(), sendRtpItem.getStreamId());
}
}
}
@@ -573,13 +573,19 @@
return ret;
}else {
StreamProxyItem streamProxyItem = streamProxyService.getStreamProxyByAppAndStream(app, streamId);
- if (streamProxyItem != null && streamProxyItem.isEnable_remove_none_reader()) {
- ret.put("close", true);
- streamProxyService.del(app, streamId);
- String url = streamProxyItem.getUrl() != null?streamProxyItem.getUrl():streamProxyItem.getSrc_url();
- logger.info("[{}/{}]<-[{}] 鎷夋祦浠g悊鏃犱汉瑙傜湅宸茬粡绉婚櫎", app, streamId, url);
- }else {
- ret.put("close", false);
+ if (streamProxyItem != null ) {
+ if (streamProxyItem.isEnable_remove_none_reader()) {
+ // 鏃犱汉瑙傜湅鑷姩绉婚櫎
+ ret.put("close", true);
+ streamProxyService.del(app, streamId);
+ String url = streamProxyItem.getUrl() != null?streamProxyItem.getUrl():streamProxyItem.getSrc_url();
+ logger.info("[{}/{}]<-[{}] 鎷夋祦浠g悊鏃犱汉瑙傜湅宸茬粡绉婚櫎", app, streamId, url);
+ }else if (streamProxyItem.isEnable_disable_none_reader()) {
+ // 鏃犱汉瑙傜湅鍋滅敤
+ ret.put("close", true);
+ }else {
+ ret.put("close", false);
+ }
}
return ret;
}
@@ -626,7 +632,7 @@
@ResponseBody
@PostMapping(value = "/on_server_started", produces = "application/json;charset=UTF-8")
public JSONObject onServerStarted(HttpServletRequest request, @RequestBody JSONObject jsonObject){
-
+
if (logger.isDebugEnabled()) {
logger.debug("[ ZLM HOOK ]on_server_started API璋冪敤锛屽弬鏁帮細" + jsonObject.toString());
}
@@ -649,6 +655,39 @@
return ret;
}
+ /**
+ * 鍙戦�乺tp(startSendRtp)琚姩鍏抽棴鏃跺洖璋�
+ */
+ @ResponseBody
+ @PostMapping(value = "/on_send_rtp_stopped", produces = "application/json;charset=UTF-8")
+ public JSONObject onSendRtpStopped(HttpServletRequest request, @RequestBody JSONObject jsonObject){
+
+ logger.info("[ ZLM HOOK ]on_send_rtp_stopped API璋冪敤锛屽弬鏁帮細" + jsonObject);
+
+ JSONObject ret = new JSONObject();
+ ret.put("code", 0);
+ ret.put("msg", "success");
+
+ // 鏌ユ壘瀵瑰簲鐨勪笂绾ф帹娴侊紝鍙戦�佸仠姝�
+ String app = jsonObject.getString("app");
+ if (!"rtp".equals(app)) {
+ return ret;
+ }
+ String stream = jsonObject.getString("stream");
+ List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServerByStream(stream);
+ if (sendRtpItems.size() > 0) {
+ for (SendRtpItem sendRtpItem : sendRtpItems) {
+ ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(sendRtpItem.getPlatformId());
+ commanderFroPlatform.streamByeCmd(parentPlatform, sendRtpItem.getCallId());
+ redisCatchStorage.deleteSendRTPServer(parentPlatform.getServerGBId(), sendRtpItem.getChannelId(),
+ sendRtpItem.getCallId(), sendRtpItem.getStreamId());
+ }
+ }
+
+
+ return ret;
+ }
+
private Map<String, String> urlParamToMap(String params) {
HashMap<String, String> map = new HashMap<>();
if (ObjectUtils.isEmpty(params)) {
diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java
index 65bebc9..ff018e4 100644
--- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java
@@ -96,6 +96,10 @@
if(rtpInfo.getInteger("code") == 0){
if (rtpInfo.getBoolean("exist")) {
result = rtpInfo.getInteger("local_port");
+ if (result == 0) {
+ // 姝ゆ椂璇存槑rtpServer宸茬粡鍒涘缓浣嗘槸娴佽繕娌℃湁鎺ㄤ笂鏉�
+
+ }
return result;
}
}else if(rtpInfo.getInteger("code") == -2){
diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamProxyItem.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamProxyItem.java
index 897e9e3..f0d08a1 100644
--- a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamProxyItem.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamProxyItem.java
@@ -37,6 +37,9 @@
private boolean enable_mp4;
@Schema(description = "鏄惁 鏃犱汉瑙傜湅鏃跺垹闄�")
private boolean enable_remove_none_reader;
+
+ @Schema(description = "鏄惁 鏃犱汉瑙傜湅鏃朵笉鍚敤")
+ private boolean enable_disable_none_reader;
@Schema(description = "涓婄骇骞冲彴鍥芥爣ID")
private String platformGbId;
@Schema(description = "鍒涘缓鏃堕棿")
@@ -177,4 +180,11 @@
this.enable_remove_none_reader = enable_remove_none_reader;
}
+ public boolean isEnable_disable_none_reader() {
+ return enable_disable_none_reader;
+ }
+
+ public void setEnable_disable_none_reader(boolean enable_disable_none_reader) {
+ this.enable_disable_none_reader = enable_disable_none_reader;
+ }
}
diff --git a/src/main/java/com/genersoft/iot/vmp/service/IMediaServerService.java b/src/main/java/com/genersoft/iot/vmp/service/IMediaServerService.java
index 9638415..7bc9ea2 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/IMediaServerService.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/IMediaServerService.java
@@ -82,4 +82,6 @@
MediaServerItem getDefaultMediaServer();
void updateMediaServerKeepalive(String mediaServerId, JSONObject data);
+
+ boolean checkRtpServer(MediaServerItem mediaServerItem, String rtp, String stream);
}
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
index 58f8741..f52b8ed 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
@@ -152,9 +152,11 @@
if (streamId == null) {
streamId = String.format("%08x", Integer.parseInt(ssrc)).toUpperCase();
}
- int rtpServerPort = mediaServerItem.getRtpProxyPort();
+ int rtpServerPort;
if (mediaServerItem.isRtpEnable()) {
rtpServerPort = zlmrtpServerFactory.createRTPServer(mediaServerItem, streamId, ssrcCheck?Integer.parseInt(ssrc):0, port);
+ } else {
+ rtpServerPort = mediaServerItem.getRtpProxyPort();
}
RedisUtil.set(key, mediaServerItem);
return new SSRCInfo(rtpServerPort, ssrc, streamId);
@@ -537,6 +539,7 @@
param.put("hook.on_stream_none_reader",String.format("%s/on_stream_none_reader", hookPrex));
param.put("hook.on_stream_not_found",String.format("%s/on_stream_not_found", hookPrex));
param.put("hook.on_server_keepalive",String.format("%s/on_server_keepalive", hookPrex));
+ param.put("hook.on_send_rtp_stopped",String.format("%s/on_send_rtp_stopped", hookPrex));
if (mediaServerItem.getRecordAssistPort() > 0) {
param.put("hook.on_record_mp4",String.format("http://127.0.0.1:%s/api/record/on_record_mp4", mediaServerItem.getRecordAssistPort()));
}else {
@@ -686,4 +689,13 @@
}
}
}
+
+ @Override
+ public boolean checkRtpServer(MediaServerItem mediaServerItem, String app, String stream) {
+ JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(mediaServerItem, stream);
+ if(rtpInfo.getInteger("code") == 0){
+ return rtpInfo.getBoolean("exist");
+ }
+ return false;
+ }
}
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java
index dc865c8..734a674 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java
@@ -73,7 +73,6 @@
}else {
streamInfo = getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, addr,null, true);
}
-
}
}
return streamInfo;
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
index c64511c..d1782c9 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
@@ -193,17 +193,30 @@
JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(mediaInfo, streamId);
if(rtpInfo.getInteger("code") == 0){
if (rtpInfo.getBoolean("exist")) {
+ int localPort = rtpInfo.getInteger("local_port");
+ if (localPort == 0) {
+ logger.warn("[鐐规挱]锛岀偣鎾椂鍙戠幇rtpServerC瀛樺湪锛屼絾鏄皻鏈紑濮嬫帹娴�");
+ // 姝ゆ椂璇存槑rtpServer宸茬粡鍒涘缓浣嗘槸娴佽繕娌℃湁鎺ㄤ笂鏉�
+ WVPResult wvpResult = new WVPResult();
+ wvpResult.setCode(ErrorCode.ERROR100.getCode());
+ wvpResult.setMsg("鐐规挱宸茬粡鍦ㄨ繘琛屼腑锛岃绋嶅�欓噸璇�");
+ msg.setData(wvpResult);
- WVPResult wvpResult = new WVPResult();
- wvpResult.setCode(ErrorCode.SUCCESS.getCode());
- wvpResult.setMsg(ErrorCode.SUCCESS.getMsg());
- wvpResult.setData(streamInfo);
- msg.setData(wvpResult);
+ resultHolder.invokeAllResult(msg);
+ return playResult;
+ }else {
+ WVPResult wvpResult = new WVPResult();
+ wvpResult.setCode(ErrorCode.SUCCESS.getCode());
+ wvpResult.setMsg(ErrorCode.SUCCESS.getMsg());
+ wvpResult.setData(streamInfo);
+ msg.setData(wvpResult);
- resultHolder.invokeAllResult(msg);
- if (hookEvent != null) {
- hookEvent.response(mediaServerItem, JSONObject.parseObject(JSON.toJSONString(streamInfo)));
+ resultHolder.invokeAllResult(msg);
+ if (hookEvent != null) {
+ hookEvent.response(mediaServerItem, JSONObject.parseObject(JSON.toJSONString(streamInfo)));
+ }
}
+
}else {
redisCatchStorage.stopPlay(streamInfo);
storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId());
@@ -318,7 +331,7 @@
}
logger.info("[鐐规挱娑堟伅] 鏀跺埌invite 200, 鍙戠幇涓嬬骇鑷畾涔変簡ssrc: {}", ssrcInResponse );
if (!mediaServerItem.isRtpEnable() || device.isSsrcCheck()) {
- logger.info("[SIP 娑堟伅] SSRC淇 {}->{}", ssrc, ssrcInResponse);
+ logger.info("[鐐规挱娑堟伅] SSRC淇 {}->{}", ssrc, ssrcInResponse);
if (!mediaServerItem.getSsrcConfig().checkSsrc(ssrcInResponse)) {
// ssrc 涓嶅彲鐢�
@@ -468,37 +481,92 @@
resultHolder.exist(DeferredResultHolder.CALLBACK_CMD_PLAYBACK + deviceId + channelId, uuid);
}, userSetting.getPlayTimeout());
+ SipSubscribe.Event errorEvent = event -> {
+ dynamicTask.stop(playBackTimeOutTaskKey);
+ requestMessage.setData(WVPResult.fail(ErrorCode.ERROR100.getCode(), String.format("鍥炴斁澶辫触锛� 閿欒鐮侊細 %s, %s", event.statusCode, event.msg)));
+ playBackResult.setCode(ErrorCode.ERROR100.getCode());
+ playBackResult.setMsg(String.format("鍥炴斁澶辫触锛� 閿欒鐮侊細 %s, %s", event.statusCode, event.msg));
+ playBackResult.setData(requestMessage);
+ playBackResult.setEvent(event);
+ playBackCallback.call(playBackResult);
+ streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream());
+ };
+
+ InviteStreamCallback hookEvent = (InviteStreamInfo inviteStreamInfo) -> {
+ logger.info("鏀跺埌鍥炴斁璁㈤槄娑堟伅锛� " + inviteStreamInfo.getResponse().toJSONString());
+ dynamicTask.stop(playBackTimeOutTaskKey);
+ StreamInfo streamInfo = onPublishHandler(inviteStreamInfo.getMediaServerItem(), inviteStreamInfo.getResponse(), deviceId, channelId);
+ if (streamInfo == null) {
+ logger.warn("璁惧鍥炴斁API璋冪敤澶辫触锛�");
+ playBackResult.setCode(ErrorCode.ERROR100.getCode());
+ playBackResult.setMsg("璁惧鍥炴斁API璋冪敤澶辫触锛�");
+ playBackCallback.call(playBackResult);
+ return;
+ }
+ redisCatchStorage.startPlayback(streamInfo, inviteStreamInfo.getCallId());
+ WVPResult<StreamInfo> success = WVPResult.success(streamInfo);
+ requestMessage.setData(success);
+ playBackResult.setCode(ErrorCode.SUCCESS.getCode());
+ playBackResult.setMsg(ErrorCode.SUCCESS.getMsg());
+ playBackResult.setData(requestMessage);
+ playBackResult.setMediaServerItem(inviteStreamInfo.getMediaServerItem());
+ playBackResult.setResponse(inviteStreamInfo.getResponse());
+ playBackCallback.call(playBackResult);
+ };
+
cmder.playbackStreamCmd(mediaServerItem, ssrcInfo, device, channelId, startTime, endTime, infoCallBack,
- (InviteStreamInfo inviteStreamInfo) -> {
- logger.info("鏀跺埌璁㈤槄娑堟伅锛� " + inviteStreamInfo.getResponse().toJSONString());
- dynamicTask.stop(playBackTimeOutTaskKey);
- StreamInfo streamInfo = onPublishHandler(inviteStreamInfo.getMediaServerItem(), inviteStreamInfo.getResponse(), deviceId, channelId);
- if (streamInfo == null) {
- logger.warn("璁惧鍥炴斁API璋冪敤澶辫触锛�");
- playBackResult.setCode(ErrorCode.ERROR100.getCode());
- playBackResult.setMsg("璁惧鍥炴斁API璋冪敤澶辫触锛�");
- playBackCallback.call(playBackResult);
- return;
+ hookEvent, eventResult -> {
+ if (eventResult.type == SipSubscribe.EventResultType.response) {
+ ResponseEvent responseEvent = (ResponseEvent)eventResult.event;
+ String contentString = new String(responseEvent.getResponse().getRawContent());
+ // 鑾峰彇ssrc
+ int ssrcIndex = contentString.indexOf("y=");
+ // 妫�鏌ユ槸鍚︽湁y瀛楁
+ if (ssrcIndex >= 0) {
+ //ssrc瑙勫畾闀垮害涓�10瀛楄妭锛屼笉鍙栦綑涓嬮暱搴︿互閬垮厤鍚庣画杩樻湁鈥渇=鈥濆瓧娈� TODO 鍚庣画瀵逛笉瑙勮寖鐨勯潪10浣峴src鍏煎
+ String ssrcInResponse = contentString.substring(ssrcIndex + 2, ssrcIndex + 12);
+ // 鏌ヨ鍒皊src涓嶄竴鑷翠笖寮�鍚簡ssrc鏍¢獙鍒欓渶瑕侀拡瀵瑰鐞�
+ if (ssrcInfo.getSsrc().equals(ssrcInResponse)) {
+ return;
+ }
+ logger.info("[鍥炴斁娑堟伅] 鏀跺埌invite 200, 鍙戠幇涓嬬骇鑷畾涔変簡ssrc: {}", ssrcInResponse );
+ if (!mediaServerItem.isRtpEnable() || device.isSsrcCheck()) {
+ logger.info("[鍥炴斁娑堟伅] SSRC淇 {}->{}", ssrcInfo.getSsrc(), ssrcInResponse);
+
+ if (!mediaServerItem.getSsrcConfig().checkSsrc(ssrcInResponse)) {
+ // ssrc 涓嶅彲鐢�
+ // 閲婃斁ssrc
+ mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
+ streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream());
+ eventResult.msg = "涓嬬骇鑷畾涔変簡ssrc,浣嗘槸姝src涓嶅彲鐢�";
+ eventResult.statusCode = 400;
+ errorEvent.response(eventResult);
+ return;
+ }
+
+ // 鍗曠鍙fā寮弒treamId涔熸湁鍙樺寲锛岄渶瑕侀噸鏂拌缃洃鍚�
+ if (!mediaServerItem.isRtpEnable()) {
+ // 娣诲姞璁㈤槄
+ HookSubscribeForStreamChange hookSubscribe = HookSubscribeFactory.on_stream_changed("rtp", ssrcInfo.getStream(), true, "rtsp", mediaServerItem.getId());
+ subscribe.removeSubscribe(hookSubscribe);
+ hookSubscribe.getContent().put("stream", String.format("%08x", Integer.parseInt(ssrcInResponse)).toUpperCase());
+ subscribe.addSubscribe(hookSubscribe, (MediaServerItem mediaServerItemInUse, JSONObject response)->{
+ logger.info("[ZLM HOOK] ssrc淇鍚庢敹鍒拌闃呮秷鎭細 " + response.toJSONString());
+ dynamicTask.stop(playBackTimeOutTaskKey);
+ // hook鍝嶅簲
+ onPublishHandlerForPlay(mediaServerItemInUse, response, device.getDeviceId(), channelId, uuid);
+ hookEvent.call(new InviteStreamInfo(mediaServerItem, null, eventResult.callId, "rtp", ssrcInfo.getStream()));
+ });
+ }
+ // 鍏抽棴rtp server
+ mediaServerService.closeRTPServer(device.getDeviceId(), channelId, ssrcInfo.getStream());
+ // 閲嶆柊寮�鍚痵src server
+ mediaServerService.openRTPServer(mediaServerItem, ssrcInfo.getStream(), ssrcInResponse, device.isSsrcCheck(), true, ssrcInfo.getPort());
+ }
+ }
}
- redisCatchStorage.startPlayback(streamInfo, inviteStreamInfo.getCallId());
- WVPResult<StreamInfo> success = WVPResult.success(streamInfo);
- requestMessage.setData(success);
- playBackResult.setCode(ErrorCode.SUCCESS.getCode());
- playBackResult.setMsg(ErrorCode.SUCCESS.getMsg());
- playBackResult.setData(requestMessage);
- playBackResult.setMediaServerItem(inviteStreamInfo.getMediaServerItem());
- playBackResult.setResponse(inviteStreamInfo.getResponse());
- playBackCallback.call(playBackResult);
- }, event -> {
- dynamicTask.stop(playBackTimeOutTaskKey);
- requestMessage.setData(WVPResult.fail(ErrorCode.ERROR100.getCode(), String.format("鍥炴斁澶辫触锛� 閿欒鐮侊細 %s, %s", event.statusCode, event.msg)));
- playBackResult.setCode(ErrorCode.ERROR100.getCode());
- playBackResult.setMsg(String.format("鍥炴斁澶辫触锛� 閿欒鐮侊細 %s, %s", event.statusCode, event.msg));
- playBackResult.setData(requestMessage);
- playBackResult.setEvent(event);
- playBackCallback.call(playBackResult);
- streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream());
- });
+
+ }, errorEvent);
return result;
}
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/RedisPushStreamListMsgListener.java b/src/main/java/com/genersoft/iot/vmp/service/impl/RedisPushStreamListMsgListener.java
index d70ddf1..23745eb 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/RedisPushStreamListMsgListener.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/RedisPushStreamListMsgListener.java
@@ -53,7 +53,6 @@
boolean contains = allAppAndStream.contains(app + stream);
//涓嶅瓨鍦ㄥ氨娣诲姞
if (!contains) {
- streamPushItem.setStatus(false);
streamPushItem.setStreamType("push");
streamPushItem.setCreateTime(DateUtil.getNow());
streamPushItem.setMediaServerId(mediaServerService.getDefaultMediaServer().getId());
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java
index c9b9579..3e13f48 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java
@@ -116,7 +116,7 @@
streamPushItem.setApp(streamPushExcelDto.getApp());
streamPushItem.setStream(streamPushExcelDto.getStream());
streamPushItem.setGbId(streamPushExcelDto.getGbId());
- streamPushItem.setStatus(false);
+ streamPushItem.setStatus(streamPushExcelDto.getStatus());
streamPushItem.setStreamType("push");
streamPushItem.setCreateTime(DateUtil.getNow());
streamPushItem.setMediaServerId(defaultMediaServerId);
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java b/src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java
index 1f467e4..f66b301 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java
@@ -236,4 +236,6 @@
void sendStreamPushRequestedMsgForStatus();
List<SendRtpItem> querySendRTPServerByChnnelId(String channelId);
+
+ List<SendRtpItem> querySendRTPServerByStream(String stream);
}
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
index bcebb94..25745c4 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
@@ -143,15 +143,12 @@
@Update(value = {"UPDATE device_channel SET status=0 WHERE deviceId=#{deviceId}"})
void offlineByDeviceId(String deviceId);
- @Update(value = {"UPDATE device_channel SET status=1 WHERE deviceId=#{deviceId} AND channelId=#{channelId}"})
- void online(String deviceId, String channelId);
-
@Insert("<script> " +
"insert into device_channel " +
"(channelId, deviceId, name, manufacture, model, owner, civilCode, block, subCount, " +
" address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " +
" ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " +
- " longitudeWgs84, latitudeWgs84, createTime, updateTime, businessGroupId, gpsTime) " +
+ " longitudeWgs84, latitudeWgs84, hasAudio, createTime, updateTime, businessGroupId, gpsTime) " +
"values " +
"<foreach collection='addChannels' index='index' item='item' separator=','> " +
"('${item.channelId}', '${item.deviceId}', '${item.name}', '${item.manufacture}', '${item.model}', " +
@@ -160,7 +157,7 @@
"'${item.certNum}', ${item.certifiable}, ${item.errCode}, '${item.secrecy}', " +
"'${item.ipAddress}', ${item.port}, '${item.password}', ${item.PTZType}, ${item.status}, " +
"'${item.streamId}', ${item.longitude}, ${item.latitude},${item.longitudeGcj02}, " +
- "${item.latitudeGcj02},${item.longitudeWgs84}, ${item.latitudeWgs84},'${item.createTime}', '${item.updateTime}', " +
+ "${item.latitudeGcj02},${item.longitudeWgs84}, ${item.latitudeWgs84}, ${item.hasAudio},'${item.createTime}', '${item.updateTime}', " +
"'${item.businessGroupId}', '${item.gpsTime}') " +
"</foreach> " +
"ON DUPLICATE KEY UPDATE " +
@@ -193,10 +190,14 @@
"latitudeGcj02=VALUES(latitudeGcj02), " +
"longitudeWgs84=VALUES(longitudeWgs84), " +
"latitudeWgs84=VALUES(latitudeWgs84), " +
+ "hasAudio=VALUES(hasAudio), " +
"businessGroupId=VALUES(businessGroupId), " +
"gpsTime=VALUES(gpsTime)" +
"</script>")
int batchAdd(List<DeviceChannel> addChannels);
+
+ @Update(value = {"UPDATE device_channel SET status=1 WHERE deviceId=#{deviceId} AND channelId=#{channelId}"})
+ void online(String deviceId, String channelId);
@Update({"<script>" +
"<foreach collection='updateChannels' item='item' separator=';'>" +
@@ -341,4 +342,7 @@
" left join platform_catalog pc on pgc.catalogId = pc.id and pgc.platformId = pc.platformId" +
" where pgc.platformId=#{serverGBId}")
List<DeviceChannel> queryChannelWithCatalog(String serverGBId);
+
+ @Select("select * from device_channel where deviceId = #{deviceId}")
+ List<DeviceChannel> queryAllChannels(String deviceId);
}
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java
index 98afd6b..7e9c812 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java
@@ -23,10 +23,10 @@
@Insert("<script> " +
"INSERT into platform_gb_stream " +
- "(gbStreamId, platformId, catalogId) " +
+ "(gbStreamId, platformId, catalogId,status) " +
"values " +
"<foreach collection='streamPushItems' index='index' item='item' separator=','> " +
- "(${item.gbStreamId}, '${item.platformId}', '${item.catalogId}')" +
+ "(${item.gbStreamId}, '${item.platformId}', '${item.catalogId}'), '${item.status}')" +
"</foreach> " +
"</script>")
int batchAdd(List<StreamPushItem> streamPushItems);
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java
index abff3eb..0e656cf 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java
@@ -77,7 +77,7 @@
"1=1 " +
" <if test='query != null'> AND (st.app LIKE '%${query}%' OR st.stream LIKE '%${query}%' OR gs.gbId LIKE '%${query}%' OR gs.name LIKE '%${query}%')</if> " +
" <if test='pushing == true' > AND (gs.gbId is null OR st.pushIng=1)</if>" +
- " <if test='pushing == false' > AND st.pushIng=0</if>" +
+ " <if test='pushing == false' > AND (gs.pushIng is null OR st.pushIng=0) </if>" +
" <if test='mediaServerId != null' > AND st.mediaServerId=#{mediaServerId} </if>" +
"order by st.createTime desc" +
" </script>"})
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
index ecefe73..9d30fef 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
@@ -388,6 +388,24 @@
}
@Override
+ public List<SendRtpItem> querySendRTPServerByStream(String stream) {
+ if (stream == null) {
+ return null;
+ }
+ String platformGbId = "*";
+ String callId = "*";
+ String channelId = "*";
+ String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId
+ + "_" + channelId + "_" + stream + "_" + callId;
+ List<Object> scan = RedisUtil.scan(key);
+ List<SendRtpItem> result = new ArrayList<>();
+ for (Object o : scan) {
+ result.add((SendRtpItem) RedisUtil.get((String) o));
+ }
+ return result;
+ }
+
+ @Override
public List<SendRtpItem> querySendRTPServer(String platformGbId) {
if (platformGbId == null) {
platformGbId = "*";
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
index e8e0e02..88cb8c0 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
@@ -111,11 +111,11 @@
if (CollectionUtils.isEmpty(deviceChannelList)) {
return false;
}
- List<DeviceChannel> allChannelInPlay = deviceChannelMapper.getAllChannelInPlay();
- Map<String,DeviceChannel> allChannelMapInPlay = new ConcurrentHashMap<>();
- if (allChannelInPlay.size() > 0) {
- for (DeviceChannel deviceChannel : allChannelInPlay) {
- allChannelMapInPlay.put(deviceChannel.getChannelId(), deviceChannel);
+ List<DeviceChannel> allChannels = deviceChannelMapper.queryAllChannels(deviceId);
+ Map<String,DeviceChannel> allChannelMap = new ConcurrentHashMap<>();
+ if (allChannels.size() > 0) {
+ for (DeviceChannel deviceChannel : allChannels) {
+ allChannelMap.put(deviceChannel.getChannelId(), deviceChannel);
}
}
TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
@@ -123,15 +123,17 @@
List<DeviceChannel> channels = new ArrayList<>();
StringBuilder stringBuilder = new StringBuilder();
Map<String, Integer> subContMap = new HashMap<>();
- if (deviceChannelList.size() > 1) {
+ if (deviceChannelList.size() > 0) {
// 鏁版嵁鍘婚噸
Set<String> gbIdSet = new HashSet<>();
for (DeviceChannel deviceChannel : deviceChannelList) {
if (!gbIdSet.contains(deviceChannel.getChannelId())) {
gbIdSet.add(deviceChannel.getChannelId());
- if (allChannelMapInPlay.containsKey(deviceChannel.getChannelId())) {
- deviceChannel.setStreamId(allChannelMapInPlay.get(deviceChannel.getChannelId()).getStreamId());
+ if (allChannelMap.containsKey(deviceChannel.getChannelId())) {
+ deviceChannel.setStreamId(allChannelMap.get(deviceChannel.getChannelId()).getStreamId());
+ deviceChannel.setHasAudio(allChannelMap.get(deviceChannel.getChannelId()).isHasAudio());
}
+
channels.add(deviceChannel);
if (!ObjectUtils.isEmpty(deviceChannel.getParentId())) {
if (subContMap.get(deviceChannel.getParentId()) == null) {
@@ -153,8 +155,6 @@
}
}
- }else {
- channels = deviceChannelList;
}
if (stringBuilder.length() > 0) {
logger.info("[鐩綍鏌ヨ]鏀跺埌鐨勬暟鎹瓨鍦ㄩ噸澶嶏細 {}" , stringBuilder);
diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/StreamPushExcelDto.java b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/StreamPushExcelDto.java
index 956f647..dcec607 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/StreamPushExcelDto.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/StreamPushExcelDto.java
@@ -22,6 +22,9 @@
@ExcelProperty("鐩綍ID")
private String catalogId;
+ @ExcelProperty("鍦ㄧ嚎鐘舵��")
+ private boolean status;
+
public String getName() {
return name;
}
@@ -70,4 +73,16 @@
public void setCatalogId(String catalogId) {
this.catalogId = catalogId;
}
+
+ public boolean isStatus() {
+ return status;
+ }
+
+ public boolean getStatus() {
+ return status;
+ }
+
+ public void setStatus(boolean status) {
+ this.status = status;
+ }
}
diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java
index 7e40720..c5eb6b5 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java
@@ -43,6 +43,7 @@
private IRoleService roleService;
@GetMapping("/login")
+ @PostMapping("/login")
@Operation(summary = "鐧诲綍")
@Parameter(name = "username", description = "鐢ㄦ埛鍚�", required = true)
@Parameter(name = "password", description = "瀵嗙爜锛�32浣峬d5鍔犲瘑锛�", required = true)
diff --git a/src/main/resources/logback-spring-local.xml b/src/main/resources/logback-spring-local.xml
index b9d3b39..724d05e 100644
--- a/src/main/resources/logback-spring-local.xml
+++ b/src/main/resources/logback-spring-local.xml
@@ -98,6 +98,11 @@
<appender-ref ref="STDOUT" />
</root>
+ <logger name="wvp" level="debug" additivity="true">
+ <appender-ref ref="RollingFileError"/>
+ <appender-ref ref="RollingFile"/>
+ </logger>
+
<logger name="GB28181_SIP" level="debug" additivity="true">
<appender-ref ref="RollingFileError"/>
<appender-ref ref="sipRollingFile"/>
diff --git a/web_src/src/components/ParentPlatformList.vue b/web_src/src/components/ParentPlatformList.vue
index 0cd517d..61e93fc 100644
--- a/web_src/src/components/ParentPlatformList.vue
+++ b/web_src/src/components/ParentPlatformList.vue
@@ -143,7 +143,8 @@
});
},
chooseChannel: function(platform) {
- this.$refs.chooseChannelDialog.openDialog(platform.serverGBId, platform.name, platform.catalogId, platform.treeType, this.initData)
+ console.log("platform.name: " + platform.name)
+ this.$refs.chooseChannelDialog.openDialog(platform.serverGBId,platform.deviceGBId, platform.name, platform.catalogId, platform.treeType, this.initData)
},
initData: function() {
this.getPlatformList();
diff --git a/web_src/src/components/dialog/chooseChannel.vue b/web_src/src/components/dialog/chooseChannel.vue
index ad911e8..e0e79c3 100644
--- a/web_src/src/components/dialog/chooseChannel.vue
+++ b/web_src/src/components/dialog/chooseChannel.vue
@@ -8,7 +8,7 @@
<el-tab-pane label="鐩綍缁撴瀯" name="catalog">
<el-container>
<el-main v-bind:style="{backgroundColor: '#FFF', maxHeight: winHeight + 'px'}">
- <chooseChannelForCatalog ref="chooseChannelForCatalog" :platformId=platformId :platformName=platformName :defaultCatalogId=defaultCatalogId :catalogIdChange="catalogIdChange" :treeType=treeType ></chooseChannelForCatalog>
+ <chooseChannelForCatalog ref="chooseChannelForCatalog" :platformId=platformId :platformDeviceId=platformDeviceId :platformName=platformName :defaultCatalogId=defaultCatalogId :catalogIdChange="catalogIdChange" :treeType=treeType ></chooseChannelForCatalog>
</el-main>
</el-container>
</el-tab-pane>
@@ -60,6 +60,7 @@
tabActiveName: "gbChannel",
catalogTabActiveName: "catalog",
platformId: "",
+ platformDeviceId: "",
catalogId: "",
catalogName: "",
currentCatalogId: "",
@@ -73,8 +74,10 @@
};
},
methods: {
- openDialog(platformId, platformName, defaultCatalogId, treeType, closeCallback) {
+ openDialog(platformId, platformDeviceId, platformName, defaultCatalogId, treeType, closeCallback) {
+ console.log("defaultCatalogId: " + defaultCatalogId)
this.platformId = platformId
+ this.platformDeviceId = platformDeviceId
this.platformName = platformName
this.defaultCatalogId = defaultCatalogId
this.showDialog = true
diff --git a/web_src/src/components/dialog/chooseChannelForCatalog.vue b/web_src/src/components/dialog/chooseChannelForCatalog.vue
index 4303a2f..c634b77 100644
--- a/web_src/src/components/dialog/chooseChannelForCatalog.vue
+++ b/web_src/src/components/dialog/chooseChannelForCatalog.vue
@@ -38,7 +38,7 @@
import catalogEdit from './catalogEdit.vue'
export default {
name: 'chooseChannelForCatalog',
- props: ['platformId', 'platformName', 'defaultCatalogId', 'catalogIdChange', 'treeType'],
+ props: ['platformId', 'platformDeviceId', 'platformName', 'defaultCatalogId', 'catalogIdChange', 'treeType'],
created() {
this.chooseId = this.defaultCatalogId;
this.defaultCatalogIdSign = this.defaultCatalogId;
@@ -171,6 +171,7 @@
});
},
loadNode: function(node, resolve){
+ console.log("this.platformDeviceId锛� " + this.platformDeviceId)
if (node.level === 0) {
resolve([
{
@@ -179,7 +180,7 @@
type: -1
},{
name: this.platformName,
- id: this.platformId,
+ id: this.platformDeviceId,
type: 0
}
]);
@@ -298,6 +299,8 @@
return false;
},
nodeClickHandler: function (data, node, tree){
+ console.log(data)
+ console.log(node)
this.chooseId = data.id;
this.chooseName = data.name;
if (this.catalogIdChange)this.catalogIdChange(this.chooseId, this.chooseName);
diff --git a/web_src/src/components/dialog/getCatalog.vue b/web_src/src/components/dialog/getCatalog.vue
index 62bacdb..fdc26de 100644
--- a/web_src/src/components/dialog/getCatalog.vue
+++ b/web_src/src/components/dialog/getCatalog.vue
@@ -77,6 +77,7 @@
},
methods: {
openDialog(catalogIdResult) {
+ console.log(this.chooseId)
this.showDialog = true
this.catalogIdResult = catalogIdResult
},
@@ -107,9 +108,6 @@
},
loadNode: function(node, resolve){
-
-
-
if (node.level === 0) {
this.$axios({
method:"get",
@@ -124,7 +122,7 @@
resolve([
{
name: this.platformName,
- id: this.platformId,
+ id: res.data.data.deviceGBId,
type: 0
}
]);
@@ -142,9 +140,19 @@
this.chooseId = data.id;
},
close: function() {
+ this.chooseId = null;
this.showDialog = false;
},
submit: function() {
+ console.log(this.chooseId)
+ if (this.chooseId === null) {
+ this.$message({
+ showClose: true,
+ message: '鏈�夋嫨浠讳綍鑺傜偣,',
+ type: 'warning'
+ });
+ return;
+ }
if (this.catalogIdResult)this.catalogIdResult(this.chooseId)
this.showDialog = false;
},
diff --git a/web_src/src/components/dialog/platformEdit.vue b/web_src/src/components/dialog/platformEdit.vue
index ef28b4c..7638232 100644
--- a/web_src/src/components/dialog/platformEdit.vue
+++ b/web_src/src/components/dialog/platformEdit.vue
@@ -37,13 +37,13 @@
<el-form-item label="鏈湴绔彛" prop="devicePort">
<el-input v-model="platform.devicePort" :disabled="true" type="number"></el-input>
</el-form-item>
+ <el-form-item label="SIP璁よ瘉鐢ㄦ埛鍚�" prop="username">
+ <el-input v-model="platform.username"></el-input>
+ </el-form-item>
</el-form>
</el-col>
<el-col :span="12">
<el-form ref="platform2" :rules="rules" :model="platform" label-width="160px">
- <el-form-item label="SIP璁よ瘉鐢ㄦ埛鍚�" prop="username">
- <el-input v-model="platform.username"></el-input>
- </el-form-item>
<el-form-item label="琛屾斂鍖哄垝" prop="administrativeDivision">
<el-input v-model="platform.administrativeDivision" clearable></el-input>
</el-form-item>
@@ -79,7 +79,7 @@
</el-select>
</el-form-item>
<el-form-item label="鐩綍缁撴瀯" prop="treeType" >
- <el-select v-model="platform.treeType" style="width: 100%" >
+ <el-select v-model="platform.treeType" style="width: 100%" @change="treeTypeChange">
<el-option key="WGS84" label="琛屾斂鍖哄垝" value="CivilCode"></el-option>
<el-option key="GCJ02" label="涓氬姟鍒嗙粍" value="BusinessGroup"></el-option>
</el-select>
@@ -98,6 +98,7 @@
<el-checkbox label="鍚敤" v-model="platform.enable" @change="checkExpires"></el-checkbox>
<el-checkbox label="浜戝彴鎺у埗" v-model="platform.ptz"></el-checkbox>
<el-checkbox label="鎷夎捣绂荤嚎鎺ㄦ祦" v-model="platform.startOfflinePush"></el-checkbox>
+ <el-checkbox label="RTCP淇濇椿" v-model="platform.rtcp" @change="rtcpCheckBoxChange"></el-checkbox>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">{{
@@ -251,21 +252,7 @@
},
onSubmit: function () {
- if (this.onSubmit_text === "淇濆瓨") {
- this.$confirm("淇敼鐩綍缁撴瀯浼氬鑷村叧鑱旂洰褰曚笌閫氶亾鏁版嵁琚竻绌�", '鎻愮ず', {
- dangerouslyUseHTMLString: true,
- confirmButtonText: '纭畾',
- cancelButtonText: '鍙栨秷',
- center: true,
- type: 'warning'
- }).then(() => {
- this.saveForm()
- }).catch(() => {
-
- });
- }else {
- this.saveForm()
- }
+ this.saveForm()
},
saveForm: function (){
this.$axios({
@@ -343,6 +330,22 @@
if (this.platform.enable && this.platform.expires == "0") {
this.platform.expires = "300";
}
+ },
+ rtcpCheckBoxChange: function (result){
+ if (result) {
+ this.$message({
+ showClose: true,
+ message: "寮�鍚疪TCP淇濇椿闇�瑕佷笂绾у钩鍙版敮鎸侊紝鍙互閬垮厤鏃犳晥鎺ㄦ祦",
+ type: "warning",
+ });
+ }
+ },
+ treeTypeChange: function (){
+ this.$message({
+ showClose: true,
+ message: "淇敼鐩綍缁撴瀯浼氬鑷村叧鑱旂洰褰曚笌閫氶亾鏁版嵁琚竻绌猴紝淇濆瓨鍚庣敓鏁�",
+ type: "warning",
+ });
}
},
};
diff --git "a/web_src/static/file/\346\216\250\346\265\201\351\200\232\351\201\223\345\257\274\345\205\245.zip" "b/web_src/static/file/\346\216\250\346\265\201\351\200\232\351\201\223\345\257\274\345\205\245.zip"
index fb95c61..495702f 100644
--- "a/web_src/static/file/\346\216\250\346\265\201\351\200\232\351\201\223\345\257\274\345\205\245.zip"
+++ "b/web_src/static/file/\346\216\250\346\265\201\351\200\232\351\201\223\345\257\274\345\205\245.zip"
Binary files differ
--
Gitblit v1.8.0