mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-05-27 15:37:50 +08:00
Merge remote-tracking branch 'origin/wvp-28181-2.0' into wvp-28181-2.0
This commit is contained in:
commit
5279481d90
@ -1,4 +1,4 @@
|
|||||||
-- MySQL dump 10.13 Distrib 8.0.30, for Linux (x86_64)
|
-- MySQL dump 10.13 Distrib 8.0.31, for Linux (x86_64)
|
||||||
--
|
--
|
||||||
-- Host: 127.0.0.1 Database: wvp
|
-- Host: 127.0.0.1 Database: wvp
|
||||||
-- ------------------------------------------------------
|
-- ------------------------------------------------------
|
||||||
@ -34,13 +34,13 @@ CREATE TABLE `device` (
|
|||||||
`online` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
`online` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||||
`registerTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
`registerTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||||
`keepaliveTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
`keepaliveTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||||
`ip` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
|
`ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||||
`createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
`createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||||
`updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
`updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||||
`port` int DEFAULT NULL,
|
`port` int DEFAULT NULL,
|
||||||
`expires` int DEFAULT NULL,
|
`expires` int DEFAULT NULL,
|
||||||
`subscribeCycleForCatalog` int DEFAULT NULL,
|
`subscribeCycleForCatalog` int DEFAULT NULL,
|
||||||
`hostAddress` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
|
`hostAddress` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||||
`charset` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
`charset` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||||
`subscribeCycleForMobilePosition` int DEFAULT NULL,
|
`subscribeCycleForMobilePosition` int DEFAULT NULL,
|
||||||
`mobilePositionSubmissionInterval` int DEFAULT '5',
|
`mobilePositionSubmissionInterval` int DEFAULT '5',
|
||||||
@ -48,12 +48,13 @@ CREATE TABLE `device` (
|
|||||||
`ssrcCheck` int DEFAULT '0',
|
`ssrcCheck` int DEFAULT '0',
|
||||||
`geoCoordSys` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
`geoCoordSys` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||||
`treeType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
`treeType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||||
`mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT 'auto',
|
`custom_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||||
`custom_name` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
|
`password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||||
`password` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
|
`sdpIp` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||||
|
`localIp` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `device_deviceId_uindex` (`deviceId`)
|
UNIQUE KEY `device_deviceId_uindex` (`deviceId`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=47 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -85,7 +86,7 @@ CREATE TABLE `device_alarm` (
|
|||||||
`alarmType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
`alarmType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||||
`createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
`createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -145,7 +146,7 @@ CREATE TABLE `device_channel` (
|
|||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `device_channel_id_uindex` (`id`),
|
UNIQUE KEY `device_channel_id_uindex` (`id`),
|
||||||
UNIQUE KEY `device_channel_pk` (`channelId`,`deviceId`)
|
UNIQUE KEY `device_channel_pk` (`channelId`,`deviceId`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=60301 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -182,7 +183,7 @@ CREATE TABLE `device_mobile_position` (
|
|||||||
`latitudeWgs84` double DEFAULT NULL,
|
`latitudeWgs84` double DEFAULT NULL,
|
||||||
`createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
`createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=55589 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -215,7 +216,7 @@ CREATE TABLE `gb_stream` (
|
|||||||
PRIMARY KEY (`gbStreamId`) USING BTREE,
|
PRIMARY KEY (`gbStreamId`) USING BTREE,
|
||||||
UNIQUE KEY `app` (`app`,`stream`) USING BTREE,
|
UNIQUE KEY `app` (`app`,`stream`) USING BTREE,
|
||||||
UNIQUE KEY `gbId` (`gbId`) USING BTREE
|
UNIQUE KEY `gbId` (`gbId`) USING BTREE
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=301059 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -245,7 +246,7 @@ CREATE TABLE `log` (
|
|||||||
`username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
`username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||||
`createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
`createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=733627 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -337,7 +338,7 @@ CREATE TABLE `parent_platform` (
|
|||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `parent_platform_id_uindex` (`id`),
|
UNIQUE KEY `parent_platform_id_uindex` (`id`),
|
||||||
UNIQUE KEY `parent_platform_pk` (`serverGBId`)
|
UNIQUE KEY `parent_platform_pk` (`serverGBId`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -383,13 +384,14 @@ UNLOCK TABLES;
|
|||||||
DROP TABLE IF EXISTS `platform_gb_channel`;
|
DROP TABLE IF EXISTS `platform_gb_channel`;
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
/*!50503 SET character_set_client = utf8mb4 */;
|
/*!50503 SET character_set_client = utf8mb4 */;
|
||||||
CREATE TABLE `platform_gb_channel` (
|
CREATE TABLE `platform_gb_stream` (
|
||||||
`id` int NOT NULL AUTO_INCREMENT,
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
`platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
`platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||||
`catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
`catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||||
`deviceChannelId` int NOT NULL,
|
`gbStreamId` int NOT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`),
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=102 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
UNIQUE KEY `platform_gb_stream_pk` (`platformId`,`catalogId`,`gbStreamId`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -405,17 +407,16 @@ UNLOCK TABLES;
|
|||||||
-- Table structure for table `platform_gb_stream`
|
-- Table structure for table `platform_gb_stream`
|
||||||
--
|
--
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `platform_gb_stream`;
|
CREATE TABLE `platform_gb_channel` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
|
`platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||||
|
`catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||||
|
`deviceChannelId` int NOT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
/*!50503 SET character_set_client = utf8mb4 */;
|
/*!50503 SET character_set_client = utf8mb4 */;
|
||||||
CREATE TABLE `platform_gb_stream` (
|
DROP TABLE IF EXISTS `platform_gb_stream`;
|
||||||
`platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
|
||||||
`catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
|
||||||
`gbStreamId` int NOT NULL,
|
|
||||||
`id` int NOT NULL AUTO_INCREMENT,
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
UNIQUE KEY `platform_gb_stream_pk` (`platformId`,`catalogId`,`gbStreamId`)
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=301766 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
|
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -446,7 +447,7 @@ CREATE TABLE `stream_proxy` (
|
|||||||
`ffmpeg_cmd_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
`ffmpeg_cmd_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||||
`rtp_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
`rtp_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||||
`mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
`mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||||
`enable_hls` bit(1) DEFAULT NULL,
|
`enable_audio` bit(1) DEFAULT NULL,
|
||||||
`enable_mp4` bit(1) DEFAULT NULL,
|
`enable_mp4` bit(1) DEFAULT NULL,
|
||||||
`enable` bit(1) NOT NULL,
|
`enable` bit(1) NOT NULL,
|
||||||
`status` bit(1) NOT NULL,
|
`status` bit(1) NOT NULL,
|
||||||
@ -457,7 +458,7 @@ CREATE TABLE `stream_proxy` (
|
|||||||
`enable_disable_none_reader` bit(1) DEFAULT NULL,
|
`enable_disable_none_reader` bit(1) DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `stream_proxy_pk` (`app`,`stream`)
|
UNIQUE KEY `stream_proxy_pk` (`app`,`stream`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=548 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -494,7 +495,7 @@ CREATE TABLE `stream_push` (
|
|||||||
`self` int DEFAULT NULL,
|
`self` int DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `stream_push_pk` (`app`,`stream`)
|
UNIQUE KEY `stream_push_pk` (`app`,`stream`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=310558 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -523,7 +524,7 @@ CREATE TABLE `user` (
|
|||||||
`pushKey` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
`pushKey` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`) USING BTREE,
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
UNIQUE KEY `user_username_uindex` (`username`) USING BTREE
|
UNIQUE KEY `user_username_uindex` (`username`) USING BTREE
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -550,7 +551,7 @@ CREATE TABLE `user_role` (
|
|||||||
`createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
`createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||||
`updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
`updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -572,4 +573,4 @@ UNLOCK TABLES;
|
|||||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||||
|
|
||||||
-- Dump completed on 2022-10-18 17:00:02
|
-- Dump completed on 2022-11-29 11:47:46
|
||||||
@ -36,3 +36,8 @@ alter table device
|
|||||||
|
|
||||||
alter table device
|
alter table device
|
||||||
modify hostAddress varchar(50) null;
|
modify hostAddress varchar(50) null;
|
||||||
|
|
||||||
|
alter table stream_proxy
|
||||||
|
change enable_hls enable_audio bit null;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -169,25 +169,31 @@ public class StreamInfo implements Serializable, Cloneable{
|
|||||||
|
|
||||||
public void setRtmp(String host, int port, int sslPort, String app, String stream, String callIdParam) {
|
public void setRtmp(String host, int port, int sslPort, String app, String stream, String callIdParam) {
|
||||||
String file = String.format("%s/%s/%s", app, stream, callIdParam);
|
String file = String.format("%s/%s/%s", app, stream, callIdParam);
|
||||||
this.rtmp = new StreamURL("rtmp", host, port, file);
|
if (port > 0) {
|
||||||
if (sslPort != 0) {
|
this.rtmp = new StreamURL("rtmp", host, port, file);
|
||||||
|
}
|
||||||
|
if (sslPort > 0) {
|
||||||
this.rtmps = new StreamURL("rtmps", host, sslPort, file);
|
this.rtmps = new StreamURL("rtmps", host, sslPort, file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRtsp(String host, int port, int sslPort, String app, String stream, String callIdParam) {
|
public void setRtsp(String host, int port, int sslPort, String app, String stream, String callIdParam) {
|
||||||
String file = String.format("%s/%s/%s", app, stream, callIdParam);
|
String file = String.format("%s/%s/%s", app, stream, callIdParam);
|
||||||
this.rtsp = new StreamURL("rtsp", host, port, file);
|
if (port > 0) {
|
||||||
if (sslPort != 0) {
|
this.rtsp = new StreamURL("rtsp", host, port, file);
|
||||||
|
}
|
||||||
|
if (sslPort > 0) {
|
||||||
this.rtsps = new StreamURL("rtsps", host, sslPort, file);
|
this.rtsps = new StreamURL("rtsps", host, sslPort, file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFlv(String host, int port, int sslPort, String app, String stream, String callIdParam) {
|
public void setFlv(String host, int port, int sslPort, String app, String stream, String callIdParam) {
|
||||||
String file = String.format("%s/%s.live.flv%s", app, stream, callIdParam);
|
String file = String.format("%s/%s.live.flv%s", app, stream, callIdParam);
|
||||||
this.flv = new StreamURL("http", host, port, file);
|
if (port > 0) {
|
||||||
|
this.flv = new StreamURL("http", host, port, file);
|
||||||
|
}
|
||||||
this.ws_flv = new StreamURL("ws", host, port, file);
|
this.ws_flv = new StreamURL("ws", host, port, file);
|
||||||
if (sslPort != 0) {
|
if (sslPort > 0) {
|
||||||
this.https_flv = new StreamURL("https", host, sslPort, file);
|
this.https_flv = new StreamURL("https", host, sslPort, file);
|
||||||
this.wss_flv = new StreamURL("wss", host, sslPort, file);
|
this.wss_flv = new StreamURL("wss", host, sslPort, file);
|
||||||
}
|
}
|
||||||
@ -195,9 +201,11 @@ public class StreamInfo implements Serializable, Cloneable{
|
|||||||
|
|
||||||
public void setFmp4(String host, int port, int sslPort, String app, String stream, String callIdParam) {
|
public void setFmp4(String host, int port, int sslPort, String app, String stream, String callIdParam) {
|
||||||
String file = String.format("%s/%s.live.mp4%s", app, stream, callIdParam);
|
String file = String.format("%s/%s.live.mp4%s", app, stream, callIdParam);
|
||||||
this.fmp4 = new StreamURL("http", host, port, file);
|
if (port > 0) {
|
||||||
this.ws_fmp4 = new StreamURL("ws", host, port, file);
|
this.fmp4 = new StreamURL("http", host, port, file);
|
||||||
if (sslPort != 0) {
|
this.ws_fmp4 = new StreamURL("ws", host, port, file);
|
||||||
|
}
|
||||||
|
if (sslPort > 0) {
|
||||||
this.https_fmp4 = new StreamURL("https", host, sslPort, file);
|
this.https_fmp4 = new StreamURL("https", host, sslPort, file);
|
||||||
this.wss_fmp4 = new StreamURL("wss", host, sslPort, file);
|
this.wss_fmp4 = new StreamURL("wss", host, sslPort, file);
|
||||||
}
|
}
|
||||||
@ -205,9 +213,11 @@ public class StreamInfo implements Serializable, Cloneable{
|
|||||||
|
|
||||||
public void setHls(String host, int port, int sslPort, String app, String stream, String callIdParam) {
|
public void setHls(String host, int port, int sslPort, String app, String stream, String callIdParam) {
|
||||||
String file = String.format("%s/%s/hls.m3u8%s", app, stream, callIdParam);
|
String file = String.format("%s/%s/hls.m3u8%s", app, stream, callIdParam);
|
||||||
this.hls = new StreamURL("http", host, port, file);
|
if (port > 0) {
|
||||||
this.ws_hls = new StreamURL("ws", host, port, file);
|
this.hls = new StreamURL("http", host, port, file);
|
||||||
if (sslPort != 0) {
|
this.ws_hls = new StreamURL("ws", host, port, file);
|
||||||
|
}
|
||||||
|
if (sslPort > 0) {
|
||||||
this.https_hls = new StreamURL("https", host, sslPort, file);
|
this.https_hls = new StreamURL("https", host, sslPort, file);
|
||||||
this.wss_hls = new StreamURL("wss", host, sslPort, file);
|
this.wss_hls = new StreamURL("wss", host, sslPort, file);
|
||||||
}
|
}
|
||||||
@ -215,9 +225,12 @@ public class StreamInfo implements Serializable, Cloneable{
|
|||||||
|
|
||||||
public void setTs(String host, int port, int sslPort, String app, String stream, String callIdParam) {
|
public void setTs(String host, int port, int sslPort, String app, String stream, String callIdParam) {
|
||||||
String file = String.format("%s/%s.live.ts%s", app, stream, callIdParam);
|
String file = String.format("%s/%s.live.ts%s", app, stream, callIdParam);
|
||||||
this.ts = new StreamURL("http", host, port, file);
|
|
||||||
this.ws_ts = new StreamURL("ws", host, port, file);
|
if (port > 0) {
|
||||||
if (sslPort != 0) {
|
this.ts = new StreamURL("http", host, port, file);
|
||||||
|
this.ws_ts = new StreamURL("ws", host, port, file);
|
||||||
|
}
|
||||||
|
if (sslPort > 0) {
|
||||||
this.https_ts = new StreamURL("https", host, sslPort, file);
|
this.https_ts = new StreamURL("https", host, sslPort, file);
|
||||||
this.wss_ts = new StreamURL("wss", host, sslPort, file);
|
this.wss_ts = new StreamURL("wss", host, sslPort, file);
|
||||||
}
|
}
|
||||||
@ -225,41 +238,78 @@ public class StreamInfo implements Serializable, Cloneable{
|
|||||||
|
|
||||||
public void setRtc(String host, int port, int sslPort, String app, String stream, String callIdParam) {
|
public void setRtc(String host, int port, int sslPort, String app, String stream, String callIdParam) {
|
||||||
String file = String.format("index/api/webrtc?app=%s&stream=%s&type=play%s", app, stream, callIdParam);
|
String file = String.format("index/api/webrtc?app=%s&stream=%s&type=play%s", app, stream, callIdParam);
|
||||||
this.rtc = new StreamURL("http", host, port, file);
|
if (port > 0) {
|
||||||
if (sslPort != 0) {
|
this.rtc = new StreamURL("http", host, port, file);
|
||||||
|
}
|
||||||
|
if (sslPort > 0) {
|
||||||
this.rtcs = new StreamURL("https", host, sslPort, file);
|
this.rtcs = new StreamURL("https", host, sslPort, file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void channgeStreamIp(String localAddr) {
|
public void channgeStreamIp(String localAddr) {
|
||||||
this.flv.setHost(localAddr);
|
if (this.flv != null) {
|
||||||
this.ws_flv.setHost(localAddr);
|
this.flv.setHost(localAddr);
|
||||||
this.hls.setHost(localAddr);
|
}
|
||||||
this.ws_hls.setHost(localAddr);
|
if (this.ws_flv != null ){
|
||||||
this.ts.setHost(localAddr);
|
this.ws_flv.setHost(localAddr);
|
||||||
this.ws_ts.setHost(localAddr);
|
}
|
||||||
this.fmp4.setHost(localAddr);
|
if (this.hls != null ) {
|
||||||
this.ws_fmp4.setHost(localAddr);
|
this.hls.setHost(localAddr);
|
||||||
this.rtc.setHost(localAddr);
|
}
|
||||||
|
if (this.ws_hls != null ) {
|
||||||
|
this.ws_hls.setHost(localAddr);
|
||||||
|
}
|
||||||
|
if (this.ts != null ) {
|
||||||
|
this.ts.setHost(localAddr);
|
||||||
|
}
|
||||||
|
if (this.ws_ts != null ) {
|
||||||
|
this.ws_ts.setHost(localAddr);
|
||||||
|
}
|
||||||
|
if (this.fmp4 != null ) {
|
||||||
|
this.fmp4.setHost(localAddr);
|
||||||
|
}
|
||||||
|
if (this.ws_fmp4 != null ) {
|
||||||
|
this.ws_fmp4.setHost(localAddr);
|
||||||
|
}
|
||||||
|
if (this.rtc != null ) {
|
||||||
|
this.rtc.setHost(localAddr);
|
||||||
|
}
|
||||||
if (this.https_flv != null) {
|
if (this.https_flv != null) {
|
||||||
this.https_flv.setHost(localAddr);
|
this.https_flv.setHost(localAddr);
|
||||||
|
}
|
||||||
|
if (this.wss_flv != null) {
|
||||||
this.wss_flv.setHost(localAddr);
|
this.wss_flv.setHost(localAddr);
|
||||||
|
}
|
||||||
|
if (this.https_hls != null) {
|
||||||
this.https_hls.setHost(localAddr);
|
this.https_hls.setHost(localAddr);
|
||||||
|
}
|
||||||
|
if (this.wss_hls != null) {
|
||||||
this.wss_hls.setHost(localAddr);
|
this.wss_hls.setHost(localAddr);
|
||||||
|
}
|
||||||
|
if (this.wss_ts != null) {
|
||||||
this.wss_ts.setHost(localAddr);
|
this.wss_ts.setHost(localAddr);
|
||||||
|
}
|
||||||
|
if (this.https_fmp4 != null) {
|
||||||
this.https_fmp4.setHost(localAddr);
|
this.https_fmp4.setHost(localAddr);
|
||||||
|
}
|
||||||
|
if (this.wss_fmp4 != null) {
|
||||||
this.wss_fmp4.setHost(localAddr);
|
this.wss_fmp4.setHost(localAddr);
|
||||||
|
}
|
||||||
|
if (this.rtcs != null) {
|
||||||
this.rtcs.setHost(localAddr);
|
this.rtcs.setHost(localAddr);
|
||||||
}
|
}
|
||||||
this.rtsp.setHost(localAddr);
|
if (this.rtsp != null) {
|
||||||
|
this.rtsp.setHost(localAddr);
|
||||||
|
}
|
||||||
if (this.rtsps != null) {
|
if (this.rtsps != null) {
|
||||||
this.rtsps.setHost(localAddr);
|
this.rtsps.setHost(localAddr);
|
||||||
}
|
}
|
||||||
this.rtmp.setHost(localAddr);
|
if (this.rtmp != null) {
|
||||||
|
this.rtmp.setHost(localAddr);
|
||||||
|
}
|
||||||
if (this.rtmps != null) {
|
if (this.rtmps != null) {
|
||||||
this.rtmps.setHost(localAddr);
|
this.rtmps.setHost(localAddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
package com.genersoft.iot.vmp.conf;
|
package com.genersoft.iot.vmp.conf;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.alarm.AlarmEventListener;
|
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.security.authentication.BadCredentialsException;
|
import org.springframework.security.authentication.BadCredentialsException;
|
||||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||||
@ -40,8 +40,8 @@ public class GlobalExceptionHandler {
|
|||||||
*/
|
*/
|
||||||
@ExceptionHandler(ControllerException.class)
|
@ExceptionHandler(ControllerException.class)
|
||||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||||
public WVPResult<String> exceptionHandler(ControllerException e) {
|
public ResponseEntity<WVPResult<String>> exceptionHandler(ControllerException e) {
|
||||||
return WVPResult.fail(e.getCode(), e.getMsg());
|
return new ResponseEntity<>(WVPResult.fail(e.getCode(), e.getMsg()), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,7 +51,7 @@ public class GlobalExceptionHandler {
|
|||||||
*/
|
*/
|
||||||
@ExceptionHandler(BadCredentialsException.class)
|
@ExceptionHandler(BadCredentialsException.class)
|
||||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||||
public WVPResult<String> exceptionHandler(BadCredentialsException e) {
|
public ResponseEntity<WVPResult<String>> exceptionHandler(BadCredentialsException e) {
|
||||||
return WVPResult.fail(ErrorCode.ERROR100.getCode(), e.getMessage());
|
return new ResponseEntity<>(WVPResult.fail(ErrorCode.ERROR100.getCode(), e.getMessage()), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,12 +35,16 @@ public class UserSetting {
|
|||||||
|
|
||||||
private Boolean useSourceIpAsStreamIp = Boolean.FALSE;
|
private Boolean useSourceIpAsStreamIp = Boolean.FALSE;
|
||||||
|
|
||||||
|
private Boolean sipUseSourceIpAsRemoteAddress = Boolean.FALSE;
|
||||||
|
|
||||||
private Boolean streamOnDemand = Boolean.TRUE;
|
private Boolean streamOnDemand = Boolean.TRUE;
|
||||||
|
|
||||||
private Boolean pushAuthority = Boolean.TRUE;
|
private Boolean pushAuthority = Boolean.TRUE;
|
||||||
|
|
||||||
private Boolean gbSendStreamStrict = Boolean.FALSE;
|
private Boolean gbSendStreamStrict = Boolean.FALSE;
|
||||||
|
|
||||||
|
private Boolean syncChannelOnDeviceOnline = Boolean.FALSE;
|
||||||
|
|
||||||
private String serverId = "000000";
|
private String serverId = "000000";
|
||||||
|
|
||||||
private String thirdPartyGBIdReg = "[\\s\\S]*";
|
private String thirdPartyGBIdReg = "[\\s\\S]*";
|
||||||
@ -186,4 +190,20 @@ public class UserSetting {
|
|||||||
public void setGbSendStreamStrict(Boolean gbSendStreamStrict) {
|
public void setGbSendStreamStrict(Boolean gbSendStreamStrict) {
|
||||||
this.gbSendStreamStrict = gbSendStreamStrict;
|
this.gbSendStreamStrict = gbSendStreamStrict;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getSyncChannelOnDeviceOnline() {
|
||||||
|
return syncChannelOnDeviceOnline;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSyncChannelOnDeviceOnline(Boolean syncChannelOnDeviceOnline) {
|
||||||
|
this.syncChannelOnDeviceOnline = syncChannelOnDeviceOnline;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getSipUseSourceIpAsRemoteAddress() {
|
||||||
|
return sipUseSourceIpAsRemoteAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSipUseSourceIpAsRemoteAddress(Boolean sipUseSourceIpAsRemoteAddress) {
|
||||||
|
this.sipUseSourceIpAsRemoteAddress = sipUseSourceIpAsRemoteAddress;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,8 +29,6 @@ public class SipLayer implements CommandLineRunner {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ISIPProcessorObserver sipProcessorObserver;
|
private ISIPProcessorObserver sipProcessorObserver;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private final Map<String, SipProviderImpl> tcpSipProviderMap = new ConcurrentHashMap<>();
|
private final Map<String, SipProviderImpl> tcpSipProviderMap = new ConcurrentHashMap<>();
|
||||||
private final Map<String, SipProviderImpl> udpSipProviderMap = new ConcurrentHashMap<>();
|
private final Map<String, SipProviderImpl> udpSipProviderMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
|||||||
@ -25,10 +25,9 @@
|
|||||||
*/
|
*/
|
||||||
package com.genersoft.iot.vmp.gb28181.auth;
|
package com.genersoft.iot.vmp.gb28181.auth;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import gov.nist.core.InternalErrorHandler;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import org.slf4j.Logger;
|
||||||
import java.time.Instant;
|
import org.slf4j.LoggerFactory;
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import javax.sip.address.URI;
|
import javax.sip.address.URI;
|
||||||
import javax.sip.header.AuthorizationHeader;
|
import javax.sip.header.AuthorizationHeader;
|
||||||
@ -36,10 +35,10 @@ import javax.sip.header.HeaderFactory;
|
|||||||
import javax.sip.header.WWWAuthenticateHeader;
|
import javax.sip.header.WWWAuthenticateHeader;
|
||||||
import javax.sip.message.Request;
|
import javax.sip.message.Request;
|
||||||
import javax.sip.message.Response;
|
import javax.sip.message.Response;
|
||||||
|
import java.security.MessageDigest;
|
||||||
import gov.nist.core.InternalErrorHandler;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import org.slf4j.Logger;
|
import java.time.Instant;
|
||||||
import org.slf4j.LoggerFactory;
|
import java.util.Random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements the HTTP digest authentication method server side functionality.
|
* Implements the HTTP digest authentication method server side functionality.
|
||||||
@ -201,12 +200,13 @@ public class DigestServerAuthenticationHelper {
|
|||||||
// String ncStr = new DecimalFormat("00000000").format(Integer.parseInt(nc + "", 16));
|
// String ncStr = new DecimalFormat("00000000").format(Integer.parseInt(nc + "", 16));
|
||||||
|
|
||||||
String A1 = username + ":" + realm + ":" + pass;
|
String A1 = username + ":" + realm + ":" + pass;
|
||||||
|
|
||||||
String A2 = request.getMethod().toUpperCase() + ":" + uri.toString();
|
String A2 = request.getMethod().toUpperCase() + ":" + uri.toString();
|
||||||
|
|
||||||
byte mdbytes[] = messageDigest.digest(A1.getBytes());
|
byte mdbytes[] = messageDigest.digest(A1.getBytes());
|
||||||
String HA1 = toHexString(mdbytes);
|
String HA1 = toHexString(mdbytes);
|
||||||
logger.debug("A1: " + A1);
|
logger.debug("A1: " + A1);
|
||||||
logger.debug("A2: " + A2);
|
logger.debug("A2: " + A2);
|
||||||
|
|
||||||
mdbytes = messageDigest.digest(A2.getBytes());
|
mdbytes = messageDigest.digest(A2.getBytes());
|
||||||
String HA2 = toHexString(mdbytes);
|
String HA2 = toHexString(mdbytes);
|
||||||
logger.debug("HA1: " + HA1);
|
logger.debug("HA1: " + HA1);
|
||||||
@ -238,58 +238,4 @@ public class DigestServerAuthenticationHelper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// public static void main(String[] args) throws NoSuchAlgorithmException {
|
|
||||||
// String realm = "3402000000";
|
|
||||||
// String username = "44010000001180008012";
|
|
||||||
|
|
||||||
|
|
||||||
// String nonce = "07cab60999fbf643264ace27d3b7de8b";
|
|
||||||
// String uri = "sip:34020000002000000001@3402000000";
|
|
||||||
// // qop 保护质量 包含auth(默认的)和auth-int(增加了报文完整性检测)两种策略
|
|
||||||
// String qop = "auth";
|
|
||||||
|
|
||||||
// // 客户端随机数,这是一个不透明的字符串值,由客户端提供,并且客户端和服务器都会使用,以避免用明文文本。
|
|
||||||
// // 这使得双方都可以查验对方的身份,并对消息的完整性提供一些保护
|
|
||||||
// //String cNonce = authHeader.getCNonce();
|
|
||||||
|
|
||||||
// // nonce计数器,是一个16进制的数值,表示同一nonce下客户端发送出请求的数量
|
|
||||||
// int nc = 1;
|
|
||||||
// String ncStr = new DecimalFormat("00000000").format(nc);
|
|
||||||
// // String ncStr = new DecimalFormat("00000000").format(Integer.parseInt(nc + "", 16));
|
|
||||||
// MessageDigest messageDigest = MessageDigest.getInstance(DEFAULT_ALGORITHM);
|
|
||||||
// String A1 = username + ":" + realm + ":" + "12345678";
|
|
||||||
// String A2 = "REGISTER" + ":" + uri;
|
|
||||||
// byte mdbytes[] = messageDigest.digest(A1.getBytes());
|
|
||||||
// String HA1 = toHexString(mdbytes);
|
|
||||||
// System.out.println("A1: " + A1);
|
|
||||||
// System.out.println("A2: " + A2);
|
|
||||||
|
|
||||||
// mdbytes = messageDigest.digest(A2.getBytes());
|
|
||||||
// String HA2 = toHexString(mdbytes);
|
|
||||||
// System.out.println("HA1: " + HA1);
|
|
||||||
// System.out.println("HA2: " + HA2);
|
|
||||||
// String cnonce = "0a4f113b";
|
|
||||||
// System.out.println("nonce: " + nonce);
|
|
||||||
// System.out.println("nc: " + ncStr);
|
|
||||||
// System.out.println("cnonce: " + cnonce);
|
|
||||||
// System.out.println("qop: " + qop);
|
|
||||||
// String KD = HA1 + ":" + nonce;
|
|
||||||
|
|
||||||
// if (qop != null && qop.equals("auth") ) {
|
|
||||||
// if (nc != -1) {
|
|
||||||
// KD += ":" + ncStr;
|
|
||||||
// }
|
|
||||||
// if (cnonce != null) {
|
|
||||||
// KD += ":" + cnonce;
|
|
||||||
// }
|
|
||||||
// KD += ":" + qop;
|
|
||||||
// }
|
|
||||||
// KD += ":" + HA2;
|
|
||||||
// System.out.println("KD: " + KD);
|
|
||||||
// mdbytes = messageDigest.digest(KD.getBytes());
|
|
||||||
// String mdString = toHexString(mdbytes);
|
|
||||||
// System.out.println("mdString: " + mdString);
|
|
||||||
// String response = "4f0507d4b87cdecff04bdaf4c96348f0";
|
|
||||||
// System.out.println("response: " + response);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,27 @@
|
|||||||
|
package com.genersoft.iot.vmp.gb28181.bean;
|
||||||
|
|
||||||
|
public class RemoteAddressInfo {
|
||||||
|
private String ip;
|
||||||
|
private int port;
|
||||||
|
|
||||||
|
public RemoteAddressInfo(String ip, int port) {
|
||||||
|
this.ip = ip;
|
||||||
|
this.port = port;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIp() {
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIp(String ip) {
|
||||||
|
this.ip = ip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPort() {
|
||||||
|
return port;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPort(int port) {
|
||||||
|
this.port = port;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,7 +1,5 @@
|
|||||||
package com.genersoft.iot.vmp.gb28181.bean;
|
package com.genersoft.iot.vmp.gb28181.bean;
|
||||||
|
|
||||||
import gov.nist.javax.sip.message.SIPRequest;
|
|
||||||
|
|
||||||
public class SendRtpItem {
|
public class SendRtpItem {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -108,6 +106,11 @@ public class SendRtpItem {
|
|||||||
*/
|
*/
|
||||||
private boolean onlyAudio = false;
|
private boolean onlyAudio = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否开启rtcp保活
|
||||||
|
*/
|
||||||
|
private boolean rtcp = false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 播放类型
|
* 播放类型
|
||||||
@ -281,4 +284,12 @@ public class SendRtpItem {
|
|||||||
public void setToTag(String toTag) {
|
public void setToTag(String toTag) {
|
||||||
this.toTag = toTag;
|
this.toTag = toTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isRtcp() {
|
||||||
|
return rtcp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRtcp(boolean rtcp) {
|
||||||
|
this.rtcp = rtcp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,6 +35,7 @@ public class RecordEndEventListener implements ApplicationListener<RecordEndEven
|
|||||||
recordEndEventHandler.handler(event.getRecordInfo());
|
recordEndEventHandler.handler(event.getRecordInfo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
handlerMap.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addEndEventHandler(String device, String channelId, RecordEndEventHandler recordEndEventHandler) {
|
public void addEndEventHandler(String device, String channelId, RecordEndEventHandler recordEndEventHandler) {
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
package com.genersoft.iot.vmp.gb28181.transmit.cmd.impl;
|
package com.genersoft.iot.vmp.gb28181.transmit.cmd.impl;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.SipLayer;
|
import com.genersoft.iot.vmp.gb28181.SipLayer;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
|
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
|
||||||
@ -9,13 +8,13 @@ import com.genersoft.iot.vmp.gb28181.transmit.SIPSender;
|
|||||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.SIPRequestHeaderPlarformProvider;
|
import com.genersoft.iot.vmp.gb28181.transmit.cmd.SIPRequestHeaderPlarformProvider;
|
||||||
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
||||||
import com.genersoft.iot.vmp.storager.dao.dto.PlatformRegisterInfo;
|
|
||||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
|
import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.service.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
|
import com.genersoft.iot.vmp.storager.dao.dto.PlatformRegisterInfo;
|
||||||
|
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||||
import gov.nist.javax.sip.message.MessageFactoryImpl;
|
import gov.nist.javax.sip.message.MessageFactoryImpl;
|
||||||
import gov.nist.javax.sip.message.SIPRequest;
|
import gov.nist.javax.sip.message.SIPRequest;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -26,8 +25,10 @@ import org.springframework.lang.Nullable;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
import javax.sip.*;
|
import javax.sip.InvalidArgumentException;
|
||||||
import javax.sip.header.*;
|
import javax.sip.SipException;
|
||||||
|
import javax.sip.header.CallIdHeader;
|
||||||
|
import javax.sip.header.WWWAuthenticateHeader;
|
||||||
import javax.sip.message.Request;
|
import javax.sip.message.Request;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|||||||
@ -120,9 +120,9 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In
|
|||||||
param.put("pt", sendRtpItem.getPt());
|
param.put("pt", sendRtpItem.getPt());
|
||||||
param.put("use_ps", sendRtpItem.isUsePs() ? "1" : "0");
|
param.put("use_ps", sendRtpItem.isUsePs() ? "1" : "0");
|
||||||
param.put("only_audio", sendRtpItem.isOnlyAudio() ? "1" : "0");
|
param.put("only_audio", sendRtpItem.isOnlyAudio() ? "1" : "0");
|
||||||
if (!sendRtpItem.isTcp() && parentPlatform.isRtcp()) {
|
if (!sendRtpItem.isTcp()) {
|
||||||
// 开启rtcp保活
|
// 开启rtcp保活
|
||||||
param.put("udp_rtcp_timeout", "1");
|
param.put("udp_rtcp_timeout", sendRtpItem.isRtcp()? "1":"0");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mediaInfo == null) {
|
if (mediaInfo == null) {
|
||||||
|
|||||||
@ -350,8 +350,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId,
|
SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId,
|
||||||
device.getDeviceId(), channelId,
|
device.getDeviceId(), channelId, mediaTransmissionTCP, platform.isRtcp());
|
||||||
mediaTransmissionTCP);
|
|
||||||
|
|
||||||
if (tcpActive != null) {
|
if (tcpActive != null) {
|
||||||
sendRtpItem.setTcpActive(tcpActive);
|
sendRtpItem.setTcpActive(tcpActive);
|
||||||
@ -546,8 +545,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
|||||||
if (streamReady) {
|
if (streamReady) {
|
||||||
// 自平台内容
|
// 自平台内容
|
||||||
SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId,
|
SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId,
|
||||||
gbStream.getApp(), gbStream.getStream(), channelId,
|
gbStream.getApp(), gbStream.getStream(), channelId, mediaTransmissionTCP, platform.isRtcp());
|
||||||
mediaTransmissionTCP);
|
|
||||||
|
|
||||||
if (sendRtpItem == null) {
|
if (sendRtpItem == null) {
|
||||||
logger.warn("服务器端口资源不足");
|
logger.warn("服务器端口资源不足");
|
||||||
@ -586,8 +584,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
|||||||
if (streamReady) {
|
if (streamReady) {
|
||||||
// 自平台内容
|
// 自平台内容
|
||||||
SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId,
|
SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId,
|
||||||
gbStream.getApp(), gbStream.getStream(), channelId,
|
gbStream.getApp(), gbStream.getStream(), channelId, mediaTransmissionTCP, platform.isRtcp());
|
||||||
mediaTransmissionTCP);
|
|
||||||
|
|
||||||
if (sendRtpItem == null) {
|
if (sendRtpItem == null) {
|
||||||
logger.warn("服务器端口资源不足");
|
logger.warn("服务器端口资源不足");
|
||||||
@ -704,7 +701,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
|||||||
dynamicTask.stop(callIdHeader.getCallId());
|
dynamicTask.stop(callIdHeader.getCallId());
|
||||||
if (serverId.equals(userSetting.getServerId())) {
|
if (serverId.equals(userSetting.getServerId())) {
|
||||||
SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, finalPort, ssrc, requesterId,
|
SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, finalPort, ssrc, requesterId,
|
||||||
app, stream, channelId, mediaTransmissionTCP);
|
app, stream, channelId, mediaTransmissionTCP, platform.isRtcp());
|
||||||
|
|
||||||
if (sendRtpItem == null) {
|
if (sendRtpItem == null) {
|
||||||
logger.warn("上级点时创建sendRTPItem失败,可能是服务器端口资源不足");
|
logger.warn("上级点时创建sendRTPItem失败,可能是服务器端口资源不足");
|
||||||
@ -766,7 +763,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
|||||||
// 发送redis消息
|
// 发送redis消息
|
||||||
redisGbPlayMsgListener.sendMsg(streamPushItem.getServerId(), streamPushItem.getMediaServerId(),
|
redisGbPlayMsgListener.sendMsg(streamPushItem.getServerId(), streamPushItem.getMediaServerId(),
|
||||||
streamPushItem.getApp(), streamPushItem.getStream(), addressStr, port, ssrc, requesterId,
|
streamPushItem.getApp(), streamPushItem.getStream(), addressStr, port, ssrc, requesterId,
|
||||||
channelId, mediaTransmissionTCP, null, responseSendItemMsg -> {
|
channelId, mediaTransmissionTCP, platform.isRtcp(),null, responseSendItemMsg -> {
|
||||||
SendRtpItem sendRtpItem = responseSendItemMsg.getSendRtpItem();
|
SendRtpItem sendRtpItem = responseSendItemMsg.getSendRtpItem();
|
||||||
if (sendRtpItem == null || responseSendItemMsg.getMediaServerItem() == null) {
|
if (sendRtpItem == null || responseSendItemMsg.getMediaServerItem() == null) {
|
||||||
logger.warn("服务器端口资源不足");
|
logger.warn("服务器端口资源不足");
|
||||||
|
|||||||
@ -11,7 +11,6 @@ import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
|
|||||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
|
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor;
|
import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
|
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
|
||||||
import com.genersoft.iot.vmp.gb28181.utils.Coordtransform;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.utils.NumericUtil;
|
import com.genersoft.iot.vmp.gb28181.utils.NumericUtil;
|
||||||
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
||||||
import com.genersoft.iot.vmp.gb28181.utils.XmlUtil;
|
import com.genersoft.iot.vmp.gb28181.utils.XmlUtil;
|
||||||
@ -31,7 +30,6 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
|||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import javax.sip.InvalidArgumentException;
|
import javax.sip.InvalidArgumentException;
|
||||||
import javax.sip.RequestEvent;
|
import javax.sip.RequestEvent;
|
||||||
@ -77,8 +75,6 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IDeviceChannelService deviceChannelService;
|
private IDeviceChannelService deviceChannelService;
|
||||||
|
|
||||||
private boolean taskQueueHandlerRun = false;
|
|
||||||
|
|
||||||
private ConcurrentLinkedQueue<HandlerCatchData> taskQueue = new ConcurrentLinkedQueue<>();
|
private ConcurrentLinkedQueue<HandlerCatchData> taskQueue = new ConcurrentLinkedQueue<>();
|
||||||
|
|
||||||
@Qualifier("taskExecutor")
|
@Qualifier("taskExecutor")
|
||||||
@ -98,9 +94,9 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
|
|||||||
}catch (SipException | InvalidArgumentException | ParseException e) {
|
}catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
boolean runed = !taskQueue.isEmpty();
|
||||||
taskQueue.offer(new HandlerCatchData(evt, null, null));
|
taskQueue.offer(new HandlerCatchData(evt, null, null));
|
||||||
if (!taskQueueHandlerRun) {
|
if (!runed) {
|
||||||
taskQueueHandlerRun = true;
|
|
||||||
taskExecutor.execute(()-> {
|
taskExecutor.execute(()-> {
|
||||||
while (!taskQueue.isEmpty()) {
|
while (!taskQueue.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
@ -128,7 +124,6 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
|
|||||||
logger.error("处理NOTIFY消息时错误", e);
|
logger.error("处理NOTIFY消息时错误", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
taskQueueHandlerRun = false;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,16 @@
|
|||||||
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl;
|
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.conf.SipConfig;
|
import com.genersoft.iot.vmp.conf.SipConfig;
|
||||||
|
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||||
import com.genersoft.iot.vmp.gb28181.auth.DigestServerAuthenticationHelper;
|
import com.genersoft.iot.vmp.gb28181.auth.DigestServerAuthenticationHelper;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.bean.RemoteAddressInfo;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.WvpSipDate;
|
import com.genersoft.iot.vmp.gb28181.bean.WvpSipDate;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver;
|
import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.SIPSender;
|
import com.genersoft.iot.vmp.gb28181.transmit.SIPSender;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor;
|
import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
|
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
||||||
import com.genersoft.iot.vmp.service.IDeviceService;
|
import com.genersoft.iot.vmp.service.IDeviceService;
|
||||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||||
import gov.nist.javax.sip.RequestEventExt;
|
import gov.nist.javax.sip.RequestEventExt;
|
||||||
@ -56,6 +59,9 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SIPSender sipSender;
|
private SIPSender sipSender;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserSetting userSetting;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() throws Exception {
|
||||||
// 添加消息处理的订阅
|
// 添加消息处理的订阅
|
||||||
@ -125,15 +131,9 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen
|
|||||||
// 添加Expires头
|
// 添加Expires头
|
||||||
response.addHeader(request.getExpires());
|
response.addHeader(request.getExpires());
|
||||||
|
|
||||||
// 获取到通信地址等信息
|
RemoteAddressInfo remoteAddressInfo = SipUtils.getRemoteAddressFromRequest(request,
|
||||||
ViaHeader viaHeader = (ViaHeader) request.getHeader(ViaHeader.NAME);
|
userSetting.getSipUseSourceIpAsRemoteAddress());
|
||||||
String received = viaHeader.getReceived();
|
|
||||||
int rPort = viaHeader.getRPort();
|
|
||||||
// 解析本地地址替代
|
|
||||||
if (ObjectUtils.isEmpty(received) || rPort == -1) {
|
|
||||||
received = viaHeader.getHost();
|
|
||||||
rPort = viaHeader.getPort();
|
|
||||||
}
|
|
||||||
if (device == null) {
|
if (device == null) {
|
||||||
device = new Device();
|
device = new Device();
|
||||||
device.setStreamMode("UDP");
|
device.setStreamMode("UDP");
|
||||||
@ -143,9 +143,9 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen
|
|||||||
device.setDeviceId(deviceId);
|
device.setDeviceId(deviceId);
|
||||||
device.setOnline(0);
|
device.setOnline(0);
|
||||||
}
|
}
|
||||||
device.setIp(received);
|
device.setIp(remoteAddressInfo.getIp());
|
||||||
device.setPort(rPort);
|
device.setPort(remoteAddressInfo.getPort());
|
||||||
device.setHostAddress(received.concat(":").concat(String.valueOf(rPort)));
|
device.setHostAddress(remoteAddressInfo.getIp().concat(":").concat(String.valueOf(remoteAddressInfo.getPort())));
|
||||||
device.setLocalIp(request.getLocalAddress().getHostAddress());
|
device.setLocalIp(request.getLocalAddress().getHostAddress());
|
||||||
if (request.getExpires().getExpires() == 0) {
|
if (request.getExpires().getExpires() == 0) {
|
||||||
// 注销成功
|
// 注销成功
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
|||||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
|
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler;
|
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler;
|
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler;
|
||||||
import com.genersoft.iot.vmp.gb28181.utils.Coordtransform;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.utils.NumericUtil;
|
import com.genersoft.iot.vmp.gb28181.utils.NumericUtil;
|
||||||
import com.genersoft.iot.vmp.gb28181.utils.XmlUtil;
|
import com.genersoft.iot.vmp.gb28181.utils.XmlUtil;
|
||||||
import com.genersoft.iot.vmp.service.IDeviceAlarmService;
|
import com.genersoft.iot.vmp.service.IDeviceAlarmService;
|
||||||
@ -27,17 +26,15 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
|||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import javax.sip.InvalidArgumentException;
|
import javax.sip.InvalidArgumentException;
|
||||||
import javax.sip.RequestEvent;
|
import javax.sip.RequestEvent;
|
||||||
import javax.sip.SipException;
|
import javax.sip.SipException;
|
||||||
import javax.sip.message.Response;
|
import javax.sip.message.Response;
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
|
|
||||||
import static com.genersoft.iot.vmp.gb28181.utils.XmlUtil.*;
|
import static com.genersoft.iot.vmp.gb28181.utils.XmlUtil.getText;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 报警事件的处理,参考:9.4
|
* 报警事件的处理,参考:9.4
|
||||||
@ -72,8 +69,6 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IDeviceChannelService deviceChannelService;
|
private IDeviceChannelService deviceChannelService;
|
||||||
|
|
||||||
private boolean taskQueueHandlerRun = false;
|
|
||||||
|
|
||||||
private ConcurrentLinkedQueue<SipMsgInfo> taskQueue = new ConcurrentLinkedQueue<>();
|
private ConcurrentLinkedQueue<SipMsgInfo> taskQueue = new ConcurrentLinkedQueue<>();
|
||||||
|
|
||||||
@Qualifier("taskExecutor")
|
@Qualifier("taskExecutor")
|
||||||
@ -89,128 +84,128 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
|
|||||||
@Override
|
@Override
|
||||||
public void handForDevice(RequestEvent evt, Device device, Element rootElement) {
|
public void handForDevice(RequestEvent evt, Device device, Element rootElement) {
|
||||||
logger.info("[收到报警通知]设备:{}", device.getDeviceId());
|
logger.info("[收到报警通知]设备:{}", device.getDeviceId());
|
||||||
|
boolean isEmpty = taskQueue.isEmpty();
|
||||||
taskQueue.offer(new SipMsgInfo(evt, device, rootElement));
|
taskQueue.offer(new SipMsgInfo(evt, device, rootElement));
|
||||||
if (!taskQueueHandlerRun) {
|
// 回复200 OK
|
||||||
taskQueueHandlerRun = true;
|
try {
|
||||||
|
responseAck((SIPRequest) evt.getRequest(), Response.OK);
|
||||||
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
|
logger.error("[命令发送失败] 报警通知回复: {}", e.getMessage());
|
||||||
|
}
|
||||||
|
if (isEmpty) {
|
||||||
taskExecutor.execute(() -> {
|
taskExecutor.execute(() -> {
|
||||||
logger.info("[处理报警通知]待处理数量:{}", taskQueue.size() );
|
logger.info("[处理报警通知]待处理数量:{}", taskQueue.size() );
|
||||||
while (!taskQueue.isEmpty()) {
|
while (!taskQueue.isEmpty()) {
|
||||||
SipMsgInfo sipMsgInfo = taskQueue.poll();
|
|
||||||
// 回复200 OK
|
|
||||||
try {
|
try {
|
||||||
responseAck((SIPRequest) sipMsgInfo.getEvt().getRequest(), Response.OK);
|
SipMsgInfo sipMsgInfo = taskQueue.poll();
|
||||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
|
||||||
logger.error("[处理报警通知], 回复200OK失败", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
Element deviceIdElement = sipMsgInfo.getRootElement().element("DeviceID");
|
Element deviceIdElement = sipMsgInfo.getRootElement().element("DeviceID");
|
||||||
String channelId = deviceIdElement.getText().toString();
|
String channelId = deviceIdElement.getText().toString();
|
||||||
|
|
||||||
DeviceAlarm deviceAlarm = new DeviceAlarm();
|
DeviceAlarm deviceAlarm = new DeviceAlarm();
|
||||||
deviceAlarm.setCreateTime(DateUtil.getNow());
|
deviceAlarm.setCreateTime(DateUtil.getNow());
|
||||||
deviceAlarm.setDeviceId(sipMsgInfo.getDevice().getDeviceId());
|
deviceAlarm.setDeviceId(sipMsgInfo.getDevice().getDeviceId());
|
||||||
deviceAlarm.setChannelId(channelId);
|
deviceAlarm.setChannelId(channelId);
|
||||||
deviceAlarm.setAlarmPriority(getText(sipMsgInfo.getRootElement(), "AlarmPriority"));
|
deviceAlarm.setAlarmPriority(getText(sipMsgInfo.getRootElement(), "AlarmPriority"));
|
||||||
deviceAlarm.setAlarmMethod(getText(sipMsgInfo.getRootElement(), "AlarmMethod"));
|
deviceAlarm.setAlarmMethod(getText(sipMsgInfo.getRootElement(), "AlarmMethod"));
|
||||||
String alarmTime = XmlUtil.getText(sipMsgInfo.getRootElement(), "AlarmTime");
|
String alarmTime = XmlUtil.getText(sipMsgInfo.getRootElement(), "AlarmTime");
|
||||||
if (alarmTime == null) {
|
if (alarmTime == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
deviceAlarm.setAlarmTime(DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(alarmTime));
|
deviceAlarm.setAlarmTime(DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(alarmTime));
|
||||||
String alarmDescription = getText(sipMsgInfo.getRootElement(), "AlarmDescription");
|
String alarmDescription = getText(sipMsgInfo.getRootElement(), "AlarmDescription");
|
||||||
if (alarmDescription == null) {
|
if (alarmDescription == null) {
|
||||||
deviceAlarm.setAlarmDescription("");
|
deviceAlarm.setAlarmDescription("");
|
||||||
} else {
|
} else {
|
||||||
deviceAlarm.setAlarmDescription(alarmDescription);
|
deviceAlarm.setAlarmDescription(alarmDescription);
|
||||||
}
|
}
|
||||||
String longitude = getText(sipMsgInfo.getRootElement(), "Longitude");
|
String longitude = getText(sipMsgInfo.getRootElement(), "Longitude");
|
||||||
if (longitude != null && NumericUtil.isDouble(longitude)) {
|
if (longitude != null && NumericUtil.isDouble(longitude)) {
|
||||||
deviceAlarm.setLongitude(Double.parseDouble(longitude));
|
deviceAlarm.setLongitude(Double.parseDouble(longitude));
|
||||||
} else {
|
} else {
|
||||||
deviceAlarm.setLongitude(0.00);
|
deviceAlarm.setLongitude(0.00);
|
||||||
}
|
}
|
||||||
String latitude = getText(sipMsgInfo.getRootElement(), "Latitude");
|
String latitude = getText(sipMsgInfo.getRootElement(), "Latitude");
|
||||||
if (latitude != null && NumericUtil.isDouble(latitude)) {
|
if (latitude != null && NumericUtil.isDouble(latitude)) {
|
||||||
deviceAlarm.setLatitude(Double.parseDouble(latitude));
|
deviceAlarm.setLatitude(Double.parseDouble(latitude));
|
||||||
} else {
|
} else {
|
||||||
deviceAlarm.setLatitude(0.00);
|
deviceAlarm.setLatitude(0.00);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ObjectUtils.isEmpty(deviceAlarm.getAlarmMethod())) {
|
if (!ObjectUtils.isEmpty(deviceAlarm.getAlarmMethod())) {
|
||||||
if ( deviceAlarm.getAlarmMethod().contains(DeviceAlarmMethod.GPS.getVal() + "")) {
|
if ( deviceAlarm.getAlarmMethod().contains(DeviceAlarmMethod.GPS.getVal() + "")) {
|
||||||
MobilePosition mobilePosition = new MobilePosition();
|
MobilePosition mobilePosition = new MobilePosition();
|
||||||
mobilePosition.setCreateTime(DateUtil.getNow());
|
mobilePosition.setCreateTime(DateUtil.getNow());
|
||||||
mobilePosition.setDeviceId(deviceAlarm.getDeviceId());
|
mobilePosition.setDeviceId(deviceAlarm.getDeviceId());
|
||||||
mobilePosition.setTime(deviceAlarm.getAlarmTime());
|
mobilePosition.setTime(deviceAlarm.getAlarmTime());
|
||||||
mobilePosition.setLongitude(deviceAlarm.getLongitude());
|
mobilePosition.setLongitude(deviceAlarm.getLongitude());
|
||||||
mobilePosition.setLatitude(deviceAlarm.getLatitude());
|
mobilePosition.setLatitude(deviceAlarm.getLatitude());
|
||||||
mobilePosition.setReportSource("GPS Alarm");
|
mobilePosition.setReportSource("GPS Alarm");
|
||||||
|
|
||||||
// 更新device channel 的经纬度
|
// 更新device channel 的经纬度
|
||||||
DeviceChannel deviceChannel = new DeviceChannel();
|
DeviceChannel deviceChannel = new DeviceChannel();
|
||||||
deviceChannel.setDeviceId(sipMsgInfo.getDevice().getDeviceId());
|
deviceChannel.setDeviceId(sipMsgInfo.getDevice().getDeviceId());
|
||||||
deviceChannel.setChannelId(channelId);
|
deviceChannel.setChannelId(channelId);
|
||||||
deviceChannel.setLongitude(mobilePosition.getLongitude());
|
deviceChannel.setLongitude(mobilePosition.getLongitude());
|
||||||
deviceChannel.setLatitude(mobilePosition.getLatitude());
|
deviceChannel.setLatitude(mobilePosition.getLatitude());
|
||||||
deviceChannel.setGpsTime(mobilePosition.getTime());
|
deviceChannel.setGpsTime(mobilePosition.getTime());
|
||||||
|
|
||||||
deviceChannel = deviceChannelService.updateGps(deviceChannel, sipMsgInfo.getDevice());
|
deviceChannel = deviceChannelService.updateGps(deviceChannel, sipMsgInfo.getDevice());
|
||||||
|
|
||||||
mobilePosition.setLongitudeWgs84(deviceChannel.getLongitudeWgs84());
|
mobilePosition.setLongitudeWgs84(deviceChannel.getLongitudeWgs84());
|
||||||
mobilePosition.setLatitudeWgs84(deviceChannel.getLatitudeWgs84());
|
mobilePosition.setLatitudeWgs84(deviceChannel.getLatitudeWgs84());
|
||||||
mobilePosition.setLongitudeGcj02(deviceChannel.getLongitudeGcj02());
|
mobilePosition.setLongitudeGcj02(deviceChannel.getLongitudeGcj02());
|
||||||
mobilePosition.setLatitudeGcj02(deviceChannel.getLatitudeGcj02());
|
mobilePosition.setLatitudeGcj02(deviceChannel.getLatitudeGcj02());
|
||||||
|
|
||||||
if (userSetting.getSavePositionHistory()) {
|
if (userSetting.getSavePositionHistory()) {
|
||||||
storager.insertMobilePosition(mobilePosition);
|
storager.insertMobilePosition(mobilePosition);
|
||||||
|
}
|
||||||
|
storager.updateChannelPosition(deviceChannel);
|
||||||
|
|
||||||
|
// 发送redis消息。 通知位置信息的变化
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put("time", mobilePosition.getTime());
|
||||||
|
jsonObject.put("serial", deviceChannel.getDeviceId());
|
||||||
|
jsonObject.put("code", deviceChannel.getChannelId());
|
||||||
|
jsonObject.put("longitude", mobilePosition.getLongitude());
|
||||||
|
jsonObject.put("latitude", mobilePosition.getLatitude());
|
||||||
|
jsonObject.put("altitude", mobilePosition.getAltitude());
|
||||||
|
jsonObject.put("direction", mobilePosition.getDirection());
|
||||||
|
jsonObject.put("speed", mobilePosition.getSpeed());
|
||||||
|
redisCatchStorage.sendMobilePositionMsg(jsonObject);
|
||||||
}
|
}
|
||||||
storager.updateChannelPosition(deviceChannel);
|
|
||||||
|
|
||||||
// 发送redis消息。 通知位置信息的变化
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
|
||||||
jsonObject.put("time", mobilePosition.getTime());
|
|
||||||
jsonObject.put("serial", deviceChannel.getDeviceId());
|
|
||||||
jsonObject.put("code", deviceChannel.getChannelId());
|
|
||||||
jsonObject.put("longitude", mobilePosition.getLongitude());
|
|
||||||
jsonObject.put("latitude", mobilePosition.getLatitude());
|
|
||||||
jsonObject.put("altitude", mobilePosition.getAltitude());
|
|
||||||
jsonObject.put("direction", mobilePosition.getDirection());
|
|
||||||
jsonObject.put("speed", mobilePosition.getSpeed());
|
|
||||||
redisCatchStorage.sendMobilePositionMsg(jsonObject);
|
|
||||||
}
|
}
|
||||||
}
|
if (!ObjectUtils.isEmpty(deviceAlarm.getDeviceId())) {
|
||||||
if (!ObjectUtils.isEmpty(deviceAlarm.getDeviceId())) {
|
if (deviceAlarm.getAlarmMethod().contains(DeviceAlarmMethod.Video.getVal() + "")) {
|
||||||
if (deviceAlarm.getAlarmMethod().contains(DeviceAlarmMethod.Video.getVal() + "")) {
|
deviceAlarm.setAlarmType(getText(sipMsgInfo.getRootElement().element("Info"), "AlarmType"));
|
||||||
deviceAlarm.setAlarmType(getText(sipMsgInfo.getRootElement().element("Info"), "AlarmType"));
|
}
|
||||||
|
}
|
||||||
|
logger.info("[收到报警通知]内容:{}", JSON.toJSONString(deviceAlarm));
|
||||||
|
if ("7".equals(deviceAlarm.getAlarmMethod()) ) {
|
||||||
|
// 发送给平台的报警信息。 发送redis通知
|
||||||
|
AlarmChannelMessage alarmChannelMessage = new AlarmChannelMessage();
|
||||||
|
alarmChannelMessage.setAlarmSn(Integer.parseInt(deviceAlarm.getAlarmMethod()));
|
||||||
|
alarmChannelMessage.setAlarmDescription(deviceAlarm.getAlarmDescription());
|
||||||
|
alarmChannelMessage.setGbId(channelId);
|
||||||
|
redisCatchStorage.sendAlarmMsg(alarmChannelMessage);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
logger.info("[收到报警通知]内容:{}", JSON.toJSONString(deviceAlarm));
|
|
||||||
if ("7".equals(deviceAlarm.getAlarmMethod()) ) {
|
|
||||||
// 发送给平台的报警信息。 发送redis通知
|
|
||||||
AlarmChannelMessage alarmChannelMessage = new AlarmChannelMessage();
|
|
||||||
alarmChannelMessage.setAlarmSn(Integer.parseInt(deviceAlarm.getAlarmMethod()));
|
|
||||||
alarmChannelMessage.setAlarmDescription(deviceAlarm.getAlarmDescription());
|
|
||||||
alarmChannelMessage.setGbId(channelId);
|
|
||||||
redisCatchStorage.sendAlarmMsg(alarmChannelMessage);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.debug("存储报警信息、报警分类");
|
logger.debug("存储报警信息、报警分类");
|
||||||
// 存储报警信息、报警分类
|
// 存储报警信息、报警分类
|
||||||
if (sipConfig.isAlarm()) {
|
if (sipConfig.isAlarm()) {
|
||||||
deviceAlarmService.add(deviceAlarm);
|
deviceAlarmService.add(deviceAlarm);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (redisCatchStorage.deviceIsOnline(sipMsgInfo.getDevice().getDeviceId())) {
|
if (redisCatchStorage.deviceIsOnline(sipMsgInfo.getDevice().getDeviceId())) {
|
||||||
publisher.deviceAlarmEventPublish(deviceAlarm);
|
publisher.deviceAlarmEventPublish(deviceAlarm);
|
||||||
|
}
|
||||||
|
}catch (Exception e) {
|
||||||
|
logger.warn("[收到报警通知] 发现未处理的异常, {}\r\n{}",e.getMessage(), evt.getRequest());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
taskQueueHandlerRun = false;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd;
|
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
import com.genersoft.iot.vmp.gb28181.bean.RemoteAddressInfo;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
|
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler;
|
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler;
|
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
||||||
import com.genersoft.iot.vmp.service.IDeviceService;
|
import com.genersoft.iot.vmp.service.IDeviceService;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
|
||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
|
||||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||||
import gov.nist.javax.sip.message.SIPRequest;
|
import gov.nist.javax.sip.message.SIPRequest;
|
||||||
import org.dom4j.Element;
|
import org.dom4j.Element;
|
||||||
@ -17,13 +17,10 @@ import org.slf4j.LoggerFactory;
|
|||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.ObjectUtils;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import javax.sip.InvalidArgumentException;
|
import javax.sip.InvalidArgumentException;
|
||||||
import javax.sip.RequestEvent;
|
import javax.sip.RequestEvent;
|
||||||
import javax.sip.SipException;
|
import javax.sip.SipException;
|
||||||
import javax.sip.header.ViaHeader;
|
|
||||||
import javax.sip.message.Response;
|
import javax.sip.message.Response;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
|
|
||||||
@ -33,6 +30,7 @@ import java.text.ParseException;
|
|||||||
@Component
|
@Component
|
||||||
public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent implements InitializingBean, IMessageHandler {
|
public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent implements InitializingBean, IMessageHandler {
|
||||||
|
|
||||||
|
|
||||||
private Logger logger = LoggerFactory.getLogger(KeepaliveNotifyMessageHandler.class);
|
private Logger logger = LoggerFactory.getLogger(KeepaliveNotifyMessageHandler.class);
|
||||||
private final static String cmdType = "Keepalive";
|
private final static String cmdType = "Keepalive";
|
||||||
|
|
||||||
@ -42,6 +40,9 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IDeviceService deviceService;
|
private IDeviceService deviceService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserSetting userSetting;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() throws Exception {
|
||||||
notifyMessageHandler.addHandler(cmdType, this);
|
notifyMessageHandler.addHandler(cmdType, this);
|
||||||
@ -53,25 +54,19 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp
|
|||||||
// 未注册的设备不做处理
|
// 未注册的设备不做处理
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
SIPRequest request = (SIPRequest) evt.getRequest();
|
||||||
// 回复200 OK
|
// 回复200 OK
|
||||||
try {
|
try {
|
||||||
responseAck((SIPRequest) evt.getRequest(), Response.OK);
|
responseAck(request, Response.OK);
|
||||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
logger.error("[命令发送失败] 国标级联 心跳回复: {}", e.getMessage());
|
logger.error("[命令发送失败] 心跳回复: {}", e.getMessage());
|
||||||
}
|
}
|
||||||
// 判断RPort是否改变,改变则说明路由nat信息变化,修改设备信息
|
|
||||||
// 获取到通信地址等信息
|
RemoteAddressInfo remoteAddressInfo = SipUtils.getRemoteAddressFromRequest(request, userSetting.getSipUseSourceIpAsRemoteAddress());
|
||||||
ViaHeader viaHeader = (ViaHeader) evt.getRequest().getHeader(ViaHeader.NAME);
|
if (!device.getIp().equalsIgnoreCase(remoteAddressInfo.getIp()) || device.getPort() != remoteAddressInfo.getPort()) {
|
||||||
String received = viaHeader.getReceived();
|
device.setPort(remoteAddressInfo.getPort());
|
||||||
int rPort = viaHeader.getRPort();
|
device.setHostAddress(remoteAddressInfo.getIp().concat(":").concat(String.valueOf(remoteAddressInfo.getPort())));
|
||||||
// 解析本地地址替代
|
device.setIp(remoteAddressInfo.getIp());
|
||||||
if (ObjectUtils.isEmpty(received) || rPort == -1) {
|
|
||||||
received = viaHeader.getHost();
|
|
||||||
rPort = viaHeader.getPort();
|
|
||||||
}
|
|
||||||
if (device.getPort() != rPort) {
|
|
||||||
device.setPort(rPort);
|
|
||||||
device.setHostAddress(received.concat(":").concat(String.valueOf(rPort)));
|
|
||||||
}
|
}
|
||||||
device.setKeepaliveTime(DateUtil.getNow());
|
device.setKeepaliveTime(DateUtil.getNow());
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,6 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
|||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import javax.sip.InvalidArgumentException;
|
import javax.sip.InvalidArgumentException;
|
||||||
import javax.sip.RequestEvent;
|
import javax.sip.RequestEvent;
|
||||||
@ -57,8 +56,6 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IDeviceChannelService deviceChannelService;
|
private IDeviceChannelService deviceChannelService;
|
||||||
|
|
||||||
private boolean taskQueueHandlerRun = false;
|
|
||||||
|
|
||||||
private ConcurrentLinkedQueue<SipMsgInfo> taskQueue = new ConcurrentLinkedQueue<>();
|
private ConcurrentLinkedQueue<SipMsgInfo> taskQueue = new ConcurrentLinkedQueue<>();
|
||||||
|
|
||||||
@Qualifier("taskExecutor")
|
@Qualifier("taskExecutor")
|
||||||
@ -73,21 +70,22 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen
|
|||||||
@Override
|
@Override
|
||||||
public void handForDevice(RequestEvent evt, Device device, Element rootElement) {
|
public void handForDevice(RequestEvent evt, Device device, Element rootElement) {
|
||||||
|
|
||||||
|
boolean isEmpty = taskQueue.isEmpty();
|
||||||
taskQueue.offer(new SipMsgInfo(evt, device, rootElement));
|
taskQueue.offer(new SipMsgInfo(evt, device, rootElement));
|
||||||
if (!taskQueueHandlerRun) {
|
// 回复200 OK
|
||||||
taskQueueHandlerRun = true;
|
try {
|
||||||
|
responseAck((SIPRequest) evt.getRequest(), Response.OK);
|
||||||
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
|
logger.error("[命令发送失败] 移动位置通知回复: {}", e.getMessage());
|
||||||
|
}
|
||||||
|
if (isEmpty) {
|
||||||
taskExecutor.execute(() -> {
|
taskExecutor.execute(() -> {
|
||||||
while (!taskQueue.isEmpty()) {
|
while (!taskQueue.isEmpty()) {
|
||||||
SipMsgInfo sipMsgInfo = taskQueue.poll();
|
SipMsgInfo sipMsgInfo = taskQueue.poll();
|
||||||
try {
|
try {
|
||||||
Element rootElementAfterCharset = getRootElement(sipMsgInfo.getEvt(), sipMsgInfo.getDevice().getCharset());
|
Element rootElementAfterCharset = getRootElement(sipMsgInfo.getEvt(), sipMsgInfo.getDevice().getCharset());
|
||||||
if (rootElementAfterCharset == null) {
|
if (rootElementAfterCharset == null) {
|
||||||
try {
|
logger.warn("[移动位置通知] {}处理失败,未识别到信息体", device.getDeviceId());
|
||||||
logger.warn("[ 移动设备位置数据通知 ] content cannot be null, {}", sipMsgInfo.getEvt().getRequest());
|
|
||||||
responseAck((SIPRequest) sipMsgInfo.getEvt().getRequest(), Response.BAD_REQUEST);
|
|
||||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
|
||||||
logger.error("[命令发送失败] 移动设备位置数据通知 内容为空: {}", e.getMessage());
|
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
MobilePosition mobilePosition = new MobilePosition();
|
MobilePosition mobilePosition = new MobilePosition();
|
||||||
@ -137,12 +135,6 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen
|
|||||||
storager.insertMobilePosition(mobilePosition);
|
storager.insertMobilePosition(mobilePosition);
|
||||||
}
|
}
|
||||||
storager.updateChannelPosition(deviceChannel);
|
storager.updateChannelPosition(deviceChannel);
|
||||||
//回复 200 OK
|
|
||||||
try {
|
|
||||||
responseAck((SIPRequest) sipMsgInfo.getEvt().getRequest(), Response.OK);
|
|
||||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
|
||||||
logger.error("[命令发送失败] 移动设备位置数据回复200: {}", e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 发送redis消息。 通知位置信息的变化
|
// 发送redis消息。 通知位置信息的变化
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
@ -158,14 +150,12 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen
|
|||||||
|
|
||||||
} catch (DocumentException e) {
|
} catch (DocumentException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.warn("[移动位置通知] 发现未处理的异常, {}\r\n{}",e.getMessage(), evt.getRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
taskQueueHandlerRun = false;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,18 +1,11 @@
|
|||||||
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd;
|
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.conf.SipConfig;
|
|
||||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.session.CatalogDataCatch;
|
import com.genersoft.iot.vmp.gb28181.session.CatalogDataCatch;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
|
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler;
|
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler;
|
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler;
|
||||||
import com.genersoft.iot.vmp.gb28181.utils.Coordtransform;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.utils.NumericUtil;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.utils.XmlUtil;
|
import com.genersoft.iot.vmp.gb28181.utils.XmlUtil;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
|
||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||||
import gov.nist.javax.sip.message.SIPRequest;
|
import gov.nist.javax.sip.message.SIPRequest;
|
||||||
import org.dom4j.DocumentException;
|
import org.dom4j.DocumentException;
|
||||||
@ -24,7 +17,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import javax.sip.InvalidArgumentException;
|
import javax.sip.InvalidArgumentException;
|
||||||
import javax.sip.RequestEvent;
|
import javax.sip.RequestEvent;
|
||||||
@ -45,12 +37,10 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
|
|||||||
private Logger logger = LoggerFactory.getLogger(CatalogResponseMessageHandler.class);
|
private Logger logger = LoggerFactory.getLogger(CatalogResponseMessageHandler.class);
|
||||||
private final String cmdType = "Catalog";
|
private final String cmdType = "Catalog";
|
||||||
|
|
||||||
private boolean taskQueueHandlerRun = false;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ResponseMessageHandler responseMessageHandler;
|
private ResponseMessageHandler responseMessageHandler;
|
||||||
|
|
||||||
private ConcurrentLinkedQueue<HandlerCatchData> taskQueue = new ConcurrentLinkedQueue<>();
|
private final ConcurrentLinkedQueue<HandlerCatchData> taskQueue = new ConcurrentLinkedQueue<>();
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IVideoManagerStorage storager;
|
private IVideoManagerStorage storager;
|
||||||
@ -69,6 +59,7 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handForDevice(RequestEvent evt, Device device, Element element) {
|
public void handForDevice(RequestEvent evt, Device device, Element element) {
|
||||||
|
boolean isEmpty = taskQueue.isEmpty();
|
||||||
taskQueue.offer(new HandlerCatchData(evt, device, element));
|
taskQueue.offer(new HandlerCatchData(evt, device, element));
|
||||||
// 回复200 OK
|
// 回复200 OK
|
||||||
try {
|
try {
|
||||||
@ -76,67 +67,71 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
|
|||||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
logger.error("[命令发送失败] 目录查询回复: {}", e.getMessage());
|
logger.error("[命令发送失败] 目录查询回复: {}", e.getMessage());
|
||||||
}
|
}
|
||||||
if (!taskQueueHandlerRun) {
|
// 如果不为空则说明已经开启消息处理
|
||||||
taskQueueHandlerRun = true;
|
if (isEmpty) {
|
||||||
taskExecutor.execute(() -> {
|
taskExecutor.execute(() -> {
|
||||||
while (!taskQueue.isEmpty()) {
|
while (!taskQueue.isEmpty()) {
|
||||||
HandlerCatchData take = taskQueue.poll();
|
// 全局异常捕获,保证下一条可以得到处理
|
||||||
Element rootElement = null;
|
|
||||||
try {
|
try {
|
||||||
rootElement = getRootElement(take.getEvt(), take.getDevice().getCharset());
|
HandlerCatchData take = taskQueue.poll();
|
||||||
} catch (DocumentException e) {
|
Element rootElement = null;
|
||||||
logger.error("[xml解析] 失败: ", e);
|
try {
|
||||||
continue;
|
rootElement = getRootElement(take.getEvt(), take.getDevice().getCharset());
|
||||||
}
|
} catch (DocumentException e) {
|
||||||
if (rootElement == null) {
|
logger.error("[xml解析] 失败: ", e);
|
||||||
logger.warn("[ 收到通道 ] content cannot be null, {}", evt.getRequest());
|
continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
Element deviceListElement = rootElement.element("DeviceList");
|
|
||||||
Element sumNumElement = rootElement.element("SumNum");
|
|
||||||
Element snElement = rootElement.element("SN");
|
|
||||||
int sumNum = Integer.parseInt(sumNumElement.getText());
|
|
||||||
|
|
||||||
if (sumNum == 0) {
|
|
||||||
logger.info("[收到通道]设备:{}的: 0个", take.getDevice().getDeviceId());
|
|
||||||
// 数据已经完整接收
|
|
||||||
storager.cleanChannelsForDevice(take.getDevice().getDeviceId());
|
|
||||||
catalogDataCatch.setChannelSyncEnd(take.getDevice().getDeviceId(), null);
|
|
||||||
} else {
|
|
||||||
Iterator<Element> deviceListIterator = deviceListElement.elementIterator();
|
|
||||||
if (deviceListIterator != null) {
|
|
||||||
List<DeviceChannel> channelList = new ArrayList<>();
|
|
||||||
// 遍历DeviceList
|
|
||||||
while (deviceListIterator.hasNext()) {
|
|
||||||
Element itemDevice = deviceListIterator.next();
|
|
||||||
Element channelDeviceElement = itemDevice.element("DeviceID");
|
|
||||||
if (channelDeviceElement == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
DeviceChannel deviceChannel = XmlUtil.channelContentHander(itemDevice, device, null);
|
|
||||||
deviceChannel.setDeviceId(take.getDevice().getDeviceId());
|
|
||||||
|
|
||||||
channelList.add(deviceChannel);
|
|
||||||
}
|
|
||||||
int sn = Integer.parseInt(snElement.getText());
|
|
||||||
catalogDataCatch.put(take.getDevice().getDeviceId(), sn, sumNum, take.getDevice(), channelList);
|
|
||||||
logger.info("[收到通道]设备: {} -> {}个,{}/{}", take.getDevice().getDeviceId(), channelList.size(), catalogDataCatch.get(take.getDevice().getDeviceId()) == null ? 0 : catalogDataCatch.get(take.getDevice().getDeviceId()).size(), sumNum);
|
|
||||||
if (catalogDataCatch.get(take.getDevice().getDeviceId()).size() == sumNum) {
|
|
||||||
// 数据已经完整接收, 此时可能存在某个设备离线变上线的情况,但是考虑到性能,此处不做处理,
|
|
||||||
// 目前支持设备通道上线通知时和设备上线时向上级通知
|
|
||||||
boolean resetChannelsResult = storager.resetChannels(take.getDevice().getDeviceId(), catalogDataCatch.get(take.getDevice().getDeviceId()));
|
|
||||||
if (!resetChannelsResult) {
|
|
||||||
String errorMsg = "接收成功,写入失败,共" + sumNum + "条,已接收" + catalogDataCatch.get(take.getDevice().getDeviceId()).size() + "条";
|
|
||||||
catalogDataCatch.setChannelSyncEnd(take.getDevice().getDeviceId(), errorMsg);
|
|
||||||
} else {
|
|
||||||
catalogDataCatch.setChannelSyncEnd(take.getDevice().getDeviceId(), null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (rootElement == null) {
|
||||||
|
logger.warn("[ 收到通道 ] content cannot be null, {}", evt.getRequest());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Element deviceListElement = rootElement.element("DeviceList");
|
||||||
|
Element sumNumElement = rootElement.element("SumNum");
|
||||||
|
Element snElement = rootElement.element("SN");
|
||||||
|
int sumNum = Integer.parseInt(sumNumElement.getText());
|
||||||
|
|
||||||
|
if (sumNum == 0) {
|
||||||
|
logger.info("[收到通道]设备:{}的: 0个", take.getDevice().getDeviceId());
|
||||||
|
// 数据已经完整接收
|
||||||
|
storager.cleanChannelsForDevice(take.getDevice().getDeviceId());
|
||||||
|
catalogDataCatch.setChannelSyncEnd(take.getDevice().getDeviceId(), null);
|
||||||
|
} else {
|
||||||
|
Iterator<Element> deviceListIterator = deviceListElement.elementIterator();
|
||||||
|
if (deviceListIterator != null) {
|
||||||
|
List<DeviceChannel> channelList = new ArrayList<>();
|
||||||
|
// 遍历DeviceList
|
||||||
|
while (deviceListIterator.hasNext()) {
|
||||||
|
Element itemDevice = deviceListIterator.next();
|
||||||
|
Element channelDeviceElement = itemDevice.element("DeviceID");
|
||||||
|
if (channelDeviceElement == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
DeviceChannel deviceChannel = XmlUtil.channelContentHander(itemDevice, device, null);
|
||||||
|
deviceChannel.setDeviceId(take.getDevice().getDeviceId());
|
||||||
|
|
||||||
|
channelList.add(deviceChannel);
|
||||||
|
}
|
||||||
|
int sn = Integer.parseInt(snElement.getText());
|
||||||
|
catalogDataCatch.put(take.getDevice().getDeviceId(), sn, sumNum, take.getDevice(), channelList);
|
||||||
|
logger.info("[收到通道]设备: {} -> {}个,{}/{}", take.getDevice().getDeviceId(), channelList.size(), catalogDataCatch.get(take.getDevice().getDeviceId()) == null ? 0 : catalogDataCatch.get(take.getDevice().getDeviceId()).size(), sumNum);
|
||||||
|
if (catalogDataCatch.get(take.getDevice().getDeviceId()).size() == sumNum) {
|
||||||
|
// 数据已经完整接收, 此时可能存在某个设备离线变上线的情况,但是考虑到性能,此处不做处理,
|
||||||
|
// 目前支持设备通道上线通知时和设备上线时向上级通知
|
||||||
|
boolean resetChannelsResult = storager.resetChannels(take.getDevice().getDeviceId(), catalogDataCatch.get(take.getDevice().getDeviceId()));
|
||||||
|
if (!resetChannelsResult) {
|
||||||
|
String errorMsg = "接收成功,写入失败,共" + sumNum + "条,已接收" + catalogDataCatch.get(take.getDevice().getDeviceId()).size() + "条";
|
||||||
|
catalogDataCatch.setChannelSyncEnd(take.getDevice().getDeviceId(), errorMsg);
|
||||||
|
} else {
|
||||||
|
catalogDataCatch.setChannelSyncEnd(take.getDevice().getDeviceId(), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}catch (Exception e) {
|
||||||
|
logger.warn("[收到通道] 发现未处理的异常, {}\r\n{}",e.getMessage(), evt.getRequest());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
taskQueueHandlerRun = false;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorP
|
|||||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler;
|
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler;
|
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler;
|
||||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
|
||||||
import gov.nist.javax.sip.message.SIPRequest;
|
import gov.nist.javax.sip.message.SIPRequest;
|
||||||
import org.dom4j.DocumentException;
|
import org.dom4j.DocumentException;
|
||||||
import org.dom4j.Element;
|
import org.dom4j.Element;
|
||||||
@ -21,17 +20,17 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
|||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import javax.sip.InvalidArgumentException;
|
import javax.sip.InvalidArgumentException;
|
||||||
import javax.sip.RequestEvent;
|
import javax.sip.RequestEvent;
|
||||||
import javax.sip.SipException;
|
import javax.sip.SipException;
|
||||||
import javax.sip.message.Response;
|
import javax.sip.message.Response;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
import java.util.concurrent.BlockingQueue;
|
import java.util.Collections;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
|
||||||
|
|
||||||
import static com.genersoft.iot.vmp.gb28181.utils.XmlUtil.getText;
|
import static com.genersoft.iot.vmp.gb28181.utils.XmlUtil.getText;
|
||||||
|
|
||||||
@ -46,7 +45,6 @@ public class RecordInfoResponseMessageHandler extends SIPRequestProcessorParent
|
|||||||
|
|
||||||
private ConcurrentLinkedQueue<HandlerCatchData> taskQueue = new ConcurrentLinkedQueue<>();
|
private ConcurrentLinkedQueue<HandlerCatchData> taskQueue = new ConcurrentLinkedQueue<>();
|
||||||
|
|
||||||
private boolean taskQueueHandlerRun = false;
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ResponseMessageHandler responseMessageHandler;
|
private ResponseMessageHandler responseMessageHandler;
|
||||||
|
|
||||||
@ -70,6 +68,7 @@ public class RecordInfoResponseMessageHandler extends SIPRequestProcessorParent
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handForDevice(RequestEvent evt, Device device, Element rootElement) {
|
public void handForDevice(RequestEvent evt, Device device, Element rootElement) {
|
||||||
|
boolean isEmpty = taskQueue.isEmpty();
|
||||||
try {
|
try {
|
||||||
// 回复200 OK
|
// 回复200 OK
|
||||||
responseAck((SIPRequest) evt.getRequest(), Response.OK);
|
responseAck((SIPRequest) evt.getRequest(), Response.OK);
|
||||||
@ -77,8 +76,7 @@ public class RecordInfoResponseMessageHandler extends SIPRequestProcessorParent
|
|||||||
logger.error("[命令发送失败] 国标级联 国标录像: {}", e.getMessage());
|
logger.error("[命令发送失败] 国标级联 国标录像: {}", e.getMessage());
|
||||||
}
|
}
|
||||||
taskQueue.offer(new HandlerCatchData(evt, device, rootElement));
|
taskQueue.offer(new HandlerCatchData(evt, device, rootElement));
|
||||||
if (!taskQueueHandlerRun) {
|
if (isEmpty) {
|
||||||
taskQueueHandlerRun = true;
|
|
||||||
taskExecutor.execute(()->{
|
taskExecutor.execute(()->{
|
||||||
while (!taskQueue.isEmpty()) {
|
while (!taskQueue.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
@ -151,9 +149,10 @@ public class RecordInfoResponseMessageHandler extends SIPRequestProcessorParent
|
|||||||
}
|
}
|
||||||
} catch (DocumentException e) {
|
} catch (DocumentException e) {
|
||||||
logger.error("xml解析异常: ", e);
|
logger.error("xml解析异常: ", e);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.warn("[国标录像] 发现未处理的异常, {}\r\n{}",e.getMessage(), evt.getRequest());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
taskQueueHandlerRun = false;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
package com.genersoft.iot.vmp.gb28181.utils;
|
package com.genersoft.iot.vmp.gb28181.utils;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.gb28181.bean.RemoteAddressInfo;
|
||||||
import com.genersoft.iot.vmp.utils.GitUtil;
|
import com.genersoft.iot.vmp.utils.GitUtil;
|
||||||
import gov.nist.javax.sip.address.AddressImpl;
|
import gov.nist.javax.sip.address.AddressImpl;
|
||||||
import gov.nist.javax.sip.address.SipUri;
|
import gov.nist.javax.sip.address.SipUri;
|
||||||
import gov.nist.javax.sip.header.Subject;
|
import gov.nist.javax.sip.header.Subject;
|
||||||
|
import gov.nist.javax.sip.message.SIPRequest;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
import javax.sip.PeerUnavailableException;
|
import javax.sip.PeerUnavailableException;
|
||||||
@ -11,6 +13,7 @@ import javax.sip.SipFactory;
|
|||||||
import javax.sip.header.FromHeader;
|
import javax.sip.header.FromHeader;
|
||||||
import javax.sip.header.Header;
|
import javax.sip.header.Header;
|
||||||
import javax.sip.header.UserAgentHeader;
|
import javax.sip.header.UserAgentHeader;
|
||||||
|
import javax.sip.header.ViaHeader;
|
||||||
import javax.sip.message.Request;
|
import javax.sip.message.Request;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -119,4 +122,32 @@ public class SipUtils {
|
|||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从请求中获取设备ip地址和端口号
|
||||||
|
* @param request 请求
|
||||||
|
* @param sipUseSourceIpAsRemoteAddress false 从via中获取地址, true 直接获取远程地址
|
||||||
|
* @return 地址信息
|
||||||
|
*/
|
||||||
|
public static RemoteAddressInfo getRemoteAddressFromRequest(SIPRequest request, boolean sipUseSourceIpAsRemoteAddress) {
|
||||||
|
|
||||||
|
String remoteAddress;
|
||||||
|
int remotePort;
|
||||||
|
if (sipUseSourceIpAsRemoteAddress) {
|
||||||
|
remoteAddress = request.getRemoteAddress().getHostAddress();
|
||||||
|
remotePort = request.getRemotePort();
|
||||||
|
}else {
|
||||||
|
// 判断RPort是否改变,改变则说明路由nat信息变化,修改设备信息
|
||||||
|
// 获取到通信地址等信息
|
||||||
|
ViaHeader viaHeader = (ViaHeader) request.getHeader(ViaHeader.NAME);
|
||||||
|
remoteAddress = viaHeader.getReceived();
|
||||||
|
remotePort = viaHeader.getRPort();
|
||||||
|
// 解析本地地址替代
|
||||||
|
if (ObjectUtils.isEmpty(remoteAddress) || remotePort == -1) {
|
||||||
|
remoteAddress = viaHeader.getHost();
|
||||||
|
remotePort = viaHeader.getPort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new RemoteAddressInfo(remoteAddress, remotePort);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.hook.*;
|
|||||||
import com.genersoft.iot.vmp.service.*;
|
import com.genersoft.iot.vmp.service.*;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||||
|
import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -347,7 +348,7 @@ public class ZLMHttpHookListener {
|
|||||||
}
|
}
|
||||||
StreamInfo streamInfoByAppAndStream = mediaService.getStreamInfoByAppAndStream(mediaServerItem,
|
StreamInfo streamInfoByAppAndStream = mediaService.getStreamInfoByAppAndStream(mediaServerItem,
|
||||||
param.getApp(), param.getStream(), tracks, callId);
|
param.getApp(), param.getStream(), tracks, callId);
|
||||||
param.setStreamInfo(streamInfoByAppAndStream);
|
param.setStreamInfo(new StreamContent(streamInfoByAppAndStream));
|
||||||
redisCatchStorage.addStream(mediaServerItem, type, param.getApp(), param.getStream(), param);
|
redisCatchStorage.addStream(mediaServerItem, type, param.getApp(), param.getStream(), param);
|
||||||
if (param.getOriginType() == OriginType.RTSP_PUSH.ordinal()
|
if (param.getOriginType() == OriginType.RTSP_PUSH.ordinal()
|
||||||
|| param.getOriginType() == OriginType.RTMP_PUSH.ordinal()
|
|| param.getOriginType() == OriginType.RTMP_PUSH.ordinal()
|
||||||
@ -364,7 +365,7 @@ public class ZLMHttpHookListener {
|
|||||||
}
|
}
|
||||||
GbStream gbStream = storager.getGbStream(param.getApp(), param.getStream());
|
GbStream gbStream = storager.getGbStream(param.getApp(), param.getStream());
|
||||||
if (gbStream != null) {
|
if (gbStream != null) {
|
||||||
// eventPublisher.catalogEventPublishForStream(null, gbStream, CatalogEvent.OFF);
|
// eventPublisher.catalogEventPublishForStream(null, gbStream, CatalogEvent.OFF);
|
||||||
}
|
}
|
||||||
zlmMediaListManager.removeMedia(param.getApp(), param.getStream());
|
zlmMediaListManager.removeMedia(param.getApp(), param.getStream());
|
||||||
}
|
}
|
||||||
@ -505,6 +506,7 @@ public class ZLMHttpHookListener {
|
|||||||
// 修改数据
|
// 修改数据
|
||||||
streamProxyService.stop(param.getApp(), param.getStream());
|
streamProxyService.stop(param.getApp(), param.getStream());
|
||||||
}else {
|
}else {
|
||||||
|
// 无人观看不做处理
|
||||||
ret.put("close", false);
|
ret.put("close", false);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@ -526,7 +528,7 @@ public class ZLMHttpHookListener {
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
@PostMapping(value = "/on_stream_not_found", produces = "application/json;charset=UTF-8")
|
@PostMapping(value = "/on_stream_not_found", produces = "application/json;charset=UTF-8")
|
||||||
public JSONObject onStreamNotFound(@RequestBody OnStreamNotFoundHookParam param){
|
public JSONObject onStreamNotFound(@RequestBody OnStreamNotFoundHookParam param){
|
||||||
logger.info("[ZLM HOOK] 流未找到:{}->{}->{}/{}" + param.getMediaServerId(), param.getSchema(), param.getApp(), param.getStream());
|
logger.info("[ZLM HOOK] 流未找到:{}->{}->{}/{}", param.getMediaServerId(), param.getSchema(), param.getApp(), param.getStream());
|
||||||
taskExecutor.execute(()->{
|
taskExecutor.execute(()->{
|
||||||
MediaServerItem mediaInfo = mediaServerService.getOne(param.getMediaServerId());
|
MediaServerItem mediaInfo = mediaServerService.getOne(param.getMediaServerId());
|
||||||
if (userSetting.isAutoApplyPlay() && mediaInfo != null) {
|
if (userSetting.isAutoApplyPlay() && mediaInfo != null) {
|
||||||
|
|||||||
@ -23,27 +23,34 @@ public class ZLMRESTfulUtils {
|
|||||||
|
|
||||||
private final static Logger logger = LoggerFactory.getLogger(ZLMRESTfulUtils.class);
|
private final static Logger logger = LoggerFactory.getLogger(ZLMRESTfulUtils.class);
|
||||||
|
|
||||||
|
private OkHttpClient client;
|
||||||
|
|
||||||
|
|
||||||
public interface RequestCallback{
|
public interface RequestCallback{
|
||||||
void run(JSONObject response);
|
void run(JSONObject response);
|
||||||
}
|
}
|
||||||
|
|
||||||
private OkHttpClient getClient(){
|
private OkHttpClient getClient(){
|
||||||
OkHttpClient.Builder httpClientBuilder = new OkHttpClient.Builder();
|
if (client == null) {
|
||||||
//todo 暂时写死超时时间 均为5s
|
OkHttpClient.Builder httpClientBuilder = new OkHttpClient.Builder();
|
||||||
httpClientBuilder.connectTimeout(5,TimeUnit.SECONDS); //设置连接超时时间
|
//todo 暂时写死超时时间 均为5s
|
||||||
httpClientBuilder.readTimeout(5,TimeUnit.SECONDS); //设置读取超时时间
|
// 设置连接超时时间
|
||||||
if (logger.isDebugEnabled()) {
|
httpClientBuilder.connectTimeout(5,TimeUnit.SECONDS);
|
||||||
HttpLoggingInterceptor logging = new HttpLoggingInterceptor(message -> {
|
// 设置读取超时时间
|
||||||
logger.debug("http请求参数:" + message);
|
httpClientBuilder.readTimeout(5,TimeUnit.SECONDS);
|
||||||
});
|
// 设置连接池
|
||||||
logging.setLevel(HttpLoggingInterceptor.Level.BASIC);
|
httpClientBuilder.connectionPool(new ConnectionPool(16, 5, TimeUnit.MINUTES));
|
||||||
// OkHttp進行添加攔截器loggingInterceptor
|
if (logger.isDebugEnabled()) {
|
||||||
httpClientBuilder.addInterceptor(logging);
|
HttpLoggingInterceptor logging = new HttpLoggingInterceptor(message -> {
|
||||||
|
logger.debug("http请求参数:" + message);
|
||||||
|
});
|
||||||
|
logging.setLevel(HttpLoggingInterceptor.Level.BASIC);
|
||||||
|
// OkHttp進行添加攔截器loggingInterceptor
|
||||||
|
httpClientBuilder.addInterceptor(logging);
|
||||||
|
}
|
||||||
|
client = httpClientBuilder.build();
|
||||||
}
|
}
|
||||||
return httpClientBuilder.build();
|
return client;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -164,9 +171,7 @@ public class ZLMRESTfulUtils {
|
|||||||
.build();
|
.build();
|
||||||
logger.info(request.toString());
|
logger.info(request.toString());
|
||||||
try {
|
try {
|
||||||
OkHttpClient client = new OkHttpClient.Builder()
|
OkHttpClient client = getClient();
|
||||||
.readTimeout(10, TimeUnit.SECONDS)
|
|
||||||
.build();
|
|
||||||
Response response = client.newCall(request).execute();
|
Response response = client.newCall(request).execute();
|
||||||
if (response.isSuccessful()) {
|
if (response.isSuccessful()) {
|
||||||
if (targetPath != null) {
|
if (targetPath != null) {
|
||||||
@ -236,14 +241,13 @@ public class ZLMRESTfulUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject addFFmpegSource(MediaServerItem mediaServerItem, String src_url, String dst_url, String timeout_ms,
|
public JSONObject addFFmpegSource(MediaServerItem mediaServerItem, String src_url, String dst_url, String timeout_ms,
|
||||||
boolean enable_hls, boolean enable_mp4, String ffmpeg_cmd_key){
|
boolean enable_audio, boolean enable_mp4, String ffmpeg_cmd_key){
|
||||||
logger.info(src_url);
|
logger.info(src_url);
|
||||||
logger.info(dst_url);
|
logger.info(dst_url);
|
||||||
Map<String, Object> param = new HashMap<>();
|
Map<String, Object> param = new HashMap<>();
|
||||||
param.put("src_url", src_url);
|
param.put("src_url", src_url);
|
||||||
param.put("dst_url", dst_url);
|
param.put("dst_url", dst_url);
|
||||||
param.put("timeout_ms", timeout_ms);
|
param.put("timeout_ms", timeout_ms);
|
||||||
param.put("enable_hls", enable_hls);
|
|
||||||
param.put("enable_mp4", enable_mp4);
|
param.put("enable_mp4", enable_mp4);
|
||||||
param.put("ffmpeg_cmd_key", ffmpeg_cmd_key);
|
param.put("ffmpeg_cmd_key", ffmpeg_cmd_key);
|
||||||
return sendPost(mediaServerItem, "addFFmpegSource",param, null);
|
return sendPost(mediaServerItem, "addFFmpegSource",param, null);
|
||||||
@ -287,19 +291,14 @@ public class ZLMRESTfulUtils {
|
|||||||
return sendPost(mediaServerItem, "restartServer",null, null);
|
return sendPost(mediaServerItem, "restartServer",null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject addStreamProxy(MediaServerItem mediaServerItem, String app, String stream, String url, boolean enable_hls, boolean enable_mp4, String rtp_type) {
|
public JSONObject addStreamProxy(MediaServerItem mediaServerItem, String app, String stream, String url, boolean enable_audio, boolean enable_mp4, String rtp_type) {
|
||||||
Map<String, Object> param = new HashMap<>();
|
Map<String, Object> param = new HashMap<>();
|
||||||
param.put("vhost", "__defaultVhost__");
|
param.put("vhost", "__defaultVhost__");
|
||||||
param.put("app", app);
|
param.put("app", app);
|
||||||
param.put("stream", stream);
|
param.put("stream", stream);
|
||||||
param.put("url", url);
|
param.put("url", url);
|
||||||
param.put("enable_hls", enable_hls?1:0);
|
|
||||||
param.put("enable_mp4", enable_mp4?1:0);
|
param.put("enable_mp4", enable_mp4?1:0);
|
||||||
param.put("enable_rtmp", 1);
|
param.put("enable_audio", enable_audio?1:0);
|
||||||
param.put("enable_fmp4", 1);
|
|
||||||
param.put("enable_audio", 1);
|
|
||||||
param.put("enable_rtsp", 1);
|
|
||||||
param.put("add_mute_audio", 1);
|
|
||||||
param.put("rtp_type", rtp_type);
|
param.put("rtp_type", rtp_type);
|
||||||
return sendPost(mediaServerItem, "addStreamProxy",param, null);
|
return sendPost(mediaServerItem, "addStreamProxy",param, null);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -175,7 +175,7 @@ public class ZLMRTPServerFactory {
|
|||||||
* @param tcp 是否为tcp
|
* @param tcp 是否为tcp
|
||||||
* @return SendRtpItem
|
* @return SendRtpItem
|
||||||
*/
|
*/
|
||||||
public SendRtpItem createSendRtpItem(MediaServerItem serverItem, String ip, int port, String ssrc, String platformId, String deviceId, String channelId, boolean tcp){
|
public SendRtpItem createSendRtpItem(MediaServerItem serverItem, String ip, int port, String ssrc, String platformId, String deviceId, String channelId, boolean tcp, boolean rtcp){
|
||||||
|
|
||||||
// 默认为随机端口
|
// 默认为随机端口
|
||||||
int localPort = 0;
|
int localPort = 0;
|
||||||
@ -195,6 +195,7 @@ public class ZLMRTPServerFactory {
|
|||||||
sendRtpItem.setDeviceId(deviceId);
|
sendRtpItem.setDeviceId(deviceId);
|
||||||
sendRtpItem.setChannelId(channelId);
|
sendRtpItem.setChannelId(channelId);
|
||||||
sendRtpItem.setTcp(tcp);
|
sendRtpItem.setTcp(tcp);
|
||||||
|
sendRtpItem.setRtcp(rtcp);
|
||||||
sendRtpItem.setApp("rtp");
|
sendRtpItem.setApp("rtp");
|
||||||
sendRtpItem.setLocalPort(localPort);
|
sendRtpItem.setLocalPort(localPort);
|
||||||
sendRtpItem.setServerId(userSetting.getServerId());
|
sendRtpItem.setServerId(userSetting.getServerId());
|
||||||
@ -212,7 +213,7 @@ public class ZLMRTPServerFactory {
|
|||||||
* @param tcp 是否为tcp
|
* @param tcp 是否为tcp
|
||||||
* @return SendRtpItem
|
* @return SendRtpItem
|
||||||
*/
|
*/
|
||||||
public SendRtpItem createSendRtpItem(MediaServerItem serverItem, String ip, int port, String ssrc, String platformId, String app, String stream, String channelId, boolean tcp){
|
public SendRtpItem createSendRtpItem(MediaServerItem serverItem, String ip, int port, String ssrc, String platformId, String app, String stream, String channelId, boolean tcp, boolean rtcp){
|
||||||
// 默认为随机端口
|
// 默认为随机端口
|
||||||
int localPort = 0;
|
int localPort = 0;
|
||||||
if (userSetting.getGbSendStreamStrict()) {
|
if (userSetting.getGbSendStreamStrict()) {
|
||||||
@ -233,6 +234,7 @@ public class ZLMRTPServerFactory {
|
|||||||
sendRtpItem.setLocalPort(localPort);
|
sendRtpItem.setLocalPort(localPort);
|
||||||
sendRtpItem.setServerId(userSetting.getServerId());
|
sendRtpItem.setServerId(userSetting.getServerId());
|
||||||
sendRtpItem.setMediaServerId(serverItem.getId());
|
sendRtpItem.setMediaServerId(serverItem.getId());
|
||||||
|
sendRtpItem.setRtcp(rtcp);
|
||||||
return sendRtpItem;
|
return sendRtpItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,8 +31,8 @@ public class StreamProxyItem extends GbStream {
|
|||||||
private String rtp_type;
|
private String rtp_type;
|
||||||
@Schema(description = "是否启用")
|
@Schema(description = "是否启用")
|
||||||
private boolean enable;
|
private boolean enable;
|
||||||
@Schema(description = "是否启用HLS")
|
@Schema(description = "是否启用音频")
|
||||||
private boolean enable_hls;
|
private boolean enable_audio;
|
||||||
@Schema(description = "是否启用MP4")
|
@Schema(description = "是否启用MP4")
|
||||||
private boolean enable_mp4;
|
private boolean enable_mp4;
|
||||||
@Schema(description = "是否 无人观看时删除")
|
@Schema(description = "是否 无人观看时删除")
|
||||||
@ -40,8 +40,6 @@ public class StreamProxyItem extends GbStream {
|
|||||||
|
|
||||||
@Schema(description = "是否 无人观看时自动停用")
|
@Schema(description = "是否 无人观看时自动停用")
|
||||||
private boolean enable_disable_none_reader;
|
private boolean enable_disable_none_reader;
|
||||||
@Schema(description = "上级平台国标ID")
|
|
||||||
private String platformGbId;
|
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间")
|
||||||
private String createTime;
|
private String createTime;
|
||||||
|
|
||||||
@ -139,14 +137,6 @@ public class StreamProxyItem extends GbStream {
|
|||||||
this.enable = enable;
|
this.enable = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEnable_hls() {
|
|
||||||
return enable_hls;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEnable_hls(boolean enable_hls) {
|
|
||||||
this.enable_hls = enable_hls;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isEnable_mp4() {
|
public boolean isEnable_mp4() {
|
||||||
return enable_mp4;
|
return enable_mp4;
|
||||||
}
|
}
|
||||||
@ -155,19 +145,12 @@ public class StreamProxyItem extends GbStream {
|
|||||||
this.enable_mp4 = enable_mp4;
|
this.enable_mp4 = enable_mp4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getPlatformGbId() {
|
|
||||||
return platformGbId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPlatformGbId(String platformGbId) {
|
|
||||||
this.platformGbId = platformGbId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCreateTime() {
|
public String getCreateTime() {
|
||||||
return createTime;
|
return createTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setCreateTime(String createTime) {
|
public void setCreateTime(String createTime) {
|
||||||
this.createTime = createTime;
|
this.createTime = createTime;
|
||||||
}
|
}
|
||||||
@ -187,4 +170,12 @@ public class StreamProxyItem extends GbStream {
|
|||||||
public void setEnable_disable_none_reader(boolean enable_disable_none_reader) {
|
public void setEnable_disable_none_reader(boolean enable_disable_none_reader) {
|
||||||
this.enable_disable_none_reader = enable_disable_none_reader;
|
this.enable_disable_none_reader = enable_disable_none_reader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isEnable_audio() {
|
||||||
|
return enable_audio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnable_audio(boolean enable_audio) {
|
||||||
|
this.enable_audio = enable_audio;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
package com.genersoft.iot.vmp.media.zlm.dto.hook;
|
package com.genersoft.iot.vmp.media.zlm.dto.hook;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -291,7 +291,7 @@ public class OnStreamChangedHookParam extends HookParam{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private StreamInfo streamInfo;
|
private StreamContent streamInfo;
|
||||||
|
|
||||||
public String getApp() {
|
public String getApp() {
|
||||||
return app;
|
return app;
|
||||||
@ -407,11 +407,11 @@ public class OnStreamChangedHookParam extends HookParam{
|
|||||||
this.docker = docker;
|
this.docker = docker;
|
||||||
}
|
}
|
||||||
|
|
||||||
public StreamInfo getStreamInfo() {
|
public StreamContent getStreamInfo() {
|
||||||
return streamInfo;
|
return streamInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStreamInfo(StreamInfo streamInfo) {
|
public void setStreamInfo(StreamContent streamInfo) {
|
||||||
this.streamInfo = streamInfo;
|
this.streamInfo = streamInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.service;
|
|||||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
|
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
|
||||||
|
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -38,4 +39,11 @@ public interface IDeviceChannelService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ResourceBaceInfo getOverview();
|
ResourceBaceInfo getOverview();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有未分配的通道
|
||||||
|
* @param platformId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ChannelReduce> queryAllChannelList(String platformId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,4 +55,18 @@ public interface IGbStreamService {
|
|||||||
int updateGbIdOrName(List<StreamPushItem> streamPushItemForUpdate);
|
int updateGbIdOrName(List<StreamPushItem> streamPushItemForUpdate);
|
||||||
|
|
||||||
DeviceChannel getDeviceChannelListByStreamWithStatus(GbStream gbStream, String catalogId, ParentPlatform platform);
|
DeviceChannel getDeviceChannelListByStreamWithStatus(GbStream gbStream, String catalogId, ParentPlatform platform);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有未分配的通道
|
||||||
|
* @param platformId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<GbStream> getAllGBChannels(String platformId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移除所有关联的通道
|
||||||
|
* @param platformId
|
||||||
|
* @param catalogId
|
||||||
|
*/
|
||||||
|
void delAllPlatformInfo(String platformId, String catalogId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,4 +19,11 @@ public interface IPlatformChannelService {
|
|||||||
*/
|
*/
|
||||||
int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces, String catalogId);
|
int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces, String catalogId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移除目录下的所有通道
|
||||||
|
* @param platformId
|
||||||
|
* @param catalogId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int delAllChannelForGB(String platformId, String catalogId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,10 +63,16 @@ public class RequestSendItemMsg {
|
|||||||
private Boolean isTcp;
|
private Boolean isTcp;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否使用TCP
|
||||||
|
*/
|
||||||
|
private Boolean rtcp;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static RequestSendItemMsg getInstance(String serverId, String mediaServerId, String app, String stream, String ip, int port,
|
public static RequestSendItemMsg getInstance(String serverId, String mediaServerId, String app, String stream, String ip, int port,
|
||||||
String ssrc, String platformId, String channelId, Boolean isTcp, String platformName) {
|
String ssrc, String platformId, String channelId, Boolean isTcp, Boolean rtcp, String platformName) {
|
||||||
RequestSendItemMsg requestSendItemMsg = new RequestSendItemMsg();
|
RequestSendItemMsg requestSendItemMsg = new RequestSendItemMsg();
|
||||||
requestSendItemMsg.setServerId(serverId);
|
requestSendItemMsg.setServerId(serverId);
|
||||||
requestSendItemMsg.setMediaServerId(mediaServerId);
|
requestSendItemMsg.setMediaServerId(mediaServerId);
|
||||||
@ -79,6 +85,7 @@ public class RequestSendItemMsg {
|
|||||||
requestSendItemMsg.setPlatformName(platformName);
|
requestSendItemMsg.setPlatformName(platformName);
|
||||||
requestSendItemMsg.setChannelId(channelId);
|
requestSendItemMsg.setChannelId(channelId);
|
||||||
requestSendItemMsg.setTcp(isTcp);
|
requestSendItemMsg.setTcp(isTcp);
|
||||||
|
requestSendItemMsg.setRtcp(rtcp);
|
||||||
|
|
||||||
return requestSendItemMsg;
|
return requestSendItemMsg;
|
||||||
}
|
}
|
||||||
@ -170,4 +177,12 @@ public class RequestSendItemMsg {
|
|||||||
public void setTcp(Boolean tcp) {
|
public void setTcp(Boolean tcp) {
|
||||||
isTcp = tcp;
|
isTcp = tcp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getRtcp() {
|
||||||
|
return rtcp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRtcp(Boolean rtcp) {
|
||||||
|
this.rtcp = rtcp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
|
|||||||
import com.genersoft.iot.vmp.storager.dao.DeviceMapper;
|
import com.genersoft.iot.vmp.storager.dao.DeviceMapper;
|
||||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
|
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
|
||||||
|
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -168,4 +169,12 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
|||||||
public ResourceBaceInfo getOverview() {
|
public ResourceBaceInfo getOverview() {
|
||||||
return channelMapper.getOverview();
|
return channelMapper.getOverview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ChannelReduce> queryAllChannelList(String platformId) {
|
||||||
|
return channelMapper.queryChannelListInAll(null, null, null, platformId, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.genersoft.iot.vmp.service.impl;
|
package com.genersoft.iot.vmp.service.impl;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.conf.DynamicTask;
|
import com.genersoft.iot.vmp.conf.DynamicTask;
|
||||||
|
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||||
import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
|
import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
|
||||||
import com.genersoft.iot.vmp.gb28181.task.ISubscribeTask;
|
import com.genersoft.iot.vmp.gb28181.task.ISubscribeTask;
|
||||||
@ -12,7 +13,6 @@ import com.genersoft.iot.vmp.service.IDeviceChannelService;
|
|||||||
import com.genersoft.iot.vmp.service.IDeviceService;
|
import com.genersoft.iot.vmp.service.IDeviceService;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.service.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
|
||||||
import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
|
import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
|
||||||
import com.genersoft.iot.vmp.storager.dao.DeviceMapper;
|
import com.genersoft.iot.vmp.storager.dao.DeviceMapper;
|
||||||
import com.genersoft.iot.vmp.storager.dao.PlatformChannelMapper;
|
import com.genersoft.iot.vmp.storager.dao.PlatformChannelMapper;
|
||||||
@ -78,7 +78,7 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
TransactionDefinition transactionDefinition;
|
TransactionDefinition transactionDefinition;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IVideoManagerStorage storage;
|
private UserSetting userSetting;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISIPCommander commander;
|
private ISIPCommander commander;
|
||||||
@ -120,16 +120,18 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
if(device.getOnline() == 0){
|
if(device.getOnline() == 0){
|
||||||
device.setOnline(1);
|
device.setOnline(1);
|
||||||
device.setCreateTime(now);
|
device.setCreateTime(now);
|
||||||
logger.info("[设备上线,离线状态下重新注册]: {},查询设备信息以及通道信息", device.getDeviceId());
|
|
||||||
deviceMapper.update(device);
|
deviceMapper.update(device);
|
||||||
redisCatchStorage.updateDevice(device);
|
redisCatchStorage.updateDevice(device);
|
||||||
try {
|
if (userSetting.getSyncChannelOnDeviceOnline()) {
|
||||||
commander.deviceInfoQuery(device);
|
logger.info("[设备上线,离线状态下重新注册]: {},查询设备信息以及通道信息", device.getDeviceId());
|
||||||
} catch (InvalidArgumentException | SipException | ParseException e) {
|
try {
|
||||||
logger.error("[命令发送失败] 查询设备信息: {}", e.getMessage());
|
commander.deviceInfoQuery(device);
|
||||||
|
} catch (InvalidArgumentException | SipException | ParseException e) {
|
||||||
|
logger.error("[命令发送失败] 查询设备信息: {}", e.getMessage());
|
||||||
|
}
|
||||||
|
sync(device);
|
||||||
|
// TODO 如果设备下的通道级联到了其他平台,那么需要发送事件或者notify给上级平台
|
||||||
}
|
}
|
||||||
sync(device);
|
|
||||||
// TODO 如果设备下的通道级联到了其他平台,那么需要发送事件或者notify给上级平台
|
|
||||||
}else {
|
}else {
|
||||||
if (deviceChannelMapper.queryAllChannels(device.getDeviceId()).size() == 0) {
|
if (deviceChannelMapper.queryAllChannels(device.getDeviceId()).size() == 0) {
|
||||||
logger.info("[设备上线]: {},通道数为0,查询通道信息", device.getDeviceId());
|
logger.info("[设备上线]: {},通道数为0,查询通道信息", device.getDeviceId());
|
||||||
@ -330,7 +332,6 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
device.setUpdateTime(DateUtil.getNow());
|
device.setUpdateTime(DateUtil.getNow());
|
||||||
if (deviceMapper.update(device) > 0) {
|
if (deviceMapper.update(device) > 0) {
|
||||||
redisCatchStorage.updateDevice(device);
|
redisCatchStorage.updateDevice(device);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,11 +4,11 @@ import com.genersoft.iot.vmp.gb28181.bean.*;
|
|||||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||||
|
import com.genersoft.iot.vmp.service.IGbStreamService;
|
||||||
import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
|
import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
|
||||||
import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper;
|
import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper;
|
||||||
import com.genersoft.iot.vmp.storager.dao.PlatformCatalogMapper;
|
import com.genersoft.iot.vmp.storager.dao.PlatformCatalogMapper;
|
||||||
import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper;
|
import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper;
|
||||||
import com.genersoft.iot.vmp.service.IGbStreamService;
|
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -19,7 +19,6 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.TransactionDefinition;
|
import org.springframework.transaction.TransactionDefinition;
|
||||||
import org.springframework.transaction.TransactionStatus;
|
import org.springframework.transaction.TransactionStatus;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -230,4 +229,35 @@ public class GbStreamServiceImpl implements IGbStreamService {
|
|||||||
deviceChannel.setSecrecy("0");
|
deviceChannel.setSecrecy("0");
|
||||||
return deviceChannel;
|
return deviceChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GbStream> getAllGBChannels(String platformId) {
|
||||||
|
|
||||||
|
return gbStreamMapper.selectAll(platformId, null, null, null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delAllPlatformInfo(String platformId, String catalogId) {
|
||||||
|
if (platformId == null) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
ParentPlatform platform = platformMapper.getParentPlatByServerGBId(platformId);
|
||||||
|
if (platform == null) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
if (ObjectUtils.isEmpty(catalogId)) {
|
||||||
|
catalogId = platform.getDeviceGBId();
|
||||||
|
}
|
||||||
|
if (platformGbStreamMapper.delByPlatformAndCatalogId(platformId, catalogId) > 0) {
|
||||||
|
List<GbStream> gbStreams = platformGbStreamMapper.queryChannelInParentPlatformAndCatalog(platformId, catalogId);
|
||||||
|
List<DeviceChannel> deviceChannelList = new ArrayList<>();
|
||||||
|
for (GbStream gbStream : gbStreams) {
|
||||||
|
DeviceChannel deviceChannel = new DeviceChannel();
|
||||||
|
deviceChannel.setChannelId(gbStream.getGbId());
|
||||||
|
deviceChannelList.add(deviceChannel);
|
||||||
|
}
|
||||||
|
eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -169,7 +169,6 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
zlmrtpServerFactory.closeRtpServer(mediaServerItem, streamId);
|
zlmrtpServerFactory.closeRtpServer(mediaServerItem, streamId);
|
||||||
releaseSsrc(mediaServerItem.getId(), streamId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -105,4 +106,26 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
|
|||||||
}
|
}
|
||||||
return deviceChannelList;
|
return deviceChannelList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int delAllChannelForGB(String platformId, String catalogId) {
|
||||||
|
|
||||||
|
int result;
|
||||||
|
if (platformId == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
ParentPlatform platform = platformMapper.getParentPlatByServerGBId(platformId);
|
||||||
|
if (platform == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (ObjectUtils.isEmpty(catalogId)) {
|
||||||
|
catalogId = platform.getDeviceGBId();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((result = platformChannelMapper.delChannelForGBByCatalogId(platformId, catalogId)) > 0) {
|
||||||
|
List<DeviceChannel> deviceChannels = platformChannelMapper.queryAllChannelInCatalog(platformId, catalogId);
|
||||||
|
eventPublisher.catalogEventPublish(platformId, deviceChannels, CatalogEvent.DEL);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -271,7 +271,7 @@ public class PlayServiceImpl implements IPlayService {
|
|||||||
onPublishHandlerForPlay(mediaServerItemInuse, response, device.getDeviceId(), channelId);
|
onPublishHandlerForPlay(mediaServerItemInuse, response, device.getDeviceId(), channelId);
|
||||||
hookEvent.response(mediaServerItemInuse, response);
|
hookEvent.response(mediaServerItemInuse, response);
|
||||||
logger.info("[点播成功] deviceId: {}, channelId: {}", device.getDeviceId(), channelId);
|
logger.info("[点播成功] deviceId: {}, channelId: {}", device.getDeviceId(), channelId);
|
||||||
String streamUrl = String.format("rtsp://127.0.0.1:%s/%s/%s", mediaServerItemInuse.getRtspPort(), "rtp", ssrcInfo.getStream());
|
String streamUrl = String.format("http://127.0.0.1:%s/%s/%s.live.flv", mediaServerItemInuse.getHttpPort(), "rtp", ssrcInfo.getStream());
|
||||||
String path = "snap";
|
String path = "snap";
|
||||||
String fileName = device.getDeviceId() + "_" + channelId + ".jpg";
|
String fileName = device.getDeviceId() + "_" + channelId + ".jpg";
|
||||||
// 请求截图
|
// 请求截图
|
||||||
|
|||||||
@ -5,23 +5,22 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
||||||
|
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
||||||
import com.genersoft.iot.vmp.service.IGbStreamService;
|
import com.genersoft.iot.vmp.service.IGbStreamService;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.service.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.IMediaService;
|
import com.genersoft.iot.vmp.service.IMediaService;
|
||||||
|
import com.genersoft.iot.vmp.service.IStreamProxyService;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||||
import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
|
import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
|
||||||
import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper;
|
import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper;
|
||||||
import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper;
|
import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper;
|
||||||
import com.genersoft.iot.vmp.storager.dao.StreamProxyMapper;
|
import com.genersoft.iot.vmp.storager.dao.StreamProxyMapper;
|
||||||
import com.genersoft.iot.vmp.service.IStreamProxyService;
|
|
||||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
|
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
|
||||||
@ -35,7 +34,9 @@ import org.springframework.transaction.TransactionDefinition;
|
|||||||
import org.springframework.transaction.TransactionStatus;
|
import org.springframework.transaction.TransactionStatus;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 视频代理业务
|
* 视频代理业务
|
||||||
@ -107,7 +108,6 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
|||||||
param.getStream() );
|
param.getStream() );
|
||||||
param.setDst_url(dstUrl);
|
param.setDst_url(dstUrl);
|
||||||
StringBuffer resultMsg = new StringBuffer();
|
StringBuffer resultMsg = new StringBuffer();
|
||||||
boolean streamLive = false;
|
|
||||||
param.setMediaServerId(mediaInfo.getId());
|
param.setMediaServerId(mediaInfo.getId());
|
||||||
boolean saveResult;
|
boolean saveResult;
|
||||||
// 更新
|
// 更新
|
||||||
@ -124,7 +124,6 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
|||||||
if (param.isEnable()) {
|
if (param.isEnable()) {
|
||||||
JSONObject jsonObject = addStreamProxyToZlm(param);
|
JSONObject jsonObject = addStreamProxyToZlm(param);
|
||||||
if (jsonObject == null || jsonObject.getInteger("code") != 0) {
|
if (jsonObject == null || jsonObject.getInteger("code") != 0) {
|
||||||
streamLive = false;
|
|
||||||
resultMsg.append(", 但是启用失败,请检查流地址是否可用");
|
resultMsg.append(", 但是启用失败,请检查流地址是否可用");
|
||||||
param.setEnable(false);
|
param.setEnable(false);
|
||||||
// 直接移除
|
// 直接移除
|
||||||
@ -134,28 +133,12 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
|||||||
updateStreamProxy(param);
|
updateStreamProxy(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
streamLive = true;
|
|
||||||
resultForStreamInfo = mediaService.getStreamInfoByAppAndStream(
|
resultForStreamInfo = mediaService.getStreamInfoByAppAndStream(
|
||||||
mediaInfo, param.getApp(), param.getStream(), null, null);
|
mediaInfo, param.getApp(), param.getStream(), null, null);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( !ObjectUtils.isEmpty(param.getPlatformGbId()) && streamLive) {
|
|
||||||
List<GbStream> gbStreams = new ArrayList<>();
|
|
||||||
gbStreams.add(param);
|
|
||||||
if (gbStreamService.addPlatformInfo(gbStreams, param.getPlatformGbId(), param.getCatalogId())){
|
|
||||||
return resultForStreamInfo;
|
|
||||||
}else {
|
|
||||||
resultMsg.append(", 关联国标平台[ " + param.getPlatformGbId() + " ]失败");
|
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), resultMsg.toString());
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
if (!streamLive) {
|
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), resultMsg.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return resultForStreamInfo;
|
return resultForStreamInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,10 +228,10 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
|||||||
}
|
}
|
||||||
if ("default".equals(param.getType())){
|
if ("default".equals(param.getType())){
|
||||||
result = zlmresTfulUtils.addStreamProxy(mediaServerItem, param.getApp(), param.getStream(), param.getUrl(),
|
result = zlmresTfulUtils.addStreamProxy(mediaServerItem, param.getApp(), param.getStream(), param.getUrl(),
|
||||||
param.isEnable_hls(), param.isEnable_mp4(), param.getRtp_type());
|
param.isEnable_audio(), param.isEnable_mp4(), param.getRtp_type());
|
||||||
}else if ("ffmpeg".equals(param.getType())) {
|
}else if ("ffmpeg".equals(param.getType())) {
|
||||||
result = zlmresTfulUtils.addFFmpegSource(mediaServerItem, param.getSrc_url(), param.getDst_url(),
|
result = zlmresTfulUtils.addFFmpegSource(mediaServerItem, param.getSrc_url(), param.getDst_url(),
|
||||||
param.getTimeout_ms() + "", param.isEnable_hls(), param.isEnable_mp4(),
|
param.getTimeout_ms() + "", param.isEnable_audio(), param.isEnable_mp4(),
|
||||||
param.getFfmpeg_cmd_key());
|
param.getFfmpeg_cmd_key());
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -301,6 +284,9 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
|||||||
result = true;
|
result = true;
|
||||||
streamProxy.setEnable(true);
|
streamProxy.setEnable(true);
|
||||||
updateStreamProxy(streamProxy);
|
updateStreamProxy(streamProxy);
|
||||||
|
}else {
|
||||||
|
logger.info("启用代理失败: {}/{}->{}({})", app, stream, jsonObject.getString("msg"),
|
||||||
|
streamProxy.getSrc_url() == null? streamProxy.getUrl():streamProxy.getSrc_url());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@ -38,8 +38,6 @@ public class RedisAlarmMsgListener implements MessageListener {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IVideoManagerStorage storage;
|
private IVideoManagerStorage storage;
|
||||||
|
|
||||||
private boolean taskQueueHandlerRun = false;
|
|
||||||
|
|
||||||
private ConcurrentLinkedQueue<Message> taskQueue = new ConcurrentLinkedQueue<>();
|
private ConcurrentLinkedQueue<Message> taskQueue = new ConcurrentLinkedQueue<>();
|
||||||
|
|
||||||
@Qualifier("taskExecutor")
|
@Qualifier("taskExecutor")
|
||||||
@ -49,69 +47,68 @@ public class RedisAlarmMsgListener implements MessageListener {
|
|||||||
@Override
|
@Override
|
||||||
public void onMessage(@NotNull Message message, byte[] bytes) {
|
public void onMessage(@NotNull Message message, byte[] bytes) {
|
||||||
logger.info("收到来自REDIS的ALARM通知: {}", new String(message.getBody()));
|
logger.info("收到来自REDIS的ALARM通知: {}", new String(message.getBody()));
|
||||||
|
boolean isEmpty = taskQueue.isEmpty();
|
||||||
taskQueue.offer(message);
|
taskQueue.offer(message);
|
||||||
if (!taskQueueHandlerRun) {
|
if (isEmpty) {
|
||||||
taskQueueHandlerRun = true;
|
|
||||||
logger.info("[线程池信息]活动线程数:{}, 最大线程数: {}", taskExecutor.getActiveCount(), taskExecutor.getMaxPoolSize());
|
logger.info("[线程池信息]活动线程数:{}, 最大线程数: {}", taskExecutor.getActiveCount(), taskExecutor.getMaxPoolSize());
|
||||||
taskExecutor.execute(() -> {
|
taskExecutor.execute(() -> {
|
||||||
while (!taskQueue.isEmpty()) {
|
while (!taskQueue.isEmpty()) {
|
||||||
Message msg = taskQueue.poll();
|
Message msg = taskQueue.poll();
|
||||||
|
try {
|
||||||
|
AlarmChannelMessage alarmChannelMessage = JSON.parseObject(msg.getBody(), AlarmChannelMessage.class);
|
||||||
|
if (alarmChannelMessage == null) {
|
||||||
|
logger.warn("[REDIS的ALARM通知]消息解析失败");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String gbId = alarmChannelMessage.getGbId();
|
||||||
|
|
||||||
AlarmChannelMessage alarmChannelMessage = JSON.parseObject(msg.getBody(), AlarmChannelMessage.class);
|
DeviceAlarm deviceAlarm = new DeviceAlarm();
|
||||||
if (alarmChannelMessage == null) {
|
deviceAlarm.setCreateTime(DateUtil.getNow());
|
||||||
logger.warn("[REDIS的ALARM通知]消息解析失败");
|
deviceAlarm.setChannelId(gbId);
|
||||||
continue;
|
deviceAlarm.setAlarmDescription(alarmChannelMessage.getAlarmDescription());
|
||||||
}
|
deviceAlarm.setAlarmMethod("" + alarmChannelMessage.getAlarmSn());
|
||||||
String gbId = alarmChannelMessage.getGbId();
|
deviceAlarm.setAlarmPriority("1");
|
||||||
|
deviceAlarm.setAlarmTime(DateUtil.getNowForISO8601());
|
||||||
|
deviceAlarm.setAlarmType("1");
|
||||||
|
deviceAlarm.setLongitude(0);
|
||||||
|
deviceAlarm.setLatitude(0);
|
||||||
|
|
||||||
DeviceAlarm deviceAlarm = new DeviceAlarm();
|
if (ObjectUtils.isEmpty(gbId)) {
|
||||||
deviceAlarm.setCreateTime(DateUtil.getNow());
|
// 发送给所有的上级
|
||||||
deviceAlarm.setChannelId(gbId);
|
List<ParentPlatform> parentPlatforms = storage.queryEnableParentPlatformList(true);
|
||||||
deviceAlarm.setAlarmDescription(alarmChannelMessage.getAlarmDescription());
|
if (parentPlatforms.size() > 0) {
|
||||||
deviceAlarm.setAlarmMethod("" + alarmChannelMessage.getAlarmSn());
|
for (ParentPlatform parentPlatform : parentPlatforms) {
|
||||||
deviceAlarm.setAlarmPriority("1");
|
try {
|
||||||
deviceAlarm.setAlarmTime(DateUtil.getNowForISO8601());
|
commanderForPlatform.sendAlarmMessage(parentPlatform, deviceAlarm);
|
||||||
deviceAlarm.setAlarmType("1");
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
deviceAlarm.setLongitude(0);
|
logger.error("[命令发送失败] 国标级联 发送报警: {}", e.getMessage());
|
||||||
deviceAlarm.setLatitude(0);
|
}
|
||||||
|
|
||||||
if (ObjectUtils.isEmpty(gbId)) {
|
|
||||||
// 发送给所有的上级
|
|
||||||
List<ParentPlatform> parentPlatforms = storage.queryEnableParentPlatformList(true);
|
|
||||||
if (parentPlatforms.size() > 0) {
|
|
||||||
for (ParentPlatform parentPlatform : parentPlatforms) {
|
|
||||||
try {
|
|
||||||
commanderForPlatform.sendAlarmMessage(parentPlatform, deviceAlarm);
|
|
||||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
|
||||||
logger.error("[命令发送失败] 国标级联 发送报警: {}", e.getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}else {
|
|
||||||
Device device = storage.queryVideoDevice(gbId);
|
|
||||||
ParentPlatform platform = storage.queryParentPlatByServerGBId(gbId);
|
|
||||||
if (device != null && platform == null) {
|
|
||||||
try {
|
|
||||||
commander.sendAlarmMessage(device, deviceAlarm);
|
|
||||||
} catch (InvalidArgumentException | SipException | ParseException e) {
|
|
||||||
logger.error("[命令发送失败] 发送报警: {}", e.getMessage());
|
|
||||||
}
|
|
||||||
}else if (device == null && platform != null){
|
|
||||||
try {
|
|
||||||
commanderForPlatform.sendAlarmMessage(platform, deviceAlarm);
|
|
||||||
} catch (InvalidArgumentException | SipException | ParseException e) {
|
|
||||||
logger.error("[命令发送失败] 发送报警: {}", e.getMessage());
|
|
||||||
}
|
|
||||||
}else {
|
}else {
|
||||||
logger.warn("无法确定" + gbId + "是平台还是设备");
|
Device device = storage.queryVideoDevice(gbId);
|
||||||
|
ParentPlatform platform = storage.queryParentPlatByServerGBId(gbId);
|
||||||
|
if (device != null && platform == null) {
|
||||||
|
try {
|
||||||
|
commander.sendAlarmMessage(device, deviceAlarm);
|
||||||
|
} catch (InvalidArgumentException | SipException | ParseException e) {
|
||||||
|
logger.error("[命令发送失败] 发送报警: {}", e.getMessage());
|
||||||
|
}
|
||||||
|
}else if (device == null && platform != null){
|
||||||
|
try {
|
||||||
|
commanderForPlatform.sendAlarmMessage(platform, deviceAlarm);
|
||||||
|
} catch (InvalidArgumentException | SipException | ParseException e) {
|
||||||
|
logger.error("[命令发送失败] 发送报警: {}", e.getMessage());
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
logger.warn("无法确定" + gbId + "是平台还是设备");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}catch (Exception e) {
|
||||||
|
logger.warn("[REDIS的ALARM通知] 发现未处理的异常, {}",e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
taskQueueHandlerRun = false;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -88,8 +88,6 @@ public class RedisGbPlayMsgListener implements MessageListener {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ZlmHttpHookSubscribe subscribe;
|
private ZlmHttpHookSubscribe subscribe;
|
||||||
|
|
||||||
private boolean taskQueueHandlerRun = false;
|
|
||||||
|
|
||||||
private ConcurrentLinkedQueue<Message> taskQueue = new ConcurrentLinkedQueue<>();
|
private ConcurrentLinkedQueue<Message> taskQueue = new ConcurrentLinkedQueue<>();
|
||||||
|
|
||||||
@Qualifier("taskExecutor")
|
@Qualifier("taskExecutor")
|
||||||
@ -111,107 +109,104 @@ public class RedisGbPlayMsgListener implements MessageListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMessage(Message message, byte[] bytes) {
|
public void onMessage(Message message, byte[] bytes) {
|
||||||
|
boolean isEmpty = taskQueue.isEmpty();
|
||||||
taskQueue.offer(message);
|
taskQueue.offer(message);
|
||||||
if (!taskQueueHandlerRun) {
|
if (isEmpty) {
|
||||||
taskQueueHandlerRun = true;
|
|
||||||
taskExecutor.execute(() -> {
|
taskExecutor.execute(() -> {
|
||||||
while (!taskQueue.isEmpty()) {
|
while (!taskQueue.isEmpty()) {
|
||||||
Message msg = taskQueue.poll();
|
Message msg = taskQueue.poll();
|
||||||
JSONObject msgJSON = JSON.parseObject(msg.getBody(), JSONObject.class);
|
try {
|
||||||
WvpRedisMsg wvpRedisMsg = JSON.toJavaObject(msgJSON, WvpRedisMsg.class);
|
JSONObject msgJSON = JSON.parseObject(msg.getBody(), JSONObject.class);
|
||||||
if (!userSetting.getServerId().equals(wvpRedisMsg.getToId())) {
|
WvpRedisMsg wvpRedisMsg = JSON.to(WvpRedisMsg.class, msgJSON);
|
||||||
continue;
|
if (!userSetting.getServerId().equals(wvpRedisMsg.getToId())) {
|
||||||
}
|
continue;
|
||||||
if (WvpRedisMsg.isRequest(wvpRedisMsg)) {
|
|
||||||
logger.info("[收到REDIS通知] 请求: {}", new String(msg.getBody()));
|
|
||||||
|
|
||||||
switch (wvpRedisMsg.getCmd()){
|
|
||||||
case WvpRedisMsgCmd.GET_SEND_ITEM:
|
|
||||||
RequestSendItemMsg content = JSON.toJavaObject((JSONObject)wvpRedisMsg.getContent(), RequestSendItemMsg.class);
|
|
||||||
requestSendItemMsgHand(content, wvpRedisMsg.getFromId(), wvpRedisMsg.getSerial());
|
|
||||||
break;
|
|
||||||
case WvpRedisMsgCmd.REQUEST_PUSH_STREAM:
|
|
||||||
RequestPushStreamMsg param = JSON.toJavaObject((JSONObject)wvpRedisMsg.getContent(), RequestPushStreamMsg.class);;
|
|
||||||
requestPushStreamMsgHand(param, wvpRedisMsg.getFromId(), wvpRedisMsg.getSerial());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
if (WvpRedisMsg.isRequest(wvpRedisMsg)) {
|
||||||
|
logger.info("[收到REDIS通知] 请求: {}", new String(msg.getBody()));
|
||||||
|
|
||||||
}else {
|
switch (wvpRedisMsg.getCmd()){
|
||||||
logger.info("[收到REDIS通知] 回复: {}", new String(msg.getBody()));
|
case WvpRedisMsgCmd.GET_SEND_ITEM:
|
||||||
switch (wvpRedisMsg.getCmd()){
|
RequestSendItemMsg content = JSON.to(RequestSendItemMsg.class, wvpRedisMsg.getContent());
|
||||||
case WvpRedisMsgCmd.GET_SEND_ITEM:
|
requestSendItemMsgHand(content, wvpRedisMsg.getFromId(), wvpRedisMsg.getSerial());
|
||||||
|
break;
|
||||||
|
case WvpRedisMsgCmd.REQUEST_PUSH_STREAM:
|
||||||
|
RequestPushStreamMsg param = JSON.to(RequestPushStreamMsg.class, wvpRedisMsg.getContent());
|
||||||
|
requestPushStreamMsgHand(param, wvpRedisMsg.getFromId(), wvpRedisMsg.getSerial());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
WVPResult content = JSON.toJavaObject((JSONObject)wvpRedisMsg.getContent(), WVPResult.class);
|
}else {
|
||||||
|
logger.info("[收到REDIS通知] 回复: {}", new String(msg.getBody()));
|
||||||
|
switch (wvpRedisMsg.getCmd()){
|
||||||
|
case WvpRedisMsgCmd.GET_SEND_ITEM:
|
||||||
|
|
||||||
String key = wvpRedisMsg.getSerial();
|
WVPResult content = JSON.to(WVPResult.class, wvpRedisMsg.getContent());
|
||||||
switch (content.getCode()) {
|
|
||||||
case 0:
|
String key = wvpRedisMsg.getSerial();
|
||||||
ResponseSendItemMsg responseSendItemMsg =JSON.toJavaObject((JSONObject)content.getData(), ResponseSendItemMsg.class);
|
switch (content.getCode()) {
|
||||||
PlayMsgCallback playMsgCallback = callbacks.get(key);
|
case 0:
|
||||||
if (playMsgCallback != null) {
|
ResponseSendItemMsg responseSendItemMsg =JSON.to(ResponseSendItemMsg.class, content.getData());
|
||||||
callbacksForError.remove(key);
|
PlayMsgCallback playMsgCallback = callbacks.get(key);
|
||||||
try {
|
if (playMsgCallback != null) {
|
||||||
playMsgCallback.handler(responseSendItemMsg);
|
callbacksForError.remove(key);
|
||||||
} catch (ParseException e) {
|
try {
|
||||||
logger.error("[REDIS消息处理异常] ", e);
|
playMsgCallback.handler(responseSendItemMsg);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
logger.error("[REDIS消息处理异常] ", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case ERROR_CODE_MEDIA_SERVER_NOT_FOUND:
|
||||||
case ERROR_CODE_MEDIA_SERVER_NOT_FOUND:
|
case ERROR_CODE_OFFLINE:
|
||||||
case ERROR_CODE_OFFLINE:
|
case ERROR_CODE_TIMEOUT:
|
||||||
case ERROR_CODE_TIMEOUT:
|
PlayMsgErrorCallback errorCallback = callbacksForError.get(key);
|
||||||
PlayMsgErrorCallback errorCallback = callbacksForError.get(key);
|
if (errorCallback != null) {
|
||||||
if (errorCallback != null) {
|
callbacks.remove(key);
|
||||||
callbacks.remove(key);
|
errorCallback.handler(content);
|
||||||
errorCallback.handler(content);
|
}
|
||||||
}
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
break;
|
||||||
break;
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case WvpRedisMsgCmd.REQUEST_PUSH_STREAM:
|
||||||
case WvpRedisMsgCmd.REQUEST_PUSH_STREAM:
|
WVPResult wvpResult = JSON.to(WVPResult.class, wvpRedisMsg.getContent());
|
||||||
WVPResult wvpResult = JSON.toJavaObject((JSONObject)wvpRedisMsg.getContent(), WVPResult.class);
|
String serial = wvpRedisMsg.getSerial();
|
||||||
String serial = wvpRedisMsg.getSerial();
|
switch (wvpResult.getCode()) {
|
||||||
switch (wvpResult.getCode()) {
|
case 0:
|
||||||
case 0:
|
JSONObject jsonObject = (JSONObject)wvpResult.getData();
|
||||||
JSONObject jsonObject = (JSONObject)wvpResult.getData();
|
PlayMsgCallbackForStartSendRtpStream playMsgCallback = callbacksForStartSendRtpStream.get(serial);
|
||||||
PlayMsgCallbackForStartSendRtpStream playMsgCallback = callbacksForStartSendRtpStream.get(serial);
|
if (playMsgCallback != null) {
|
||||||
if (playMsgCallback != null) {
|
callbacksForError.remove(serial);
|
||||||
callbacksForError.remove(serial);
|
playMsgCallback.handler(jsonObject);
|
||||||
playMsgCallback.handler(jsonObject);
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case ERROR_CODE_MEDIA_SERVER_NOT_FOUND:
|
||||||
case ERROR_CODE_MEDIA_SERVER_NOT_FOUND:
|
case ERROR_CODE_OFFLINE:
|
||||||
case ERROR_CODE_OFFLINE:
|
case ERROR_CODE_TIMEOUT:
|
||||||
case ERROR_CODE_TIMEOUT:
|
PlayMsgErrorCallback errorCallback = callbacksForError.get(serial);
|
||||||
PlayMsgErrorCallback errorCallback = callbacksForError.get(serial);
|
if (errorCallback != null) {
|
||||||
if (errorCallback != null) {
|
callbacks.remove(serial);
|
||||||
callbacks.remove(serial);
|
errorCallback.handler(wvpResult);
|
||||||
errorCallback.handler(wvpResult);
|
}
|
||||||
}
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
break;
|
||||||
break;
|
}
|
||||||
}
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
break;
|
||||||
break;
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}catch (Exception e) {
|
||||||
|
logger.warn("[RedisGbPlayMsg] 发现未处理的异常, {}",e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
taskQueueHandlerRun = false;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -318,7 +313,7 @@ public class RedisGbPlayMsgListener implements MessageListener {
|
|||||||
SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, content.getIp(),
|
SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, content.getIp(),
|
||||||
content.getPort(), content.getSsrc(), content.getPlatformId(),
|
content.getPort(), content.getSsrc(), content.getPlatformId(),
|
||||||
content.getApp(), content.getStream(), content.getChannelId(),
|
content.getApp(), content.getStream(), content.getChannelId(),
|
||||||
content.getTcp());
|
content.getTcp(), content.getRtcp());
|
||||||
|
|
||||||
WVPResult<ResponseSendItemMsg> result = new WVPResult<>();
|
WVPResult<ResponseSendItemMsg> result = new WVPResult<>();
|
||||||
result.setCode(0);
|
result.setCode(0);
|
||||||
@ -348,9 +343,9 @@ public class RedisGbPlayMsgListener implements MessageListener {
|
|||||||
* @param callback 得到信息的回调
|
* @param callback 得到信息的回调
|
||||||
*/
|
*/
|
||||||
public void sendMsg(String serverId, String mediaServerId, String app, String stream, String ip, int port, String ssrc,
|
public void sendMsg(String serverId, String mediaServerId, String app, String stream, String ip, int port, String ssrc,
|
||||||
String platformId, String channelId, boolean isTcp, String platformName, PlayMsgCallback callback, PlayMsgErrorCallback errorCallback) {
|
String platformId, String channelId, boolean isTcp, boolean rtcp, String platformName, PlayMsgCallback callback, PlayMsgErrorCallback errorCallback) {
|
||||||
RequestSendItemMsg requestSendItemMsg = RequestSendItemMsg.getInstance(
|
RequestSendItemMsg requestSendItemMsg = RequestSendItemMsg.getInstance(
|
||||||
serverId, mediaServerId, app, stream, ip, port, ssrc, platformId, channelId, isTcp, platformName);
|
serverId, mediaServerId, app, stream, ip, port, ssrc, platformId, channelId, isTcp, rtcp, platformName);
|
||||||
requestSendItemMsg.setServerId(serverId);
|
requestSendItemMsg.setServerId(serverId);
|
||||||
String key = UUID.randomUUID().toString();
|
String key = UUID.randomUUID().toString();
|
||||||
WvpRedisMsg redisMsg = WvpRedisMsg.getRequestInstance(userSetting.getServerId(), serverId, WvpRedisMsgCmd.GET_SEND_ITEM,
|
WvpRedisMsg redisMsg = WvpRedisMsg.getRequestInstance(userSetting.getServerId(), serverId, WvpRedisMsgCmd.GET_SEND_ITEM,
|
||||||
|
|||||||
@ -27,8 +27,6 @@ public class RedisGpsMsgListener implements MessageListener {
|
|||||||
|
|
||||||
private final static Logger logger = LoggerFactory.getLogger(RedisGpsMsgListener.class);
|
private final static Logger logger = LoggerFactory.getLogger(RedisGpsMsgListener.class);
|
||||||
|
|
||||||
private boolean taskQueueHandlerRun = false;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IRedisCatchStorage redisCatchStorage;
|
private IRedisCatchStorage redisCatchStorage;
|
||||||
|
|
||||||
@ -44,17 +42,20 @@ public class RedisGpsMsgListener implements MessageListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMessage(@NotNull Message message, byte[] bytes) {
|
public void onMessage(@NotNull Message message, byte[] bytes) {
|
||||||
|
boolean isEmpty = taskQueue.isEmpty();
|
||||||
taskQueue.offer(message);
|
taskQueue.offer(message);
|
||||||
if (!taskQueueHandlerRun) {
|
if (isEmpty) {
|
||||||
taskQueueHandlerRun = true;
|
|
||||||
taskExecutor.execute(() -> {
|
taskExecutor.execute(() -> {
|
||||||
while (!taskQueue.isEmpty()) {
|
while (!taskQueue.isEmpty()) {
|
||||||
Message msg = taskQueue.poll();
|
Message msg = taskQueue.poll();
|
||||||
GPSMsgInfo gpsMsgInfo = JSON.parseObject(msg.getBody(), GPSMsgInfo.class);
|
try {
|
||||||
// 只是放入redis缓存起来
|
GPSMsgInfo gpsMsgInfo = JSON.parseObject(msg.getBody(), GPSMsgInfo.class);
|
||||||
redisCatchStorage.updateGpsMsgInfo(gpsMsgInfo);
|
// 只是放入redis缓存起来
|
||||||
|
redisCatchStorage.updateGpsMsgInfo(gpsMsgInfo);
|
||||||
|
}catch (Exception e) {
|
||||||
|
logger.warn("[REDIS的ALARM通知] 发现未处理的异常, {}",e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
taskQueueHandlerRun = false;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
package com.genersoft.iot.vmp.service.redisMsg;
|
package com.genersoft.iot.vmp.service.redisMsg;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
|
||||||
import com.genersoft.iot.vmp.service.bean.MessageForPushChannelResponse;
|
import com.genersoft.iot.vmp.service.bean.MessageForPushChannelResponse;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -26,8 +25,6 @@ public class RedisPushStreamResponseListener implements MessageListener {
|
|||||||
|
|
||||||
private final static Logger logger = LoggerFactory.getLogger(RedisPushStreamResponseListener.class);
|
private final static Logger logger = LoggerFactory.getLogger(RedisPushStreamResponseListener.class);
|
||||||
|
|
||||||
private boolean taskQueueHandlerRun = false;
|
|
||||||
|
|
||||||
private ConcurrentLinkedQueue<Message> taskQueue = new ConcurrentLinkedQueue<>();
|
private ConcurrentLinkedQueue<Message> taskQueue = new ConcurrentLinkedQueue<>();
|
||||||
|
|
||||||
@Qualifier("taskExecutor")
|
@Qualifier("taskExecutor")
|
||||||
@ -43,24 +40,27 @@ public class RedisPushStreamResponseListener implements MessageListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMessage(Message message, byte[] bytes) {
|
public void onMessage(Message message, byte[] bytes) {
|
||||||
logger.warn("[REDIS消息-请求推流结果]: {}", new String(message.getBody()));
|
logger.info("[REDIS消息-请求推流结果]: {}", new String(message.getBody()));
|
||||||
|
boolean isEmpty = taskQueue.isEmpty();
|
||||||
taskQueue.offer(message);
|
taskQueue.offer(message);
|
||||||
if (!taskQueueHandlerRun) {
|
if (isEmpty) {
|
||||||
taskQueueHandlerRun = true;
|
|
||||||
taskExecutor.execute(() -> {
|
taskExecutor.execute(() -> {
|
||||||
while (!taskQueue.isEmpty()) {
|
while (!taskQueue.isEmpty()) {
|
||||||
Message msg = taskQueue.poll();
|
Message msg = taskQueue.poll();
|
||||||
MessageForPushChannelResponse response = JSON.parseObject(new String(msg.getBody()), MessageForPushChannelResponse.class);
|
try {
|
||||||
if (response == null || ObjectUtils.isEmpty(response.getApp()) || ObjectUtils.isEmpty(response.getStream())){
|
MessageForPushChannelResponse response = JSON.parseObject(new String(msg.getBody()), MessageForPushChannelResponse.class);
|
||||||
logger.info("[REDIS消息-请求推流结果]:参数不全");
|
if (response == null || ObjectUtils.isEmpty(response.getApp()) || ObjectUtils.isEmpty(response.getStream())){
|
||||||
continue;
|
logger.info("[REDIS消息-请求推流结果]:参数不全");
|
||||||
}
|
continue;
|
||||||
// 查看正在等待的invite消息
|
}
|
||||||
if (responseEvents.get(response.getApp() + response.getStream()) != null) {
|
// 查看正在等待的invite消息
|
||||||
responseEvents.get(response.getApp() + response.getStream()).run(response);
|
if (responseEvents.get(response.getApp() + response.getStream()) != null) {
|
||||||
|
responseEvents.get(response.getApp() + response.getStream()).run(response);
|
||||||
|
}
|
||||||
|
}catch (Exception e) {
|
||||||
|
logger.warn("[REDIS的ALARM通知] 发现未处理的异常, {}",e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
taskQueueHandlerRun = false;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
|||||||
import com.genersoft.iot.vmp.service.IGbStreamService;
|
import com.genersoft.iot.vmp.service.IGbStreamService;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.service.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.IStreamPushService;
|
import com.genersoft.iot.vmp.service.IStreamPushService;
|
||||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
|
||||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -18,7 +17,8 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,7 +38,6 @@ public class RedisPushStreamStatusListMsgListener implements MessageListener {
|
|||||||
@Resource
|
@Resource
|
||||||
private IGbStreamService gbStreamService;
|
private IGbStreamService gbStreamService;
|
||||||
|
|
||||||
private boolean taskQueueHandlerRun = false;
|
|
||||||
|
|
||||||
private ConcurrentLinkedQueue<Message> taskQueue = new ConcurrentLinkedQueue<>();
|
private ConcurrentLinkedQueue<Message> taskQueue = new ConcurrentLinkedQueue<>();
|
||||||
|
|
||||||
@ -49,54 +48,56 @@ public class RedisPushStreamStatusListMsgListener implements MessageListener {
|
|||||||
@Override
|
@Override
|
||||||
public void onMessage(Message message, byte[] bytes) {
|
public void onMessage(Message message, byte[] bytes) {
|
||||||
logger.info("[REDIS消息-推流设备列表更新]: {}", new String(message.getBody()));
|
logger.info("[REDIS消息-推流设备列表更新]: {}", new String(message.getBody()));
|
||||||
|
boolean isEmpty = taskQueue.isEmpty();
|
||||||
taskQueue.offer(message);
|
taskQueue.offer(message);
|
||||||
if (!taskQueueHandlerRun) {
|
if (isEmpty) {
|
||||||
taskQueueHandlerRun = true;
|
|
||||||
taskExecutor.execute(() -> {
|
taskExecutor.execute(() -> {
|
||||||
while (!taskQueue.isEmpty()) {
|
while (!taskQueue.isEmpty()) {
|
||||||
Message msg = taskQueue.poll();
|
Message msg = taskQueue.poll();
|
||||||
List<StreamPushItem> streamPushItems = JSON.parseArray(new String(msg.getBody()), StreamPushItem.class);
|
try {
|
||||||
//查询全部的app+stream 用于判断是添加还是修改
|
List<StreamPushItem> streamPushItems = JSON.parseArray(new String(msg.getBody()), StreamPushItem.class);
|
||||||
List<String> allAppAndStream = streamPushService.getAllAppAndStream();
|
//查询全部的app+stream 用于判断是添加还是修改
|
||||||
|
List<String> allAppAndStream = streamPushService.getAllAppAndStream();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用于存储更具APP+Stream过滤后的数据,可以直接存入stream_push表与gb_stream表
|
* 用于存储更具APP+Stream过滤后的数据,可以直接存入stream_push表与gb_stream表
|
||||||
*/
|
*/
|
||||||
List<StreamPushItem> streamPushItemForSave = new ArrayList<>();
|
List<StreamPushItem> streamPushItemForSave = new ArrayList<>();
|
||||||
List<StreamPushItem> streamPushItemForUpdate = new ArrayList<>();
|
List<StreamPushItem> streamPushItemForUpdate = new ArrayList<>();
|
||||||
for (StreamPushItem streamPushItem : streamPushItems) {
|
for (StreamPushItem streamPushItem : streamPushItems) {
|
||||||
String app = streamPushItem.getApp();
|
String app = streamPushItem.getApp();
|
||||||
String stream = streamPushItem.getStream();
|
String stream = streamPushItem.getStream();
|
||||||
boolean contains = allAppAndStream.contains(app + stream);
|
boolean contains = allAppAndStream.contains(app + stream);
|
||||||
//不存在就添加
|
//不存在就添加
|
||||||
if (!contains) {
|
if (!contains) {
|
||||||
streamPushItem.setStreamType("push");
|
streamPushItem.setStreamType("push");
|
||||||
streamPushItem.setCreateTime(DateUtil.getNow());
|
streamPushItem.setCreateTime(DateUtil.getNow());
|
||||||
streamPushItem.setMediaServerId(mediaServerService.getDefaultMediaServer().getId());
|
streamPushItem.setMediaServerId(mediaServerService.getDefaultMediaServer().getId());
|
||||||
streamPushItem.setOriginType(2);
|
streamPushItem.setOriginType(2);
|
||||||
streamPushItem.setOriginTypeStr("rtsp_push");
|
streamPushItem.setOriginTypeStr("rtsp_push");
|
||||||
streamPushItem.setTotalReaderCount("0");
|
streamPushItem.setTotalReaderCount("0");
|
||||||
streamPushItemForSave.add(streamPushItem);
|
streamPushItemForSave.add(streamPushItem);
|
||||||
} else {
|
} else {
|
||||||
//存在就只修改 name和gbId
|
//存在就只修改 name和gbId
|
||||||
streamPushItemForUpdate.add(streamPushItem);
|
streamPushItemForUpdate.add(streamPushItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if (streamPushItemForSave.size() > 0) {
|
||||||
if (streamPushItemForSave.size() > 0) {
|
|
||||||
|
|
||||||
logger.info("添加{}条",streamPushItemForSave.size());
|
logger.info("添加{}条",streamPushItemForSave.size());
|
||||||
logger.info(JSONObject.toJSONString(streamPushItemForSave));
|
logger.info(JSONObject.toJSONString(streamPushItemForSave));
|
||||||
streamPushService.batchAdd(streamPushItemForSave);
|
streamPushService.batchAdd(streamPushItemForSave);
|
||||||
|
|
||||||
}
|
}
|
||||||
if(streamPushItemForUpdate.size()>0){
|
if(streamPushItemForUpdate.size()>0){
|
||||||
logger.info("修改{}条",streamPushItemForUpdate.size());
|
logger.info("修改{}条",streamPushItemForUpdate.size());
|
||||||
logger.info(JSONObject.toJSONString(streamPushItemForUpdate));
|
logger.info(JSONObject.toJSONString(streamPushItemForUpdate));
|
||||||
gbStreamService.updateGbIdOrName(streamPushItemForUpdate);
|
gbStreamService.updateGbIdOrName(streamPushItemForUpdate);
|
||||||
|
}
|
||||||
|
}catch (Exception e) {
|
||||||
|
logger.warn("[REDIS的ALARM通知] 发现未处理的异常, {}",e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
taskQueueHandlerRun = false;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,8 +29,6 @@ public class RedisPushStreamStatusMsgListener implements MessageListener, Applic
|
|||||||
|
|
||||||
private final static Logger logger = LoggerFactory.getLogger(RedisPushStreamStatusMsgListener.class);
|
private final static Logger logger = LoggerFactory.getLogger(RedisPushStreamStatusMsgListener.class);
|
||||||
|
|
||||||
private boolean taskQueueHandlerRun = false;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IRedisCatchStorage redisCatchStorage;
|
private IRedisCatchStorage redisCatchStorage;
|
||||||
|
|
||||||
@ -50,37 +48,40 @@ public class RedisPushStreamStatusMsgListener implements MessageListener, Applic
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMessage(Message message, byte[] bytes) {
|
public void onMessage(Message message, byte[] bytes) {
|
||||||
|
boolean isEmpty = taskQueue.isEmpty();
|
||||||
logger.warn("[REDIS消息-推流设备状态变化]: {}", new String(message.getBody()));
|
logger.warn("[REDIS消息-推流设备状态变化]: {}", new String(message.getBody()));
|
||||||
taskQueue.offer(message);
|
taskQueue.offer(message);
|
||||||
|
|
||||||
if (!taskQueueHandlerRun) {
|
if (isEmpty) {
|
||||||
taskQueueHandlerRun = true;
|
|
||||||
taskExecutor.execute(() -> {
|
taskExecutor.execute(() -> {
|
||||||
while (!taskQueue.isEmpty()) {
|
while (!taskQueue.isEmpty()) {
|
||||||
Message msg = taskQueue.poll();
|
Message msg = taskQueue.poll();
|
||||||
PushStreamStatusChangeFromRedisDto statusChangeFromPushStream = JSON.parseObject(msg.getBody(), PushStreamStatusChangeFromRedisDto.class);
|
try {
|
||||||
if (statusChangeFromPushStream == null) {
|
PushStreamStatusChangeFromRedisDto statusChangeFromPushStream = JSON.parseObject(msg.getBody(), PushStreamStatusChangeFromRedisDto.class);
|
||||||
logger.warn("[REDIS消息]推流设备状态变化消息解析失败");
|
if (statusChangeFromPushStream == null) {
|
||||||
continue;
|
logger.warn("[REDIS消息]推流设备状态变化消息解析失败");
|
||||||
}
|
continue;
|
||||||
// 取消定时任务
|
}
|
||||||
dynamicTask.stop(VideoManagerConstants.VM_MSG_GET_ALL_ONLINE_REQUESTED);
|
// 取消定时任务
|
||||||
if (statusChangeFromPushStream.isSetAllOffline()) {
|
dynamicTask.stop(VideoManagerConstants.VM_MSG_GET_ALL_ONLINE_REQUESTED);
|
||||||
// 所有设备离线
|
if (statusChangeFromPushStream.isSetAllOffline()) {
|
||||||
streamPushService.allStreamOffline();
|
// 所有设备离线
|
||||||
}
|
streamPushService.allStreamOffline();
|
||||||
if (statusChangeFromPushStream.getOfflineStreams() != null
|
}
|
||||||
&& statusChangeFromPushStream.getOfflineStreams().size() > 0) {
|
if (statusChangeFromPushStream.getOfflineStreams() != null
|
||||||
// 更新部分设备离线
|
&& statusChangeFromPushStream.getOfflineStreams().size() > 0) {
|
||||||
streamPushService.offline(statusChangeFromPushStream.getOfflineStreams());
|
// 更新部分设备离线
|
||||||
}
|
streamPushService.offline(statusChangeFromPushStream.getOfflineStreams());
|
||||||
if (statusChangeFromPushStream.getOnlineStreams() != null &&
|
}
|
||||||
statusChangeFromPushStream.getOnlineStreams().size() > 0) {
|
if (statusChangeFromPushStream.getOnlineStreams() != null &&
|
||||||
// 更新部分设备上线
|
statusChangeFromPushStream.getOnlineStreams().size() > 0) {
|
||||||
streamPushService.online(statusChangeFromPushStream.getOnlineStreams());
|
// 更新部分设备上线
|
||||||
|
streamPushService.online(statusChangeFromPushStream.getOnlineStreams());
|
||||||
|
}
|
||||||
|
}catch (Exception e) {
|
||||||
|
logger.warn("[REDIS的ALARM通知] 发现未处理的异常, {}",e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
taskQueueHandlerRun = false;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,8 +33,6 @@ public class RedisStreamMsgListener implements MessageListener {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ZLMMediaListManager zlmMediaListManager;
|
private ZLMMediaListManager zlmMediaListManager;
|
||||||
|
|
||||||
private boolean taskQueueHandlerRun = false;
|
|
||||||
|
|
||||||
private ConcurrentLinkedQueue<Message> taskQueue = new ConcurrentLinkedQueue<>();
|
private ConcurrentLinkedQueue<Message> taskQueue = new ConcurrentLinkedQueue<>();
|
||||||
|
|
||||||
@Qualifier("taskExecutor")
|
@Qualifier("taskExecutor")
|
||||||
@ -43,48 +41,50 @@ public class RedisStreamMsgListener implements MessageListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMessage(Message message, byte[] bytes) {
|
public void onMessage(Message message, byte[] bytes) {
|
||||||
|
boolean isEmpty = taskQueue.isEmpty();
|
||||||
taskQueue.offer(message);
|
taskQueue.offer(message);
|
||||||
if (!taskQueueHandlerRun) {
|
if (isEmpty) {
|
||||||
taskQueueHandlerRun = true;
|
|
||||||
taskExecutor.execute(() -> {
|
taskExecutor.execute(() -> {
|
||||||
while (!taskQueue.isEmpty()) {
|
while (!taskQueue.isEmpty()) {
|
||||||
Message msg = taskQueue.poll();
|
Message msg = taskQueue.poll();
|
||||||
JSONObject steamMsgJson = JSON.parseObject(msg.getBody(), JSONObject.class);
|
try {
|
||||||
if (steamMsgJson == null) {
|
JSONObject steamMsgJson = JSON.parseObject(msg.getBody(), JSONObject.class);
|
||||||
logger.warn("[收到redis 流变化]消息解析失败");
|
if (steamMsgJson == null) {
|
||||||
continue;
|
logger.warn("[收到redis 流变化]消息解析失败");
|
||||||
}
|
continue;
|
||||||
String serverId = steamMsgJson.getString("serverId");
|
}
|
||||||
|
String serverId = steamMsgJson.getString("serverId");
|
||||||
|
|
||||||
if (userSetting.getServerId().equals(serverId)) {
|
if (userSetting.getServerId().equals(serverId)) {
|
||||||
// 自己发送的消息忽略即可
|
// 自己发送的消息忽略即可
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
logger.info("[收到redis 流变化]: {}", new String(message.getBody()));
|
logger.info("[收到redis 流变化]: {}", new String(message.getBody()));
|
||||||
String app = steamMsgJson.getString("app");
|
String app = steamMsgJson.getString("app");
|
||||||
String stream = steamMsgJson.getString("stream");
|
String stream = steamMsgJson.getString("stream");
|
||||||
boolean register = steamMsgJson.getBoolean("register");
|
boolean register = steamMsgJson.getBoolean("register");
|
||||||
String mediaServerId = steamMsgJson.getString("mediaServerId");
|
String mediaServerId = steamMsgJson.getString("mediaServerId");
|
||||||
OnStreamChangedHookParam onStreamChangedHookParam = new OnStreamChangedHookParam();
|
OnStreamChangedHookParam onStreamChangedHookParam = new OnStreamChangedHookParam();
|
||||||
onStreamChangedHookParam.setSeverId(serverId);
|
onStreamChangedHookParam.setSeverId(serverId);
|
||||||
onStreamChangedHookParam.setApp(app);
|
onStreamChangedHookParam.setApp(app);
|
||||||
onStreamChangedHookParam.setStream(stream);
|
onStreamChangedHookParam.setStream(stream);
|
||||||
onStreamChangedHookParam.setRegist(register);
|
onStreamChangedHookParam.setRegist(register);
|
||||||
onStreamChangedHookParam.setMediaServerId(mediaServerId);
|
onStreamChangedHookParam.setMediaServerId(mediaServerId);
|
||||||
onStreamChangedHookParam.setCreateStamp(System.currentTimeMillis()/1000);
|
onStreamChangedHookParam.setCreateStamp(System.currentTimeMillis()/1000);
|
||||||
onStreamChangedHookParam.setAliveSecond(0L);
|
onStreamChangedHookParam.setAliveSecond(0L);
|
||||||
onStreamChangedHookParam.setTotalReaderCount("0");
|
onStreamChangedHookParam.setTotalReaderCount("0");
|
||||||
onStreamChangedHookParam.setOriginType(0);
|
onStreamChangedHookParam.setOriginType(0);
|
||||||
onStreamChangedHookParam.setOriginTypeStr("0");
|
onStreamChangedHookParam.setOriginTypeStr("0");
|
||||||
onStreamChangedHookParam.setOriginTypeStr("unknown");
|
onStreamChangedHookParam.setOriginTypeStr("unknown");
|
||||||
if (register) {
|
if (register) {
|
||||||
zlmMediaListManager.addPush(onStreamChangedHookParam);
|
zlmMediaListManager.addPush(onStreamChangedHookParam);
|
||||||
}else {
|
}else {
|
||||||
zlmMediaListManager.removeMedia(app, stream);
|
zlmMediaListManager.removeMedia(app, stream);
|
||||||
|
}
|
||||||
|
}catch (Exception e) {
|
||||||
|
logger.warn("[REDIS的ALARM通知] 发现未处理的异常, {}",e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
taskQueueHandlerRun = false;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package com.genersoft.iot.vmp.storager.dao;
|
package com.genersoft.iot.vmp.storager.dao;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannelInPlatform;
|
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannelInPlatform;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
|
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
|||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto;
|
|
||||||
import org.apache.ibatis.annotations.*;
|
import org.apache.ibatis.annotations.*;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
@ -169,4 +168,5 @@ public interface GbStreamMapper {
|
|||||||
|
|
||||||
@Select("SELECT status FROM stream_push WHERE app=#{app} AND stream=#{stream}")
|
@Select("SELECT status FROM stream_push WHERE app=#{app} AND stream=#{stream}")
|
||||||
Boolean selectStatusForPush(String app, String stream);
|
Boolean selectStatusForPush(String app, String stream);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,6 +57,9 @@ public interface PlatformChannelMapper {
|
|||||||
@Select("SELECT dc.* FROM platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE dc.channelId='${channelId}' and pgc.platformId='${platformId}'")
|
@Select("SELECT dc.* FROM platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE dc.channelId='${channelId}' and pgc.platformId='${platformId}'")
|
||||||
List<DeviceChannel> queryChannelInParentPlatform(String platformId, String channelId);
|
List<DeviceChannel> queryChannelInParentPlatform(String platformId, String channelId);
|
||||||
|
|
||||||
|
@Select("SELECT dc.* FROM platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE pgc.platformId='${platformId}' and pgc.catalogId=#{catalogId}")
|
||||||
|
List<DeviceChannel> queryAllChannelInCatalog(String platformId, String catalogId);
|
||||||
|
|
||||||
@Select(" select dc.channelId as id, dc.name as name, pgc.platformId as platformId, pgc.catalogId as parentId, 0 as childrenCount, 1 as type " +
|
@Select(" select dc.channelId as id, dc.name as name, pgc.platformId as platformId, pgc.catalogId as parentId, 0 as childrenCount, 1 as type " +
|
||||||
" from device_channel dc left join platform_gb_channel pgc on dc.id = pgc.deviceChannelId " +
|
" from device_channel dc left join platform_gb_channel pgc on dc.id = pgc.deviceChannelId " +
|
||||||
" where pgc.platformId=#{platformId} and pgc.catalogId=#{catalogId}")
|
" where pgc.platformId=#{platformId} and pgc.catalogId=#{catalogId}")
|
||||||
@ -99,4 +102,9 @@ public interface PlatformChannelMapper {
|
|||||||
"DELETE FROM platform_gb_channel WHERE platformId=#{serverGBId}" +
|
"DELETE FROM platform_gb_channel WHERE platformId=#{serverGBId}" +
|
||||||
"</script>")
|
"</script>")
|
||||||
void delByPlatformId(String serverGBId);
|
void delByPlatformId(String serverGBId);
|
||||||
|
|
||||||
|
@Delete("<script> " +
|
||||||
|
"DELETE FROM platform_gb_channel WHERE platformId=#{platformId} and catalogId=#{catalogId}" +
|
||||||
|
"</script>")
|
||||||
|
int delChannelForGBByCatalogId(String platformId, String catalogId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -105,4 +105,7 @@ public interface PlatformGbStreamMapper {
|
|||||||
"</foreach>" +
|
"</foreach>" +
|
||||||
"</script>")
|
"</script>")
|
||||||
void delByAppAndStreamsByPlatformId(List<GbStream> gbStreams, String platformId);
|
void delByAppAndStreamsByPlatformId(List<GbStream> gbStreams, String platformId);
|
||||||
|
|
||||||
|
@Delete("DELETE FROM platform_gb_stream WHERE platformId=#{platformId} and catalogId=#{catalogId}")
|
||||||
|
int delByPlatformAndCatalogId(String platformId, String catalogId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,9 +12,9 @@ import java.util.List;
|
|||||||
public interface StreamProxyMapper {
|
public interface StreamProxyMapper {
|
||||||
|
|
||||||
@Insert("INSERT INTO stream_proxy (type, name, app, stream,mediaServerId, url, src_url, dst_url, " +
|
@Insert("INSERT INTO stream_proxy (type, name, app, stream,mediaServerId, url, src_url, dst_url, " +
|
||||||
"timeout_ms, ffmpeg_cmd_key, rtp_type, enable_hls, enable_mp4, enable, status, enable_remove_none_reader, enable_disable_none_reader, createTime) VALUES" +
|
"timeout_ms, ffmpeg_cmd_key, rtp_type, enable_audio, enable_mp4, enable, status, enable_remove_none_reader, enable_disable_none_reader, createTime) VALUES" +
|
||||||
"('${type}','${name}', '${app}', '${stream}', '${mediaServerId}','${url}', '${src_url}', '${dst_url}', " +
|
"('${type}','${name}', '${app}', '${stream}', '${mediaServerId}','${url}', '${src_url}', '${dst_url}', " +
|
||||||
"'${timeout_ms}', '${ffmpeg_cmd_key}', '${rtp_type}', ${enable_hls}, ${enable_mp4}, ${enable}, ${status}, " +
|
"'${timeout_ms}', '${ffmpeg_cmd_key}', '${rtp_type}', ${enable_audio}, ${enable_mp4}, ${enable}, ${status}, " +
|
||||||
"${enable_remove_none_reader}, ${enable_disable_none_reader}, '${createTime}' )")
|
"${enable_remove_none_reader}, ${enable_disable_none_reader}, '${createTime}' )")
|
||||||
int add(StreamProxyItem streamProxyDto);
|
int add(StreamProxyItem streamProxyDto);
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ public interface StreamProxyMapper {
|
|||||||
"timeout_ms=#{timeout_ms}, " +
|
"timeout_ms=#{timeout_ms}, " +
|
||||||
"ffmpeg_cmd_key=#{ffmpeg_cmd_key}, " +
|
"ffmpeg_cmd_key=#{ffmpeg_cmd_key}, " +
|
||||||
"rtp_type=#{rtp_type}, " +
|
"rtp_type=#{rtp_type}, " +
|
||||||
"enable_hls=#{enable_hls}, " +
|
"enable_audio=#{enable_audio}, " +
|
||||||
"enable=#{enable}, " +
|
"enable=#{enable}, " +
|
||||||
"status=#{status}, " +
|
"status=#{status}, " +
|
||||||
"enable_remove_none_reader=#{enable_remove_none_reader}, " +
|
"enable_remove_none_reader=#{enable_remove_none_reader}, " +
|
||||||
|
|||||||
@ -1,13 +1,11 @@
|
|||||||
package com.genersoft.iot.vmp.storager.impl;
|
package com.genersoft.iot.vmp.storager.impl;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
|
||||||
import com.genersoft.iot.vmp.conf.SipConfig;
|
import com.genersoft.iot.vmp.conf.SipConfig;
|
||||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
|
||||||
import com.genersoft.iot.vmp.service.IGbStreamService;
|
import com.genersoft.iot.vmp.service.IGbStreamService;
|
||||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
@ -28,7 +26,6 @@ import org.springframework.transaction.TransactionStatus;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
@ -761,18 +758,6 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
|||||||
return gbStreamMapper.updateStreamGPS(gpsMsgInfos);
|
return gbStreamMapper.updateStreamGPS(gpsMsgInfos);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<DeviceChannel> getDeviceChannelListByChannelReduceList(List<ChannelReduce> channelReduces, String catalogId) {
|
|
||||||
List<DeviceChannel> deviceChannelList = new ArrayList<>();
|
|
||||||
if (channelReduces.size() > 0){
|
|
||||||
for (ChannelReduce channelReduce : channelReduces) {
|
|
||||||
DeviceChannel deviceChannel = queryChannel(channelReduce.getDeviceId(), channelReduce.getChannelId());
|
|
||||||
deviceChannel.setParental(1);
|
|
||||||
deviceChannel.setParentId(catalogId);
|
|
||||||
deviceChannelList.add(deviceChannel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return deviceChannelList;
|
|
||||||
}
|
|
||||||
|
|
||||||
private DeviceChannel getDeviceChannelByCatalog(PlatformCatalog catalog) {
|
private DeviceChannel getDeviceChannelByCatalog(PlatformCatalog catalog) {
|
||||||
ParentPlatform platform = platformMapper.getParentPlatByServerGBId(catalog.getPlatformId());
|
ParentPlatform platform = platformMapper.getParentPlatByServerGBId(catalog.getPlatformId());
|
||||||
|
|||||||
@ -0,0 +1,325 @@
|
|||||||
|
package com.genersoft.iot.vmp.vmanager.bean;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||||
|
|
||||||
|
public class StreamContent {
|
||||||
|
|
||||||
|
private String app;
|
||||||
|
private String stream;
|
||||||
|
|
||||||
|
private String ip;
|
||||||
|
|
||||||
|
private String flv;
|
||||||
|
|
||||||
|
private String https_flv;
|
||||||
|
private String ws_flv;
|
||||||
|
private String wss_flv;
|
||||||
|
private String fmp4;
|
||||||
|
private String https_fmp4;
|
||||||
|
private String ws_fmp4;
|
||||||
|
private String wss_fmp4;
|
||||||
|
private String hls;
|
||||||
|
private String https_hls;
|
||||||
|
private String ws_hls;
|
||||||
|
private String wss_hls;
|
||||||
|
private String ts;
|
||||||
|
private String https_ts;
|
||||||
|
private String ws_ts;
|
||||||
|
private String wss_ts;
|
||||||
|
private String rtmp;
|
||||||
|
private String rtmps;
|
||||||
|
private String rtsp;
|
||||||
|
private String rtsps;
|
||||||
|
private String rtc;
|
||||||
|
|
||||||
|
private String rtcs;
|
||||||
|
private String mediaServerId;
|
||||||
|
private Object tracks;
|
||||||
|
|
||||||
|
public StreamContent(StreamInfo streamInfo) {
|
||||||
|
if (streamInfo == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.app = streamInfo.getApp();
|
||||||
|
this.stream = streamInfo.getStream();
|
||||||
|
if (streamInfo.getFlv() != null) {
|
||||||
|
this.flv = streamInfo.getFlv().getUrl();
|
||||||
|
}
|
||||||
|
if (streamInfo.getHttps_flv() != null) {
|
||||||
|
this.https_flv = streamInfo.getHttps_flv().getUrl();
|
||||||
|
}
|
||||||
|
if (streamInfo.getWs_flv() != null) {
|
||||||
|
this.ws_flv = streamInfo.getWs_flv().getUrl();
|
||||||
|
}
|
||||||
|
if (streamInfo.getWss_flv() != null) {
|
||||||
|
this.wss_flv = streamInfo.getWss_flv().getUrl();
|
||||||
|
}
|
||||||
|
if (streamInfo.getFmp4() != null) {
|
||||||
|
this.fmp4 = streamInfo.getFmp4().getUrl();
|
||||||
|
}
|
||||||
|
if (streamInfo.getWs_fmp4() != null) {
|
||||||
|
this.ws_fmp4 = streamInfo.getWs_fmp4().getUrl();
|
||||||
|
}
|
||||||
|
if (streamInfo.getWss_fmp4() != null) {
|
||||||
|
this.wss_fmp4 = streamInfo.getWss_fmp4().getUrl();
|
||||||
|
}
|
||||||
|
if (streamInfo.getHls() != null) {
|
||||||
|
this.hls = streamInfo.getHls().getUrl();
|
||||||
|
}
|
||||||
|
if (streamInfo.getHttps_hls() != null) {
|
||||||
|
this.https_hls = streamInfo.getHttps_hls().getUrl();
|
||||||
|
}
|
||||||
|
if (streamInfo.getWs_hls() != null) {
|
||||||
|
this.ws_hls = streamInfo.getWs_hls().getUrl();
|
||||||
|
}
|
||||||
|
if (streamInfo.getWss_hls() != null) {
|
||||||
|
this.wss_hls = streamInfo.getWss_hls().getUrl();
|
||||||
|
}
|
||||||
|
if (streamInfo.getTs() != null) {
|
||||||
|
this.ts = streamInfo.getTs().getUrl();
|
||||||
|
}
|
||||||
|
if (streamInfo.getHttps_ts() != null) {
|
||||||
|
this.https_ts = streamInfo.getHttps_ts().getUrl();
|
||||||
|
}
|
||||||
|
if (streamInfo.getWs_ts() != null) {
|
||||||
|
this.ws_ts = streamInfo.getWs_ts().getUrl();
|
||||||
|
}
|
||||||
|
if (streamInfo.getRtmp() != null) {
|
||||||
|
this.rtmp = streamInfo.getRtmp().getUrl();
|
||||||
|
}
|
||||||
|
if (streamInfo.getRtmps() != null) {
|
||||||
|
this.rtmps = streamInfo.getRtmps().getUrl();
|
||||||
|
}
|
||||||
|
if (streamInfo.getRtsp() != null) {
|
||||||
|
this.rtsp = streamInfo.getRtsp().getUrl();
|
||||||
|
}
|
||||||
|
if (streamInfo.getRtsps() != null) {
|
||||||
|
this.rtsps = streamInfo.getRtsps().getUrl();
|
||||||
|
}
|
||||||
|
if (streamInfo.getRtc() != null) {
|
||||||
|
this.rtc = streamInfo.getRtc().getUrl();
|
||||||
|
}
|
||||||
|
if (streamInfo.getRtcs() != null) {
|
||||||
|
this.rtcs = streamInfo.getRtcs().getUrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.mediaServerId = streamInfo.getMediaServerId();
|
||||||
|
this.tracks = streamInfo.getTracks();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApp() {
|
||||||
|
return app;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApp(String app) {
|
||||||
|
this.app = app;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStream() {
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStream(String stream) {
|
||||||
|
this.stream = stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIp() {
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIp(String ip) {
|
||||||
|
this.ip = ip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFlv() {
|
||||||
|
return flv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFlv(String flv) {
|
||||||
|
this.flv = flv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHttps_flv() {
|
||||||
|
return https_flv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHttps_flv(String https_flv) {
|
||||||
|
this.https_flv = https_flv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWs_flv() {
|
||||||
|
return ws_flv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWs_flv(String ws_flv) {
|
||||||
|
this.ws_flv = ws_flv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWss_flv() {
|
||||||
|
return wss_flv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWss_flv(String wss_flv) {
|
||||||
|
this.wss_flv = wss_flv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFmp4() {
|
||||||
|
return fmp4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFmp4(String fmp4) {
|
||||||
|
this.fmp4 = fmp4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHttps_fmp4() {
|
||||||
|
return https_fmp4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHttps_fmp4(String https_fmp4) {
|
||||||
|
this.https_fmp4 = https_fmp4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWs_fmp4() {
|
||||||
|
return ws_fmp4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWs_fmp4(String ws_fmp4) {
|
||||||
|
this.ws_fmp4 = ws_fmp4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWss_fmp4() {
|
||||||
|
return wss_fmp4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWss_fmp4(String wss_fmp4) {
|
||||||
|
this.wss_fmp4 = wss_fmp4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHls() {
|
||||||
|
return hls;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHls(String hls) {
|
||||||
|
this.hls = hls;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHttps_hls() {
|
||||||
|
return https_hls;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHttps_hls(String https_hls) {
|
||||||
|
this.https_hls = https_hls;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWs_hls() {
|
||||||
|
return ws_hls;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWs_hls(String ws_hls) {
|
||||||
|
this.ws_hls = ws_hls;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWss_hls() {
|
||||||
|
return wss_hls;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWss_hls(String wss_hls) {
|
||||||
|
this.wss_hls = wss_hls;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTs() {
|
||||||
|
return ts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTs(String ts) {
|
||||||
|
this.ts = ts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHttps_ts() {
|
||||||
|
return https_ts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHttps_ts(String https_ts) {
|
||||||
|
this.https_ts = https_ts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWs_ts() {
|
||||||
|
return ws_ts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWs_ts(String ws_ts) {
|
||||||
|
this.ws_ts = ws_ts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWss_ts() {
|
||||||
|
return wss_ts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWss_ts(String wss_ts) {
|
||||||
|
this.wss_ts = wss_ts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRtmp() {
|
||||||
|
return rtmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRtmp(String rtmp) {
|
||||||
|
this.rtmp = rtmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRtmps() {
|
||||||
|
return rtmps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRtmps(String rtmps) {
|
||||||
|
this.rtmps = rtmps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRtsp() {
|
||||||
|
return rtsp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRtsp(String rtsp) {
|
||||||
|
this.rtsp = rtsp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRtsps() {
|
||||||
|
return rtsps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRtsps(String rtsps) {
|
||||||
|
this.rtsps = rtsps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRtc() {
|
||||||
|
return rtc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRtc(String rtc) {
|
||||||
|
this.rtc = rtc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRtcs() {
|
||||||
|
return rtcs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRtcs(String rtcs) {
|
||||||
|
this.rtcs = rtcs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMediaServerId() {
|
||||||
|
return mediaServerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMediaServerId(String mediaServerId) {
|
||||||
|
this.mediaServerId = mediaServerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getTracks() {
|
||||||
|
return tracks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTracks(Object tracks) {
|
||||||
|
this.tracks = tracks;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -5,7 +5,6 @@ import com.genersoft.iot.vmp.conf.DynamicTask;
|
|||||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.SyncStatus;
|
import com.genersoft.iot.vmp.gb28181.bean.SyncStatus;
|
||||||
import com.genersoft.iot.vmp.gb28181.task.ISubscribeTask;
|
import com.genersoft.iot.vmp.gb28181.task.ISubscribeTask;
|
||||||
import com.genersoft.iot.vmp.gb28181.task.impl.CatalogSubscribeTask;
|
import com.genersoft.iot.vmp.gb28181.task.impl.CatalogSubscribeTask;
|
||||||
@ -25,7 +24,6 @@ import io.swagger.v3.oas.annotations.Operation;
|
|||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.apache.commons.compress.utils.IOUtils;
|
import org.apache.commons.compress.utils.IOUtils;
|
||||||
import org.apache.http.HttpResponse;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -33,15 +31,15 @@ import org.springframework.http.HttpStatus;
|
|||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.context.request.async.DeferredResult;
|
import org.springframework.web.context.request.async.DeferredResult;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.sip.DialogState;
|
|
||||||
import javax.sip.InvalidArgumentException;
|
import javax.sip.InvalidArgumentException;
|
||||||
import javax.sip.SipException;
|
import javax.sip.SipException;
|
||||||
import java.io.*;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -145,7 +143,7 @@ public class DeviceQuery {
|
|||||||
*/
|
*/
|
||||||
@Operation(summary = "同步设备通道")
|
@Operation(summary = "同步设备通道")
|
||||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||||
@PostMapping("/devices/{deviceId}/sync")
|
@GetMapping("/devices/{deviceId}/sync")
|
||||||
public WVPResult<SyncStatus> devicesSync(@PathVariable String deviceId){
|
public WVPResult<SyncStatus> devicesSync(@PathVariable String deviceId){
|
||||||
|
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
package com.genersoft.iot.vmp.vmanager.gb28181.gbStream;
|
package com.genersoft.iot.vmp.vmanager.gb28181.gbStream;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||||
|
import com.genersoft.iot.vmp.service.IGbStreamService;
|
||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||||
import com.genersoft.iot.vmp.vmanager.gb28181.gbStream.bean.GbStreamParam;
|
import com.genersoft.iot.vmp.vmanager.gb28181.gbStream.bean.GbStreamParam;
|
||||||
import com.genersoft.iot.vmp.service.IGbStreamService;
|
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
@ -12,9 +12,10 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Tag(name = "视频流关联到级联平台")
|
@Tag(name = "视频流关联到级联平台")
|
||||||
@CrossOrigin
|
@CrossOrigin
|
||||||
@RestController
|
@RestController
|
||||||
@ -76,11 +77,14 @@ public class GbStreamController {
|
|||||||
@Operation(summary = "移除国标关联")
|
@Operation(summary = "移除国标关联")
|
||||||
@DeleteMapping(value = "/del")
|
@DeleteMapping(value = "/del")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Object del(@RequestBody GbStreamParam gbStreamParam){
|
public void del(@RequestBody GbStreamParam gbStreamParam){
|
||||||
if (gbStreamService.delPlatformInfo(gbStreamParam.getPlatformId(), gbStreamParam.getGbStreams())) {
|
|
||||||
return "success";
|
if (gbStreamParam.getGbStreams() == null || gbStreamParam.getGbStreams().size() == 0) {
|
||||||
|
if (gbStreamParam.isAll()) {
|
||||||
|
gbStreamService.delAllPlatformInfo(gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId());
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
return "fail";
|
gbStreamService.delPlatformInfo(gbStreamParam.getPlatformId(), gbStreamParam.getGbStreams());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -93,11 +97,14 @@ public class GbStreamController {
|
|||||||
@Operation(summary = "保存国标关联")
|
@Operation(summary = "保存国标关联")
|
||||||
@PostMapping(value = "/add")
|
@PostMapping(value = "/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Object add(@RequestBody GbStreamParam gbStreamParam){
|
public void add(@RequestBody GbStreamParam gbStreamParam){
|
||||||
if (gbStreamService.addPlatformInfo(gbStreamParam.getGbStreams(), gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId())) {
|
if (gbStreamParam.getGbStreams() == null || gbStreamParam.getGbStreams().size() == 0) {
|
||||||
return "success";
|
if (gbStreamParam.isAll()) {
|
||||||
|
List<GbStream> allGBChannels = gbStreamService.getAllGBChannels(gbStreamParam.getPlatformId());
|
||||||
|
gbStreamService.addPlatformInfo(allGBChannels, gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId());
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
return "fail";
|
gbStreamService.addPlatformInfo(gbStreamParam.getGbStreams(), gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,6 +14,9 @@ public class GbStreamParam {
|
|||||||
@Schema(description = "目录ID")
|
@Schema(description = "目录ID")
|
||||||
private String catalogId;
|
private String catalogId;
|
||||||
|
|
||||||
|
@Schema(description = "关联所有通道")
|
||||||
|
private boolean all;
|
||||||
|
|
||||||
@Schema(description = "流国标信息列表")
|
@Schema(description = "流国标信息列表")
|
||||||
private List<GbStream> gbStreams;
|
private List<GbStream> gbStreams;
|
||||||
|
|
||||||
@ -40,4 +43,12 @@ public class GbStreamParam {
|
|||||||
public void setGbStreams(List<GbStream> gbStreams) {
|
public void setGbStreams(List<GbStream> gbStreams) {
|
||||||
this.gbStreams = gbStreams;
|
this.gbStreams = gbStreams;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isAll() {
|
||||||
|
return all;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAll(boolean all) {
|
||||||
|
this.all = all;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,10 +5,11 @@ import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
|||||||
import com.genersoft.iot.vmp.conf.security.SecurityUtils;
|
import com.genersoft.iot.vmp.conf.security.SecurityUtils;
|
||||||
import com.genersoft.iot.vmp.conf.security.dto.LoginUser;
|
import com.genersoft.iot.vmp.conf.security.dto.LoginUser;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
|
||||||
import com.genersoft.iot.vmp.service.IStreamProxyService;
|
|
||||||
import com.genersoft.iot.vmp.service.IMediaService;
|
import com.genersoft.iot.vmp.service.IMediaService;
|
||||||
|
import com.genersoft.iot.vmp.service.IStreamProxyService;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||||
|
import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
@ -53,11 +54,11 @@ public class MediaController {
|
|||||||
@Parameter(name = "useSourceIpAsStreamIp", description = "是否使用请求IP作为返回的地址IP")
|
@Parameter(name = "useSourceIpAsStreamIp", description = "是否使用请求IP作为返回的地址IP")
|
||||||
@GetMapping(value = "/stream_info_by_app_and_stream")
|
@GetMapping(value = "/stream_info_by_app_and_stream")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public StreamInfo getStreamInfoByAppAndStream(HttpServletRequest request, @RequestParam String app,
|
public StreamContent getStreamInfoByAppAndStream(HttpServletRequest request, @RequestParam String app,
|
||||||
@RequestParam String stream,
|
@RequestParam String stream,
|
||||||
@RequestParam(required = false) String mediaServerId,
|
@RequestParam(required = false) String mediaServerId,
|
||||||
@RequestParam(required = false) String callId,
|
@RequestParam(required = false) String callId,
|
||||||
@RequestParam(required = false) Boolean useSourceIpAsStreamIp){
|
@RequestParam(required = false) Boolean useSourceIpAsStreamIp){
|
||||||
boolean authority = false;
|
boolean authority = false;
|
||||||
if (callId != null) {
|
if (callId != null) {
|
||||||
// 权限校验
|
// 权限校验
|
||||||
@ -90,7 +91,7 @@ public class MediaController {
|
|||||||
|
|
||||||
WVPResult<StreamInfo> result = new WVPResult<>();
|
WVPResult<StreamInfo> result = new WVPResult<>();
|
||||||
if (streamInfo != null){
|
if (streamInfo != null){
|
||||||
return streamInfo;
|
return new StreamContent(streamInfo);
|
||||||
}else {
|
}else {
|
||||||
//获取流失败,重启拉流后重试一次
|
//获取流失败,重启拉流后重试一次
|
||||||
streamProxyService.stop(app,stream);
|
streamProxyService.stop(app,stream);
|
||||||
@ -109,7 +110,7 @@ public class MediaController {
|
|||||||
streamInfo = mediaService.getStreamInfoByAppAndStreamWithCheck(app, stream, mediaServerId, authority);
|
streamInfo = mediaService.getStreamInfoByAppAndStreamWithCheck(app, stream, mediaServerId, authority);
|
||||||
}
|
}
|
||||||
if (streamInfo != null){
|
if (streamInfo != null){
|
||||||
return streamInfo;
|
return new StreamContent(streamInfo);
|
||||||
}else {
|
}else {
|
||||||
throw new ControllerException(ErrorCode.ERROR100);
|
throw new ControllerException(ErrorCode.ERROR100);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,8 +10,7 @@ import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
|||||||
import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog;
|
import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder;
|
import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
||||||
import com.genersoft.iot.vmp.service.IPlatformChannelService;
|
import com.genersoft.iot.vmp.service.*;
|
||||||
import com.genersoft.iot.vmp.service.IPlatformService;
|
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||||
@ -72,6 +71,12 @@ public class PlatformController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IPlatformService platformService;
|
private IPlatformService platformService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IDeviceChannelService deviceChannelService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IGbStreamService gbStreamService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取国标服务的配置
|
* 获取国标服务的配置
|
||||||
*
|
*
|
||||||
@ -379,7 +384,16 @@ public class PlatformController {
|
|||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("给上级平台添加国标通道API调用");
|
logger.debug("给上级平台添加国标通道API调用");
|
||||||
}
|
}
|
||||||
int result = platformChannelService.updateChannelForGB(param.getPlatformId(), param.getChannelReduces(), param.getCatalogId());
|
int result = 0;
|
||||||
|
if (param.getChannelReduces() == null || param.getChannelReduces().size() == 0) {
|
||||||
|
if (param.isAll()) {
|
||||||
|
logger.info("[国标级联]添加所有通道到上级平台, {}", param.getPlatformId());
|
||||||
|
List<ChannelReduce> allChannelForDevice = deviceChannelService.queryAllChannelList(param.getPlatformId());
|
||||||
|
result = platformChannelService.updateChannelForGB(param.getPlatformId(), allChannelForDevice, param.getCatalogId());
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
result = platformChannelService.updateChannelForGB(param.getPlatformId(), param.getChannelReduces(), param.getCatalogId());
|
||||||
|
}
|
||||||
if (result <= 0) {
|
if (result <= 0) {
|
||||||
throw new ControllerException(ErrorCode.ERROR100);
|
throw new ControllerException(ErrorCode.ERROR100);
|
||||||
}
|
}
|
||||||
@ -399,8 +413,15 @@ public class PlatformController {
|
|||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("给上级平台删除国标通道API调用");
|
logger.debug("给上级平台删除国标通道API调用");
|
||||||
}
|
}
|
||||||
int result = storager.delChannelForGB(param.getPlatformId(), param.getChannelReduces());
|
int result = 0;
|
||||||
|
if (param.getChannelReduces() == null || param.getChannelReduces().size() == 0) {
|
||||||
|
if (param.isAll()) {
|
||||||
|
logger.info("[国标级联]移除所有通道,上级平台, {}", param.getPlatformId());
|
||||||
|
result = platformChannelService.delAllChannelForGB(param.getPlatformId(), param.getCatalogId());
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
result = storager.delChannelForGB(param.getPlatformId(), param.getChannelReduces());
|
||||||
|
}
|
||||||
if (result <= 0) {
|
if (result <= 0) {
|
||||||
throw new ControllerException(ErrorCode.ERROR100);
|
throw new ControllerException(ErrorCode.ERROR100);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,9 @@ public class UpdateChannelParam {
|
|||||||
@Schema(description = "目录的国标编号")
|
@Schema(description = "目录的国标编号")
|
||||||
private String catalogId;
|
private String catalogId;
|
||||||
|
|
||||||
|
@Schema(description = "处理所有通道")
|
||||||
|
private boolean all;
|
||||||
|
|
||||||
@Schema(description = "")
|
@Schema(description = "")
|
||||||
private List<ChannelReduce> channelReduces;
|
private List<ChannelReduce> channelReduces;
|
||||||
|
|
||||||
@ -43,4 +46,12 @@ public class UpdateChannelParam {
|
|||||||
public void setCatalogId(String catalogId) {
|
public void setCatalogId(String catalogId) {
|
||||||
this.catalogId = catalogId;
|
this.catalogId = catalogId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isAll() {
|
||||||
|
return all;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAll(boolean all) {
|
||||||
|
this.all = all;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
|||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.DeferredResultEx;
|
import com.genersoft.iot.vmp.vmanager.bean.DeferredResultEx;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||||
|
import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
@ -80,8 +81,8 @@ public class PlayController {
|
|||||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||||
@GetMapping("/start/{deviceId}/{channelId}")
|
@GetMapping("/start/{deviceId}/{channelId}")
|
||||||
public DeferredResult<WVPResult<StreamInfo>> play(HttpServletRequest request, @PathVariable String deviceId,
|
public DeferredResult<WVPResult<StreamContent>> play(HttpServletRequest request, @PathVariable String deviceId,
|
||||||
@PathVariable String channelId) {
|
@PathVariable String channelId) {
|
||||||
|
|
||||||
// 获取可用的zlm
|
// 获取可用的zlm
|
||||||
Device device = storager.queryVideoDevice(deviceId);
|
Device device = storager.queryVideoDevice(deviceId);
|
||||||
@ -93,8 +94,8 @@ public class PlayController {
|
|||||||
msg.setKey(key);
|
msg.setKey(key);
|
||||||
String uuid = UUID.randomUUID().toString();
|
String uuid = UUID.randomUUID().toString();
|
||||||
msg.setId(uuid);
|
msg.setId(uuid);
|
||||||
DeferredResult<WVPResult<StreamInfo>> result = new DeferredResult<>(userSetting.getPlayTimeout().longValue());
|
DeferredResult<WVPResult<StreamContent>> result = new DeferredResult<>(userSetting.getPlayTimeout().longValue());
|
||||||
DeferredResultEx<WVPResult<StreamInfo>> deferredResultEx = new DeferredResultEx<>(result);
|
DeferredResultEx<WVPResult<StreamContent>> deferredResultEx = new DeferredResultEx<>(result);
|
||||||
|
|
||||||
result.onTimeout(()->{
|
result.onTimeout(()->{
|
||||||
logger.info("点播接口等待超时");
|
logger.info("点播接口等待超时");
|
||||||
@ -106,24 +107,24 @@ public class PlayController {
|
|||||||
resultHolder.invokeResult(msg);
|
resultHolder.invokeResult(msg);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (userSetting.getUseSourceIpAsStreamIp()) {
|
|
||||||
// TODO 在点播未成功的情况下在此调用接口点播会导致返回的流地址ip错误
|
// TODO 在点播未成功的情况下在此调用接口点播会导致返回的流地址ip错误
|
||||||
deferredResultEx.setFilter(result1 -> {
|
deferredResultEx.setFilter(result1 -> {
|
||||||
WVPResult<StreamInfo> wvpResult1 = (WVPResult<StreamInfo>)result1;
|
WVPResult<StreamInfo> wvpResult1 = (WVPResult<StreamInfo>)result1;
|
||||||
WVPResult<StreamInfo> clone = null;
|
WVPResult<StreamContent> resultStream = null;
|
||||||
try {
|
if (wvpResult1.getCode() == ErrorCode.SUCCESS.getCode()) {
|
||||||
clone = (WVPResult<StreamInfo>)wvpResult1.clone();
|
StreamInfo data = wvpResult1.getData().clone();
|
||||||
} catch (CloneNotSupportedException e) {
|
if (userSetting.getUseSourceIpAsStreamIp()) {
|
||||||
throw new RuntimeException(e);
|
data.channgeStreamIp(request.getLocalName());
|
||||||
|
}
|
||||||
|
resultStream = new WVPResult<>();
|
||||||
|
resultStream.setCode(wvpResult1.getCode());
|
||||||
|
resultStream.setMsg(wvpResult1.getMsg());
|
||||||
|
resultStream.setData(new StreamContent(wvpResult1.getData()));
|
||||||
}
|
}
|
||||||
if (clone.getCode() == ErrorCode.SUCCESS.getCode()) {
|
return resultStream;
|
||||||
StreamInfo data = clone.getData().clone();
|
|
||||||
data.channgeStreamIp(request.getLocalName());
|
|
||||||
clone.setData(data);
|
|
||||||
}
|
|
||||||
return clone;
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
// 录像查询以channelId作为deviceId查询
|
// 录像查询以channelId作为deviceId查询
|
||||||
resultHolder.put(key, uuid, deferredResultEx);
|
resultHolder.put(key, uuid, deferredResultEx);
|
||||||
@ -134,7 +135,6 @@ public class PlayController {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Operation(summary = "停止点播")
|
@Operation(summary = "停止点播")
|
||||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||||
@ -171,7 +171,6 @@ public class PlayController {
|
|||||||
json.put("deviceId", deviceId);
|
json.put("deviceId", deviceId);
|
||||||
json.put("channelId", channelId);
|
json.put("channelId", channelId);
|
||||||
return json;
|
return json;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
package com.genersoft.iot.vmp.vmanager.streamProxy;
|
package com.genersoft.iot.vmp.vmanager.streamProxy;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
|
||||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.service.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.IStreamProxyService;
|
import com.genersoft.iot.vmp.service.IStreamProxyService;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||||
|
import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
@ -58,7 +58,7 @@ public class StreamProxyController {
|
|||||||
})
|
})
|
||||||
@PostMapping(value = "/save")
|
@PostMapping(value = "/save")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public StreamInfo save(@RequestBody StreamProxyItem param){
|
public StreamContent save(@RequestBody StreamProxyItem param){
|
||||||
logger.info("添加代理: " + JSONObject.toJSONString(param));
|
logger.info("添加代理: " + JSONObject.toJSONString(param));
|
||||||
if (ObjectUtils.isEmpty(param.getMediaServerId())) {
|
if (ObjectUtils.isEmpty(param.getMediaServerId())) {
|
||||||
param.setMediaServerId("auto");
|
param.setMediaServerId("auto");
|
||||||
@ -69,7 +69,7 @@ public class StreamProxyController {
|
|||||||
if (ObjectUtils.isEmpty(param.getGbId())) {
|
if (ObjectUtils.isEmpty(param.getGbId())) {
|
||||||
param.setGbId(null);
|
param.setGbId(null);
|
||||||
}
|
}
|
||||||
return streamProxyService.save(param);
|
return new StreamContent(streamProxyService.save(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/ffmpeg_cmd/list")
|
@GetMapping(value = "/ffmpeg_cmd/list")
|
||||||
@ -109,7 +109,6 @@ public class StreamProxyController {
|
|||||||
logger.info("启用代理: " + app + "/" + stream);
|
logger.info("启用代理: " + app + "/" + stream);
|
||||||
boolean result = streamProxyService.start(app, stream);
|
boolean result = streamProxyService.start(app, stream);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
logger.info("启用代理失败: " + app + "/" + stream);
|
|
||||||
throw new ControllerException(ErrorCode.ERROR100);
|
throw new ControllerException(ErrorCode.ERROR100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,22 +11,16 @@ import com.genersoft.iot.vmp.conf.security.dto.LoginUser;
|
|||||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
|
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
|
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
|
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.service.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.IMediaService;
|
import com.genersoft.iot.vmp.service.IMediaService;
|
||||||
import com.genersoft.iot.vmp.service.IStreamPushService;
|
import com.genersoft.iot.vmp.service.IStreamPushService;
|
||||||
import com.genersoft.iot.vmp.service.impl.StreamPushUploadFileHandler;
|
import com.genersoft.iot.vmp.service.impl.StreamPushUploadFileHandler;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.BatchGBStreamParam;
|
import com.genersoft.iot.vmp.vmanager.bean.*;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto;
|
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.apache.poi.sl.usermodel.Sheet;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -34,12 +28,10 @@ import org.springframework.http.HttpStatus;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.context.request.async.DeferredResult;
|
import org.springframework.web.context.request.async.DeferredResult;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -243,8 +235,8 @@ public class StreamPushController {
|
|||||||
@Parameter(name = "app", description = "应用名", required = true)
|
@Parameter(name = "app", description = "应用名", required = true)
|
||||||
@Parameter(name = "stream", description = "流id", required = true)
|
@Parameter(name = "stream", description = "流id", required = true)
|
||||||
@Parameter(name = "mediaServerId", description = "媒体服务器id")
|
@Parameter(name = "mediaServerId", description = "媒体服务器id")
|
||||||
public StreamInfo getPlayUrl(@RequestParam String app,@RequestParam String stream,
|
public StreamContent getPlayUrl(@RequestParam String app, @RequestParam String stream,
|
||||||
@RequestParam(required = false) String mediaServerId){
|
@RequestParam(required = false) String mediaServerId){
|
||||||
boolean authority = false;
|
boolean authority = false;
|
||||||
// 是否登陆用户, 登陆用户返回完整信息
|
// 是否登陆用户, 登陆用户返回完整信息
|
||||||
LoginUser userInfo = SecurityUtils.getUserInfo();
|
LoginUser userInfo = SecurityUtils.getUserInfo();
|
||||||
@ -259,7 +251,7 @@ public class StreamPushController {
|
|||||||
if (streamInfo == null){
|
if (streamInfo == null){
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "获取播放地址失败");
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "获取播放地址失败");
|
||||||
}
|
}
|
||||||
return streamInfo;
|
return new StreamContent(streamInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -12,7 +12,6 @@ import com.genersoft.iot.vmp.service.IDeviceService;
|
|||||||
import com.genersoft.iot.vmp.service.IPlayService;
|
import com.genersoft.iot.vmp.service.IPlayService;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||||
import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.PlayResult;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -120,12 +119,12 @@ public class ApiStreamController {
|
|||||||
result.put("ChannelID", code);
|
result.put("ChannelID", code);
|
||||||
result.put("ChannelName", deviceChannel.getName());
|
result.put("ChannelName", deviceChannel.getName());
|
||||||
result.put("ChannelCustomName", "");
|
result.put("ChannelCustomName", "");
|
||||||
result.put("FLV", streamInfo.getFlv());
|
result.put("FLV", streamInfo.getFlv().getUrl());
|
||||||
result.put("WS_FLV", streamInfo.getWs_flv());
|
result.put("WS_FLV", streamInfo.getWs_flv().getUrl());
|
||||||
result.put("RTMP", streamInfo.getRtmp());
|
result.put("RTMP", streamInfo.getRtmp().getUrl());
|
||||||
result.put("HLS", streamInfo.getHls());
|
result.put("HLS", streamInfo.getHls().getUrl());
|
||||||
result.put("RTSP", streamInfo.getRtsp());
|
result.put("RTSP", streamInfo.getRtsp().getUrl());
|
||||||
result.put("WEBRTC", streamInfo.getRtc());
|
result.put("WEBRTC", streamInfo.getRtc().getUrl());
|
||||||
result.put("CDN", "");
|
result.put("CDN", "");
|
||||||
result.put("SnapURL", "");
|
result.put("SnapURL", "");
|
||||||
result.put("Transport", device.getTransport());
|
result.put("Transport", device.getTransport());
|
||||||
|
|||||||
@ -150,8 +150,6 @@ media:
|
|||||||
enable: true
|
enable: true
|
||||||
# [可选] 在此范围内选择端口用于媒体流传输, 必须提前在zlm上配置该属性,不然自动配置此属性可能不成功
|
# [可选] 在此范围内选择端口用于媒体流传输, 必须提前在zlm上配置该属性,不然自动配置此属性可能不成功
|
||||||
port-range: 30000,30500 # 端口范围
|
port-range: 30000,30500 # 端口范围
|
||||||
# [可选] 国标级联在此范围内选择端口发送媒体流
|
|
||||||
send-port-range: 30000,30500 # 端口范围
|
|
||||||
# 录像辅助服务, 部署此服务可以实现zlm录像的管理与下载, 0 表示不使用
|
# 录像辅助服务, 部署此服务可以实现zlm录像的管理与下载, 0 表示不使用
|
||||||
record-assist-port: 0
|
record-assist-port: 0
|
||||||
|
|
||||||
@ -186,7 +184,7 @@ user-settings:
|
|||||||
logInDatebase: true
|
logInDatebase: true
|
||||||
# 使用推流状态作为推流通道状态
|
# 使用推流状态作为推流通道状态
|
||||||
use-pushing-as-status: true
|
use-pushing-as-status: true
|
||||||
# 使用来源请求ip作为streamIp
|
# 使用来源请求ip作为streamIp,当且仅当你只有zlm节点它与wvp在一起的情况下开启
|
||||||
use-source-ip-as-stream-ip: true
|
use-source-ip-as-stream-ip: true
|
||||||
# 按需拉流, true:有人观看拉流,无人观看释放, false:拉起后不自动释放
|
# 按需拉流, true:有人观看拉流,无人观看释放, false:拉起后不自动释放
|
||||||
stream-on-demand: true
|
stream-on-demand: true
|
||||||
@ -195,6 +193,10 @@ user-settings:
|
|||||||
# 国标级联发流严格模式,严格模式会使用与sdp信息中一致的端口发流,端口共享media.rtp.port-range,这会损失一些性能,
|
# 国标级联发流严格模式,严格模式会使用与sdp信息中一致的端口发流,端口共享media.rtp.port-range,这会损失一些性能,
|
||||||
# 非严格模式使用随机端口发流,性能更好, 默认关闭
|
# 非严格模式使用随机端口发流,性能更好, 默认关闭
|
||||||
gb-send-stream-strict: false
|
gb-send-stream-strict: false
|
||||||
|
# 设备上线时是否自动同步通道
|
||||||
|
sync-channel-on-device-online: false
|
||||||
|
# 设备上线时是否自动同步通道
|
||||||
|
sip-use-source-ip-as-remote-address: true
|
||||||
|
|
||||||
# 关闭在线文档(生产环境建议关闭)
|
# 关闭在线文档(生产环境建议关闭)
|
||||||
springdoc:
|
springdoc:
|
||||||
|
|||||||
@ -207,7 +207,7 @@ export default {
|
|||||||
console.log("刷新对应设备:" + itemData.deviceId);
|
console.log("刷新对应设备:" + itemData.deviceId);
|
||||||
let that = this;
|
let that = this;
|
||||||
this.$axios({
|
this.$axios({
|
||||||
method: 'post',
|
method: 'get',
|
||||||
url: '/api/device/query/devices/' + itemData.deviceId + '/sync'
|
url: '/api/device/query/devices/' + itemData.deviceId + '/sync'
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
console.log("刷新设备结果:" + JSON.stringify(res));
|
console.log("刷新设备结果:" + JSON.stringify(res));
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
<el-table-column label="类型" width="100" >
|
<el-table-column label="类型" width="100" >
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<div slot="reference" class="name-wrapper">
|
<div slot="reference" class="name-wrapper">
|
||||||
<el-tag size="medium">{{scope.row.type}}</el-tag>
|
<el-tag size="medium">{{scope.row.type === "default"? "直接代理":"FFMPEG代理"}}</el-tag>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@ -55,15 +55,15 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="createTime" label="创建时间" min-width="150" show-overflow-tooltip/>
|
<el-table-column prop="createTime" label="创建时间" min-width="150" show-overflow-tooltip/>
|
||||||
<el-table-column label="转HLS" min-width="120" >
|
<el-table-column label="音频" min-width="120" >
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<div slot="reference" class="name-wrapper">
|
<div slot="reference" class="name-wrapper">
|
||||||
<el-tag size="medium" v-if="scope.row.enable_hls">已启用</el-tag>
|
<el-tag size="medium" v-if="scope.row.enable_audio">已启用</el-tag>
|
||||||
<el-tag size="medium" type="info" v-if="!scope.row.enable_hls">未启用</el-tag>
|
<el-tag size="medium" type="info" v-if="!scope.row.enable_audio">未启用</el-tag>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="MP4录制" min-width="120" >
|
<el-table-column label="录制" min-width="120" >
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<div slot="reference" class="name-wrapper">
|
<div slot="reference" class="name-wrapper">
|
||||||
<el-tag size="medium" v-if="scope.row.enable_mp4">已启用</el-tag>
|
<el-tag size="medium" v-if="scope.row.enable_mp4">已启用</el-tag>
|
||||||
@ -71,11 +71,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="无人观看自动删除" min-width="160" >
|
<el-table-column label="无人观看" min-width="160" >
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<div slot="reference" class="name-wrapper">
|
<div slot="reference" class="name-wrapper">
|
||||||
<el-tag size="medium" v-if="scope.row.enable_remove_none_reader">已启用</el-tag>
|
<el-tag size="medium" v-if="scope.row.enable_remove_none_reader">移除</el-tag>
|
||||||
<el-tag size="medium" type="info" v-if="!scope.row.enable_remove_none_reader">未启用</el-tag>
|
<el-tag size="medium" v-if="scope.row.enable_disable_none_reader">停用</el-tag>
|
||||||
|
<el-tag size="medium" type="info" v-if="!scope.row.enable_remove_none_reader && !scope.row.enable_disable_none_reader">不做处理</el-tag>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@ -131,7 +132,6 @@
|
|||||||
currentPage:1,
|
currentPage:1,
|
||||||
count:15,
|
count:15,
|
||||||
total:0,
|
total:0,
|
||||||
getListLoading: false,
|
|
||||||
startBtnLoading: false
|
startBtnLoading: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -139,7 +139,7 @@
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initData();
|
this.initData();
|
||||||
this.updateLooper = setInterval(this.initData, 1000);
|
this.startUpdateList()
|
||||||
},
|
},
|
||||||
destroyed() {
|
destroyed() {
|
||||||
this.$destroy('videojs');
|
this.$destroy('videojs');
|
||||||
@ -149,6 +149,12 @@
|
|||||||
initData: function() {
|
initData: function() {
|
||||||
this.getStreamProxyList();
|
this.getStreamProxyList();
|
||||||
},
|
},
|
||||||
|
stopUpdateList: function (){
|
||||||
|
window.clearInterval(this.updateLooper)
|
||||||
|
},
|
||||||
|
startUpdateList: function (){
|
||||||
|
this.updateLooper = setInterval(this.initData, 1000);
|
||||||
|
},
|
||||||
currentChange: function(val){
|
currentChange: function(val){
|
||||||
this.currentPage = val;
|
this.currentPage = val;
|
||||||
this.getStreamProxyList();
|
this.getStreamProxyList();
|
||||||
@ -159,7 +165,6 @@
|
|||||||
},
|
},
|
||||||
getStreamProxyList: function() {
|
getStreamProxyList: function() {
|
||||||
let that = this;
|
let that = this;
|
||||||
this.getListLoading = true;
|
|
||||||
this.$axios({
|
this.$axios({
|
||||||
method: 'get',
|
method: 'get',
|
||||||
url:`/api/proxy/list`,
|
url:`/api/proxy/list`,
|
||||||
@ -175,23 +180,18 @@
|
|||||||
}
|
}
|
||||||
that.streamProxyList = res.data.data.list;
|
that.streamProxyList = res.data.data.list;
|
||||||
}
|
}
|
||||||
that.getListLoading = false;
|
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
that.getListLoading = false;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
addStreamProxy: function(){
|
addStreamProxy: function(){
|
||||||
this.$refs.streamProxyEdit.openDialog(null, this.initData)
|
this.$refs.streamProxyEdit.openDialog(null, this.initData)
|
||||||
},
|
},
|
||||||
addOnvif: function(){
|
addOnvif: function(){
|
||||||
this.getListLoading = true;
|
|
||||||
this.getListLoading = true;
|
|
||||||
this.$axios({
|
this.$axios({
|
||||||
method: 'get',
|
method: 'get',
|
||||||
url:`/api/onvif/search?timeout=3000`,
|
url:`/api/onvif/search?timeout=3000`,
|
||||||
}).then((res) =>{
|
}).then((res) =>{
|
||||||
this.getListLoading = false;
|
|
||||||
if (res.data.code === 0 ){
|
if (res.data.code === 0 ){
|
||||||
if (res.data.data.length > 0) {
|
if (res.data.data.length > 0) {
|
||||||
this.$refs.onvifEdit.openDialog(res.data.data, (url)=>{
|
this.$refs.onvifEdit.openDialog(res.data.data, (url)=>{
|
||||||
@ -208,7 +208,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}).catch((error)=> {
|
}).catch((error)=> {
|
||||||
this.getListLoading = false;
|
|
||||||
this.$message.error(error.response.data.msg);
|
this.$message.error(error.response.data.msg);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -217,7 +216,6 @@
|
|||||||
},
|
},
|
||||||
play: function(row){
|
play: function(row){
|
||||||
let that = this;
|
let that = this;
|
||||||
this.getListLoading = true;
|
|
||||||
this.$axios({
|
this.$axios({
|
||||||
method: 'get',
|
method: 'get',
|
||||||
url:`/api/push/getPlayUrl`,
|
url:`/api/push/getPlayUrl`,
|
||||||
@ -227,7 +225,6 @@
|
|||||||
mediaServerId: row.mediaServerId
|
mediaServerId: row.mediaServerId
|
||||||
}
|
}
|
||||||
}).then(function (res) {
|
}).then(function (res) {
|
||||||
that.getListLoading = false;
|
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
that.$refs.devicePlayer.openDialog("streamPlay", null, null, {
|
that.$refs.devicePlayer.openDialog("streamPlay", null, null, {
|
||||||
streamInfo: res.data.data,
|
streamInfo: res.data.data,
|
||||||
@ -243,13 +240,11 @@
|
|||||||
|
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
that.getListLoading = false;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
deleteStreamProxy: function(row){
|
deleteStreamProxy: function(row){
|
||||||
let that = this;
|
let that = this;
|
||||||
this.getListLoading = true;
|
|
||||||
that.$axios({
|
that.$axios({
|
||||||
method:"delete",
|
method:"delete",
|
||||||
url:"/api/proxy/del",
|
url:"/api/proxy/del",
|
||||||
@ -258,16 +253,13 @@
|
|||||||
stream: row.stream
|
stream: row.stream
|
||||||
}
|
}
|
||||||
}).then((res)=>{
|
}).then((res)=>{
|
||||||
that.getListLoading = false;
|
|
||||||
that.initData()
|
that.initData()
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
that.getListLoading = false;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
start: function(row){
|
start: function(row){
|
||||||
let that = this;
|
this.stopUpdateList()
|
||||||
this.getListLoading = true;
|
|
||||||
this.$set(row, 'startBtnLoading', true)
|
this.$set(row, 'startBtnLoading', true)
|
||||||
this.$axios({
|
this.$axios({
|
||||||
method: 'get',
|
method: 'get',
|
||||||
@ -276,28 +268,31 @@
|
|||||||
app: row.app,
|
app: row.app,
|
||||||
stream: row.stream
|
stream: row.stream
|
||||||
}
|
}
|
||||||
}).then(function (res) {
|
}).then((res)=> {
|
||||||
that.getListLoading = false;
|
|
||||||
that.$set(row, 'startBtnLoading', false)
|
|
||||||
if (res.data.code === 0){
|
if (res.data.code === 0){
|
||||||
that.initData()
|
this.initData()
|
||||||
}else {
|
}else {
|
||||||
that.$message({
|
this.$message({
|
||||||
showClose: true,
|
showClose: true,
|
||||||
message: "保存失败,请检查地址是否可用!",
|
message: "启动失败,请检查地址是否可用!",
|
||||||
type: "error",
|
type: "error",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
this.$set(row, 'startBtnLoading', false)
|
||||||
}).catch(function (error) {
|
this.startUpdateList()
|
||||||
|
}).catch((error)=> {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
that.getListLoading = false;
|
this.$message({
|
||||||
that.$set(row, 'startBtnLoading', false)
|
showClose: true,
|
||||||
|
message: "启动失败,请检查地址是否可用!",
|
||||||
|
type: "error",
|
||||||
|
});
|
||||||
|
this.$set(row, 'startBtnLoading', false)
|
||||||
|
this.startUpdateList()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
stop: function(row){
|
stop: function(row){
|
||||||
let that = this;
|
let that = this;
|
||||||
this.getListLoading = true;
|
|
||||||
this.$axios({
|
this.$axios({
|
||||||
method: 'get',
|
method: 'get',
|
||||||
url:`/api/proxy/stop`,
|
url:`/api/proxy/stop`,
|
||||||
@ -306,11 +301,9 @@
|
|||||||
stream: row.stream
|
stream: row.stream
|
||||||
}
|
}
|
||||||
}).then(function (res) {
|
}).then(function (res) {
|
||||||
that.getListLoading = false;
|
|
||||||
that.initData()
|
that.initData()
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
that.getListLoading = false;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
refresh: function (){
|
refresh: function (){
|
||||||
|
|||||||
@ -83,31 +83,23 @@
|
|||||||
<el-option label="组播" value="2"></el-option>
|
<el-option label="组播" value="2"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="无人观看" prop="rtp_type" >
|
||||||
<el-form-item label="国标平台">
|
<el-select
|
||||||
<el-select
|
@change="noneReaderHandler"
|
||||||
v-model="proxyParam.platformGbId"
|
v-model="proxyParam.none_reader"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
placeholder="请选择国标平台"
|
placeholder="请选择无人观看的处理方式"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option label="不做处理" value="0"></el-option>
|
||||||
v-for="item in platformList"
|
<el-option label="停用" value="1"></el-option>
|
||||||
:key="item.name"
|
<el-option label="移除" value="2"></el-option>
|
||||||
:label="item.name"
|
</el-select>
|
||||||
:value="item.serverGBId">
|
</el-form-item>
|
||||||
<span style="float: left">{{ item.name }}</span>
|
|
||||||
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.serverGBId }}</span>
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="其他选项">
|
<el-form-item label="其他选项">
|
||||||
<div style="float: left;">
|
<div style="float: left;">
|
||||||
<el-checkbox label="启用" v-model="proxyParam.enable" ></el-checkbox>
|
<el-checkbox label="启用" v-model="proxyParam.enable" ></el-checkbox>
|
||||||
<el-checkbox label="转HLS" v-model="proxyParam.enable_hls" ></el-checkbox>
|
<el-checkbox label="开启音频" v-model="proxyParam.enable_audio" ></el-checkbox>
|
||||||
<el-checkbox label="MP4录制" v-model="proxyParam.enable_mp4" ></el-checkbox>
|
<el-checkbox label="录制" v-model="proxyParam.enable_mp4" ></el-checkbox>
|
||||||
<el-checkbox label="无人观看自动删除" v-model="proxyParam.enable_remove_none_reader" @change="removeNoneReader"></el-checkbox>
|
|
||||||
<el-checkbox label="无人观看停止拉流" v-model="proxyParam.enable_disable_none_reader" @change="disableNoneReaderHandType"></el-checkbox>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -169,10 +161,11 @@ export default {
|
|||||||
gbId: null,
|
gbId: null,
|
||||||
rtp_type: null,
|
rtp_type: null,
|
||||||
enable: true,
|
enable: true,
|
||||||
enable_hls: true,
|
enable_audio: true,
|
||||||
enable_mp4: false,
|
enable_mp4: false,
|
||||||
|
none_reader: null,
|
||||||
enable_remove_none_reader: false,
|
enable_remove_none_reader: false,
|
||||||
enable_disable_none_reader: true,
|
enable_disable_none_reader: false,
|
||||||
platformGbId: null,
|
platformGbId: null,
|
||||||
mediaServerId: null,
|
mediaServerId: null,
|
||||||
},
|
},
|
||||||
@ -196,6 +189,7 @@ export default {
|
|||||||
this.listChangeCallback = callback;
|
this.listChangeCallback = callback;
|
||||||
if (proxyParam != null) {
|
if (proxyParam != null) {
|
||||||
this.proxyParam = proxyParam;
|
this.proxyParam = proxyParam;
|
||||||
|
this.proxyParam.none_reader = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
let that = this;
|
let that = this;
|
||||||
@ -233,26 +227,26 @@ export default {
|
|||||||
},
|
},
|
||||||
onSubmit: function () {
|
onSubmit: function () {
|
||||||
this.dialogLoading = true;
|
this.dialogLoading = true;
|
||||||
var that = this;
|
this.noneReaderHandler();
|
||||||
that.$axios({
|
this.$axios({
|
||||||
method: 'post',
|
method: 'post',
|
||||||
url:`/api/proxy/save`,
|
url:`/api/proxy/save`,
|
||||||
data: that.proxyParam
|
data: this.proxyParam
|
||||||
}).then(function (res) {
|
}).then((res)=> {
|
||||||
that.dialogLoading = false;
|
this.dialogLoading = false;
|
||||||
if (typeof (res.data.code) != "undefined" && res.data.code === 0) {
|
if (typeof (res.data.code) != "undefined" && res.data.code === 0) {
|
||||||
that.$message({
|
this.$message({
|
||||||
showClose: true,
|
showClose: true,
|
||||||
message: res.data.msg,
|
message: res.data.msg,
|
||||||
type: "success",
|
type: "success",
|
||||||
});
|
});
|
||||||
that.showDialog = false;
|
this.showDialog = false;
|
||||||
if (that.listChangeCallback != null) {
|
if (this.listChangeCallback != null) {
|
||||||
that.listChangeCallback();
|
this.listChangeCallback();
|
||||||
that.dialogLoading = false;
|
this.dialogLoading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).catch(function (error) {
|
}).catch((error) =>{
|
||||||
console.log(error);
|
console.log(error);
|
||||||
this.dialogLoading = false;
|
this.dialogLoading = false;
|
||||||
});
|
});
|
||||||
@ -280,12 +274,18 @@ export default {
|
|||||||
this.platform.expires = "300";
|
this.platform.expires = "300";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
removeNoneReader: function(checked) {
|
noneReaderHandler: function() {
|
||||||
this.proxyParam.enable_disable_none_reader = !checked;
|
if (this.proxyParam.none_reader === null || this.proxyParam.none_reader === "0") {
|
||||||
|
this.proxyParam.enable_disable_none_reader = false;
|
||||||
|
this.proxyParam.enable_remove_none_reader = false;
|
||||||
|
}else if (this.proxyParam.none_reader === "1"){
|
||||||
|
this.proxyParam.enable_disable_none_reader = true;
|
||||||
|
this.proxyParam.enable_remove_none_reader = false;
|
||||||
|
}else if (this.proxyParam.none_reader ==="2"){
|
||||||
|
this.proxyParam.enable_disable_none_reader = false;
|
||||||
|
this.proxyParam.enable_remove_none_reader = true;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
disableNoneReaderHandType: function(checked) {
|
|
||||||
this.proxyParam.enable_remove_none_reader = !checked;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -63,37 +63,29 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (res.data.data != null) {
|
if (res.data.data != null) {
|
||||||
if (res.data.syncIng) {
|
if (res.data.data.syncIng) {
|
||||||
if (res.data.data.total == 0) {
|
if (res.data.data.total == 0) {
|
||||||
if (res.data.data.errorMsg !== null ){
|
this.msg = `等待同步中`;
|
||||||
this.msg = res.data.data.errorMsg;
|
this.timmer = setTimeout(this.getProgress, 300)
|
||||||
this.syncStatus = "exception"
|
}else {
|
||||||
}else {
|
this.total = res.data.data.total;
|
||||||
this.msg = `等待同步中`;
|
this.current = res.data.data.current;
|
||||||
this.timmer = setTimeout(this.getProgress, 300)
|
this.percentage = Math.floor(Number(res.data.data.current)/Number(res.data.data.total)* 10000)/100;
|
||||||
}
|
this.msg = `同步中...[${res.data.data.current}/${res.data.data.total}]`;
|
||||||
}else {
|
this.timmer = setTimeout(this.getProgress, 300)
|
||||||
if (res.data.data.total == res.data.data.current) {
|
|
||||||
this.syncStatus = "success"
|
|
||||||
this.percentage = 100;
|
|
||||||
this.msg = '同步成功';
|
|
||||||
}else {
|
|
||||||
if (res.data.data.errorMsg !== null ){
|
|
||||||
this.msg = res.data.data.errorMsg;
|
|
||||||
this.syncStatus = "exception"
|
|
||||||
}else {
|
|
||||||
this.total = res.data.data.total;
|
|
||||||
this.current = res.data.data.current;
|
|
||||||
this.percentage = Math.floor(Number(res.data.data.current)/Number(res.data.data.total)* 10000)/100;
|
|
||||||
this.msg = `同步中...[${res.data.data.current}/${res.data.data.total}]`;
|
|
||||||
this.timmer = setTimeout(this.getProgress, 300)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
this.syncStatus = "success"
|
if (res.data.data.errorMsg){
|
||||||
this.percentage = 100;
|
this.msg = res.data.data.errorMsg;
|
||||||
this.msg = '同步成功';
|
this.syncStatus = "exception"
|
||||||
|
}else {
|
||||||
|
this.syncStatus = "success"
|
||||||
|
this.percentage = 100;
|
||||||
|
this.msg = '同步成功';
|
||||||
|
setTimeout(()=>{
|
||||||
|
this.showDialog = false;
|
||||||
|
}, 3000)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
|
|||||||
@ -18,8 +18,10 @@
|
|||||||
<el-option label="在线" value="true"></el-option>
|
<el-option label="在线" value="true"></el-option>
|
||||||
<el-option label="离线" value="false"></el-option>
|
<el-option label="离线" value="false"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-button v-if="catalogId !== null" icon="el-icon-delete" size="mini" style="margin-right: 1rem;" :disabled="gbChannels.length === 0 || multipleSelection.length === 0" type="danger" @click="batchDel">批量移除</el-button>
|
<el-button v-if="catalogId !== null" icon="el-icon-delete" size="mini" :disabled="gbChannels.length === 0 || multipleSelection.length === 0" type="danger" @click="batchDel">批量移除</el-button>
|
||||||
<el-button v-if="catalogId === null" icon="el-icon-plus" size="mini" style="margin-right: 1rem;" :disabled="gbChannels.length === 0 || multipleSelection.length === 0" @click="batchAdd">批量添加</el-button>
|
<el-button v-if="catalogId === null" icon="el-icon-plus" size="mini" :disabled="gbChannels.length === 0 || multipleSelection.length === 0" @click="batchAdd">批量添加</el-button>
|
||||||
|
<el-button v-if="catalogId === null" icon="el-icon-plus" size="mini" @click="add()">全部添加</el-button>
|
||||||
|
<el-button v-if="catalogId !== null" type="danger" icon="el-icon-delete" size="mini" @click="remove()">全部移除</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-table ref="gbChannelsTable" :data="gbChannels" border style="width: 100%" :height="winHeight" :row-key="(row)=> row.deviceId + row.channelId" @selection-change="handleSelectionChange">
|
<el-table ref="gbChannelsTable" :data="gbChannels" border style="width: 100%" :height="winHeight" :row-key="(row)=> row.deviceId + row.channelId" @selection-change="handleSelectionChange">
|
||||||
@ -115,13 +117,15 @@ export default {
|
|||||||
this.initData();
|
this.initData();
|
||||||
},
|
},
|
||||||
add: function (row) {
|
add: function (row) {
|
||||||
|
let all = typeof(row) === "undefined"
|
||||||
this.getCatalogFromUser((catalogId)=> {
|
this.getCatalogFromUser((catalogId)=> {
|
||||||
this.$axios({
|
this.$axios({
|
||||||
method:"post",
|
method:"post",
|
||||||
url:"/api/platform/update_channel_for_gb",
|
url:"/api/platform/update_channel_for_gb",
|
||||||
data:{
|
data:{
|
||||||
platformId: this.platformId,
|
platformId: this.platformId,
|
||||||
channelReduces: [row],
|
all: all,
|
||||||
|
channelReduces: all?[]:[row],
|
||||||
catalogId: catalogId
|
catalogId: catalogId
|
||||||
}
|
}
|
||||||
}).then((res)=>{
|
}).then((res)=>{
|
||||||
@ -134,21 +138,34 @@ export default {
|
|||||||
|
|
||||||
},
|
},
|
||||||
remove: function (row) {
|
remove: function (row) {
|
||||||
console.log(row)
|
let all = typeof(row) === "undefined"
|
||||||
|
this.$confirm(`确定移除${all?"所有通道":""}吗?`, '提示', {
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
console.log(row)
|
||||||
|
|
||||||
|
this.$axios({
|
||||||
|
method:"delete",
|
||||||
|
url:"/api/platform/del_channel_for_gb",
|
||||||
|
data:{
|
||||||
|
platformId: this.platformId,
|
||||||
|
all: all,
|
||||||
|
channelReduces: all?[]:[row],
|
||||||
|
}
|
||||||
|
}).then((res)=>{
|
||||||
|
console.log("移除成功")
|
||||||
|
this.getChannelList();
|
||||||
|
}).catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
}).catch(() => {
|
||||||
|
|
||||||
this.$axios({
|
|
||||||
method:"delete",
|
|
||||||
url:"/api/platform/del_channel_for_gb",
|
|
||||||
data:{
|
|
||||||
platformId: this.platformId,
|
|
||||||
channelReduces: [row]
|
|
||||||
}
|
|
||||||
}).then((res)=>{
|
|
||||||
console.log("移除成功")
|
|
||||||
this.getChannelList();
|
|
||||||
}).catch(function (error) {
|
|
||||||
console.log(error);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
// checkedChange: function (val) {
|
// checkedChange: function (val) {
|
||||||
// let that = this;
|
// let that = this;
|
||||||
|
|||||||
@ -24,6 +24,8 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
<el-button v-if="catalogId !== null" icon="el-icon-delete" size="mini" style="margin-right: 1rem;" :disabled="gbStreams.length === 0 || multipleSelection.length === 0" type="danger" @click="batchDel">批量移除</el-button>
|
<el-button v-if="catalogId !== null" icon="el-icon-delete" size="mini" style="margin-right: 1rem;" :disabled="gbStreams.length === 0 || multipleSelection.length === 0" type="danger" @click="batchDel">批量移除</el-button>
|
||||||
<el-button v-if="catalogId === null" icon="el-icon-plus" size="mini" style="margin-right: 1rem;" :disabled="gbStreams.length === 0 || multipleSelection.length === 0" @click="batchAdd">批量添加</el-button>
|
<el-button v-if="catalogId === null" icon="el-icon-plus" size="mini" style="margin-right: 1rem;" :disabled="gbStreams.length === 0 || multipleSelection.length === 0" @click="batchAdd">批量添加</el-button>
|
||||||
|
<el-button v-if="catalogId === null" icon="el-icon-plus" size="mini" style="margin-right: 1rem;" @click="add()">全部添加</el-button>
|
||||||
|
<el-button v-if="catalogId !== null" type="danger" icon="el-icon-delete" size="mini" style="margin-right: 1rem;" @click="remove()">全部移除</el-button>
|
||||||
</div>
|
</div>
|
||||||
<el-table ref="gbStreamsTable" :data="gbStreams" border style="width: 100%" :height="winHeight" :row-key="(row)=> row.app + row.stream" @selection-change="handleSelectionChange">
|
<el-table ref="gbStreamsTable" :data="gbStreams" border style="width: 100%" :height="winHeight" :row-key="(row)=> row.app + row.stream" @selection-change="handleSelectionChange">
|
||||||
<el-table-column align="center" type="selection" :reserve-selection="true" width="55">
|
<el-table-column align="center" type="selection" :reserve-selection="true" width="55">
|
||||||
@ -128,6 +130,7 @@ export default {
|
|||||||
|
|
||||||
},
|
},
|
||||||
add: function (row, scope) {
|
add: function (row, scope) {
|
||||||
|
let all = typeof(row) === "undefined"
|
||||||
this.getCatalogFromUser((catalogId)=>{
|
this.getCatalogFromUser((catalogId)=>{
|
||||||
this.$axios({
|
this.$axios({
|
||||||
method:"post",
|
method:"post",
|
||||||
@ -135,7 +138,8 @@ export default {
|
|||||||
data:{
|
data:{
|
||||||
platformId: this.platformId,
|
platformId: this.platformId,
|
||||||
catalogId: catalogId,
|
catalogId: catalogId,
|
||||||
gbStreams: [row],
|
all: all,
|
||||||
|
gbStreams: all?[]:[row],
|
||||||
}
|
}
|
||||||
}).then((res)=>{
|
}).then((res)=>{
|
||||||
console.log("保存成功")
|
console.log("保存成功")
|
||||||
@ -149,20 +153,33 @@ export default {
|
|||||||
|
|
||||||
},
|
},
|
||||||
remove: function (row, scope) {
|
remove: function (row, scope) {
|
||||||
this.$axios({
|
let all = typeof(row) === "undefined"
|
||||||
method:"delete",
|
this.$confirm(`确定移除${all?"所有通道":""}吗?`, '提示', {
|
||||||
url:"/api/gbStream/del",
|
dangerouslyUseHTMLString: true,
|
||||||
data:{
|
confirmButtonText: '确定',
|
||||||
platformId: this.platformId,
|
cancelButtonText: '取消',
|
||||||
gbStreams: [row],
|
type: 'warning'
|
||||||
}
|
}).then(() => {
|
||||||
}).then((res)=>{
|
|
||||||
console.log("移除成功")
|
this.$axios({
|
||||||
// this.gbStreams.splice(scope.$index,1)
|
method:"delete",
|
||||||
this.getChannelList();
|
url:"/api/gbStream/del",
|
||||||
}).catch(function (error) {
|
data:{
|
||||||
console.log(error);
|
platformId: this.platformId,
|
||||||
|
all: all,
|
||||||
|
gbStreams: all?[]:[row],
|
||||||
|
}
|
||||||
|
}).then((res)=>{
|
||||||
|
console.log("移除成功")
|
||||||
|
// this.gbStreams.splice(scope.$index,1)
|
||||||
|
this.getChannelList();
|
||||||
|
}).catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
}).catch(() => {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
getChannelList: function () {
|
getChannelList: function () {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
|||||||
@ -53,93 +53,93 @@
|
|||||||
更多地址<i class="el-icon-arrow-down el-icon--right"></i>
|
更多地址<i class="el-icon-arrow-down el-icon--right"></i>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-dropdown-menu slot="dropdown" >
|
<el-dropdown-menu slot="dropdown" >
|
||||||
<el-dropdown-item :command="streamInfo.flv.url">
|
<el-dropdown-item v-if="streamInfo.flv" :command="streamInfo.flv">
|
||||||
<el-tag >FLV:</el-tag>
|
<el-tag >FLV:</el-tag>
|
||||||
<span>{{ streamInfo.flv.url }}</span>
|
<span>{{ streamInfo.flv }}</span>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item :command="streamInfo.https_flv.url">
|
<el-dropdown-item v-if="streamInfo.https_flv" :command="streamInfo.https_flv">
|
||||||
<el-tag >FLV(https):</el-tag>
|
<el-tag >FLV(https):</el-tag>
|
||||||
<span>{{ streamInfo.https_flv.url }}</span>
|
<span>{{ streamInfo.https_flv }}</span>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item :command="streamInfo.ws_flv.url">
|
<el-dropdown-item v-if="streamInfo.ws_flv" :command="streamInfo.ws_flv">
|
||||||
<el-tag >FLV(ws):</el-tag>
|
<el-tag >FLV(ws):</el-tag>
|
||||||
<span >{{ streamInfo.ws_flv.url }}</span>
|
<span >{{ streamInfo.ws_flv }}</span>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item :command="streamInfo.wss_flv.url">
|
<el-dropdown-item v-if="streamInfo.wss_flv" :command="streamInfo.wss_flv">
|
||||||
<el-tag >FLV(wss):</el-tag>
|
<el-tag >FLV(wss):</el-tag>
|
||||||
<span>{{ streamInfo.wss_flv.url }}</span>
|
<span>{{ streamInfo.wss_flv }}</span>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item :command="streamInfo.fmp4.url">
|
<el-dropdown-item v-if="streamInfo.fmp4" :command="streamInfo.fmp4">
|
||||||
<el-tag >FMP4:</el-tag>
|
<el-tag >FMP4:</el-tag>
|
||||||
<span>{{ streamInfo.fmp4.url }}</span>
|
<span>{{ streamInfo.fmp4 }}</span>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item :command="streamInfo.https_fmp4.url">
|
<el-dropdown-item v-if="streamInfo.https_fmp4" :command="streamInfo.https_fmp4">
|
||||||
<el-tag >FMP4(https):</el-tag>
|
<el-tag >FMP4(https):</el-tag>
|
||||||
<span>{{ streamInfo.https_fmp4.url }}</span>
|
<span>{{ streamInfo.https_fmp4 }}</span>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item :command="streamInfo.ws_fmp4.url">
|
<el-dropdown-item v-if="streamInfo.ws_fmp4" :command="streamInfo.ws_fmp4">
|
||||||
<el-tag >FMP4(ws):</el-tag>
|
<el-tag >FMP4(ws):</el-tag>
|
||||||
<span>{{ streamInfo.ws_fmp4.url }}</span>
|
<span>{{ streamInfo.ws_fmp4 }}</span>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item :command="streamInfo.wss_fmp4.url">
|
<el-dropdown-item v-if="streamInfo.wss_fmp4" :command="streamInfo.wss_fmp4">
|
||||||
<el-tag >FMP4(wss):</el-tag>
|
<el-tag >FMP4(wss):</el-tag>
|
||||||
<span>{{ streamInfo.wss_fmp4.url }}</span>
|
<span>{{ streamInfo.wss_fmp4 }}</span>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item :command="streamInfo.hls.url">
|
<el-dropdown-item v-if="streamInfo.hls" :command="streamInfo.hls">
|
||||||
<el-tag>HLS:</el-tag>
|
<el-tag>HLS:</el-tag>
|
||||||
<span>{{ streamInfo.hls.url }}</span>
|
<span>{{ streamInfo.hls }}</span>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item :command="streamInfo.https_hls.url">
|
<el-dropdown-item v-if="streamInfo.https_hls" :command="streamInfo.https_hls">
|
||||||
<el-tag >HLS(https):</el-tag>
|
<el-tag >HLS(https):</el-tag>
|
||||||
<span>{{ streamInfo.https_hls.url }}</span>
|
<span>{{ streamInfo.https_hls }}</span>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item :command="streamInfo.ws_hls.url">
|
<el-dropdown-item v-if="streamInfo.ws_hls" :command="streamInfo.ws_hls">
|
||||||
<el-tag >HLS(ws):</el-tag>
|
<el-tag >HLS(ws):</el-tag>
|
||||||
<span>{{ streamInfo.ws_hls.url }}</span>
|
<span>{{ streamInfo.ws_hls }}</span>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item :command="streamInfo.wss_hls.url">
|
<el-dropdown-item v-if="streamInfo.wss_hls" :command="streamInfo.wss_hls">
|
||||||
<el-tag >HLS(wss):</el-tag>
|
<el-tag >HLS(wss):</el-tag>
|
||||||
<span>{{ streamInfo.wss_hls.url }}</span>
|
<span>{{ streamInfo.wss_hls }}</span>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item :command="streamInfo.ts.url">
|
<el-dropdown-item v-if="streamInfo.ts" :command="streamInfo.ts">
|
||||||
<el-tag>TS:</el-tag>
|
<el-tag>TS:</el-tag>
|
||||||
<span>{{ streamInfo.ts.url }}</span>
|
<span>{{ streamInfo.ts }}</span>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item :command="streamInfo.https_ts.url">
|
<el-dropdown-item v-if="streamInfo.https_ts" :command="streamInfo.https_ts">
|
||||||
<el-tag>TS(https):</el-tag>
|
<el-tag>TS(https):</el-tag>
|
||||||
<span>{{ streamInfo.https_ts.url }}</span>
|
<span>{{ streamInfo.https_ts }}</span>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item :command="streamInfo.ws_ts.url">
|
<el-dropdown-item v-if="streamInfo.ws_ts" :command="streamInfo.ws_ts">
|
||||||
<el-tag>TS(ws):</el-tag>
|
<el-tag>TS(ws):</el-tag>
|
||||||
<span>{{ streamInfo.ws_ts.url }}</span>
|
<span>{{ streamInfo.ws_ts }}</span>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item :command="streamInfo.wss_ts.url">
|
<el-dropdown-item v-if="streamInfo.wss_ts" :command="streamInfo.wss_ts">
|
||||||
<el-tag>TS(wss):</el-tag>
|
<el-tag>TS(wss):</el-tag>
|
||||||
<span>{{ streamInfo.wss_ts.url }}</span>
|
<span>{{ streamInfo.wss_ts }}</span>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item :command="streamInfo.rtc.url">
|
<el-dropdown-item v-if="streamInfo.rtc" :command="streamInfo.rtc">
|
||||||
<el-tag >RTC:</el-tag>
|
<el-tag >RTC:</el-tag>
|
||||||
<span>{{ streamInfo.rtc.url }}</span>
|
<span>{{ streamInfo.rtc }}</span>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item :command="streamInfo.rtcs.url">
|
<el-dropdown-item v-if="streamInfo.rtcs" :command="streamInfo.rtcs">
|
||||||
<el-tag >RTCS:</el-tag>
|
<el-tag >RTCS:</el-tag>
|
||||||
<span>{{ streamInfo.rtcs }}</span>
|
<span>{{ streamInfo.rtcs }}</span>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item :command="streamInfo.rtmp.url">
|
<el-dropdown-item v-if="streamInfo.rtmp" :command="streamInfo.rtmp">
|
||||||
<el-tag >RTMP:</el-tag>
|
<el-tag >RTMP:</el-tag>
|
||||||
<span>{{ streamInfo.rtmp.url }}</span>
|
<span>{{ streamInfo.rtmp }}</span>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item :command="streamInfo.rtmps.url">
|
<el-dropdown-item v-if="streamInfo.rtmps" :command="streamInfo.rtmps">
|
||||||
<el-tag >RTMPS:</el-tag>
|
<el-tag >RTMPS:</el-tag>
|
||||||
<span>{{ streamInfo.rtmps.url }}</span>
|
<span>{{ streamInfo.rtmps }}</span>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item :command="streamInfo.rtsp.url">
|
<el-dropdown-item v-if="streamInfo.rtsp" :command="streamInfo.rtsp">
|
||||||
<el-tag >RTSP:</el-tag>
|
<el-tag >RTSP:</el-tag>
|
||||||
<span>{{ streamInfo.rtsp.url }}</span>
|
<span>{{ streamInfo.rtsp }}</span>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item :command="streamInfo.rtsps.url">
|
<el-dropdown-item v-if="streamInfo.rtsps" :command="streamInfo.rtsps">
|
||||||
<el-tag >RTSPS:</el-tag>
|
<el-tag >RTSPS:</el-tag>
|
||||||
<span>{{ streamInfo.rtsps.url }}</span>
|
<span>{{ streamInfo.rtsps }}</span>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
@ -450,9 +450,9 @@ export default {
|
|||||||
getUrlByStreamInfo(){
|
getUrlByStreamInfo(){
|
||||||
console.log(this.streamInfo)
|
console.log(this.streamInfo)
|
||||||
if (location.protocol === "https:") {
|
if (location.protocol === "https:") {
|
||||||
this.videoUrl = this.streamInfo[this.player[this.activePlayer][1]].url
|
this.videoUrl = this.streamInfo[this.player[this.activePlayer][1]]
|
||||||
}else {
|
}else {
|
||||||
this.videoUrl = this.streamInfo[this.player[this.activePlayer][0]].url
|
this.videoUrl = this.streamInfo[this.player[this.activePlayer][0]]
|
||||||
}
|
}
|
||||||
return this.videoUrl;
|
return this.videoUrl;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user