From 3469271ec25c69e4528b085ba3be7d9d85ec519e Mon Sep 17 00:00:00 2001
From: 64850858 <648540858@qq.com>
Date: Mon, 26 Jul 2021 11:40:32 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=9B=86=E7=BE=A4=E6=96=B9?=
=?UTF-8?q?=E6=A1=88=EF=BC=8C=20=E6=AF=8F=E4=B8=AAzlm=E4=B8=80=E5=A5=97ssr?=
=?UTF-8?q?c=EF=BC=9B=20=E4=BC=98=E5=8C=96=E9=9B=86=E7=BE=A4=E4=B8=8B?=
=?UTF-8?q?=E7=9A=84docker=E6=8E=A5=E5=85=A5=E9=80=BB=E8=BE=91=EF=BC=9B=20?=
=?UTF-8?q?=E6=9B=B4=E6=AD=A3sql=E8=84=9A=E6=9C=AC=EF=BC=9B=20=E6=94=AF?=
=?UTF-8?q?=E6=8C=81=E9=87=8D=E5=90=AF=E4=B8=8D=E8=AE=BE=E7=BD=AE=E8=AE=BE?=
=?UTF-8?q?=E5=A4=87=E7=A6=BB=E7=BA=BF=E3=80=82=E9=87=8D=E5=90=AFSIP?=
=?UTF-8?q?=E4=BA=8B=E5=8A=A1=E4=B8=8D=E4=B8=A2=E5=A4=B1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 7 +
sql/mysql.sql | 204 +++++-----
.../iot/vmp/common/VideoManagerConstants.java | 6 +
.../genersoft/iot/vmp/conf/MediaConfig.java | 188 +--------
.../iot/vmp/conf/ProxyServletConfig.java | 20 +-
.../genersoft/iot/vmp/conf/RedisConfig.java | 37 +-
.../iot/vmp/conf/SipDeviceRunner.java | 31 --
.../genersoft/iot/vmp/gb28181/SipLayer.java | 28 +-
.../iot/vmp/gb28181/bean/SsrcTransaction.java | 70 ++++
.../PlatformNotRegisterEventLister.java | 3 +-
.../iot/vmp/gb28181/session/SsrcConfig.java | 140 +++++++
.../iot/vmp/gb28181/session/SsrcUtil.java | 101 -----
.../session/VideoStreamSessionManager.java | 111 +++--
.../gb28181/transmit/SIPProcessorFactory.java | 2 +-
.../gb28181/transmit/cmd/ISIPCommander.java | 10 +-
.../transmit/cmd/impl/SIPCommander.java | 211 ++++------
.../request/impl/AckRequestProcessor.java | 3 +-
.../request/impl/ByeRequestProcessor.java | 3 +-
.../request/impl/InviteRequestProcessor.java | 5 +-
.../impl/InviteResponseProcessor.java | 14 +-
.../vmp/media/zlm/ZLMHttpHookListener.java | 24 +-
.../vmp/media/zlm/ZLMHttpHookSubscribe.java | 8 +-
.../vmp/media/zlm/ZLMMediaListManager.java | 9 +-
.../iot/vmp/media/zlm/ZLMRESTfulUtils.java | 45 +-
.../vmp/media/zlm/ZLMRTPServerFactory.java | 80 ++--
.../iot/vmp/media/zlm/ZLMRunner.java | 34 +-
.../vmp/media/zlm/dto/IMediaServerItem.java | 92 -----
.../vmp/media/zlm/dto/MediaServerItem.java | 54 ++-
.../iot/vmp/service/IMediaServerService.java | 30 +-
.../iot/vmp/service/IMediaService.java | 5 +-
.../iot/vmp/service/IPlayService.java | 9 +-
.../iot/vmp/service/IStreamProxyService.java | 3 +-
.../iot/vmp/service/IStreamPushService.java | 4 +-
.../iot/vmp/service/bean/SSRCInfo.java | 38 ++
.../service/impl/MediaServerServiceImpl.java | 385 ++++++++++--------
.../vmp/service/impl/MediaServiceImpl.java | 8 +-
.../iot/vmp/service/impl/PlayServiceImpl.java | 65 ++-
.../service/impl/StreamProxyServiceImpl.java | 9 +-
.../service/impl/StreamPushServiceImpl.java | 5 +-
.../iot/vmp/storager/IRedisCatchStorage.java | 2 -
.../vmp/storager/IVideoManagerStorager.java | 1 -
.../vmp/storager/dao/MediaServerMapper.java | 10 +-
.../storager/impl/RedisCatchStorageImpl.java | 3 -
.../genersoft/iot/vmp/utils/ConfigConst.java | 8 +
.../iot/vmp/utils/SerializeUtils.java | 31 ++
.../iot/vmp/utils/redis/JedisUtil.java | 97 +++++
.../iot/vmp/utils/redis/RedisUtil.java | 6 +-
.../vmanager/gb28181/play/PlayController.java | 25 +-
.../gb28181/playback/DownloadController.java | 14 +-
.../gb28181/playback/PlaybackController.java | 22 +-
.../gb28181/session/PlayTypeEnum.java | 23 ++
.../vmp/vmanager/server/ServerController.java | 24 +-
.../streamProxy/StreamProxyController.java | 4 +-
src/main/resources/all-application.yml | 7 +
src/main/resources/application-dev.yml | 2 +
src/main/resources/wvp.sqlite | Bin 126976 -> 126976 bytes
web_src/src/components/service/MediaServer.js | 2 +-
57 files changed, 1312 insertions(+), 1070 deletions(-)
delete mode 100644 src/main/java/com/genersoft/iot/vmp/conf/SipDeviceRunner.java
create mode 100644 src/main/java/com/genersoft/iot/vmp/gb28181/bean/SsrcTransaction.java
create mode 100644 src/main/java/com/genersoft/iot/vmp/gb28181/session/SsrcConfig.java
delete mode 100644 src/main/java/com/genersoft/iot/vmp/gb28181/session/SsrcUtil.java
delete mode 100644 src/main/java/com/genersoft/iot/vmp/media/zlm/dto/IMediaServerItem.java
create mode 100644 src/main/java/com/genersoft/iot/vmp/service/bean/SSRCInfo.java
create mode 100644 src/main/java/com/genersoft/iot/vmp/utils/ConfigConst.java
create mode 100644 src/main/java/com/genersoft/iot/vmp/utils/SerializeUtils.java
create mode 100644 src/main/java/com/genersoft/iot/vmp/utils/redis/JedisUtil.java
create mode 100644 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/session/PlayTypeEnum.java
diff --git a/pom.xml b/pom.xml
index 93b42579..077f8f13 100644
--- a/pom.xml
+++ b/pom.xml
@@ -46,6 +46,7 @@
UTF-8
MMddHHmm
3.1.1
+ 3.1.0
5.2.0
@@ -80,6 +81,12 @@
spring-boot-starter-security
+
+ redis.clients
+ jedis
+ ${jedis-version}
+
+
com.alibaba
diff --git a/sql/mysql.sql b/sql/mysql.sql
index 0bb4c03a..5d8bbfc8 100644
--- a/sql/mysql.sql
+++ b/sql/mysql.sql
@@ -1,112 +1,145 @@
-- auto-generated definition
-create schema wvp collate utf8_bin;
+
+
+CREATE DATABASE `wvp` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_bin */;
+
+use wvp;
create table device
(
- deviceId varchar(50) not null
+ deviceId varchar(50) not null
primary key,
- name varchar(255) null,
- manufacturer varchar(255) null,
- model varchar(255) null,
- firmware varchar(255) null,
- transport varchar(50) null,
- streamMode varchar(50) null,
- online varchar(50) null,
- registerTime varchar(50) null,
- keepaliveTime varchar(50) null,
- ip varchar(50) not null,
- createTime varchar(50) not null,
- updateTime varchar(50) not null,
- port int not null,
- expires int not null,
- hostAddress varchar(50) not null
+ name varchar(255) null,
+ manufacturer varchar(255) null,
+ model varchar(255) null,
+ firmware varchar(255) null,
+ transport varchar(50) null,
+ streamMode varchar(50) null,
+ online varchar(50) null,
+ registerTime varchar(50) null,
+ keepaliveTime varchar(50) null,
+ ip varchar(50) not null,
+ createTime varchar(50) not null,
+ updateTime varchar(50) not null,
+ port int not null,
+ expires int not null,
+ hostAddress varchar(50) not null
);
create table device_channel
(
- channelId varchar(50) not null,
+ channelId varchar(50) not null,
name varchar(255) null,
- manufacture varchar(50) null,
- model varchar(50) null,
- owner varchar(50) null,
- civilCode varchar(50) null,
- block varchar(50) null,
- address varchar(50) null,
- parentId varchar(50) null,
+ manufacture varchar(50) null,
+ model varchar(50) null,
+ owner varchar(50) null,
+ civilCode varchar(50) null,
+ block varchar(50) null,
+ address varchar(50) null,
+ parentId varchar(50) null,
safetyWay int null,
registerWay int null,
- certNum varchar(50) null,
+ certNum varchar(50) null,
certifiable int null,
errCode int null,
- endTime varchar(50) null,
- secrecy varchar(50) null,
- ipAddress varchar(50) null,
+ endTime varchar(50) null,
+ secrecy varchar(50) null,
+ ipAddress varchar(50) null,
port int null,
password varchar(255) null,
PTZType int null,
status int null,
longitude double null,
latitude double null,
- streamId varchar(50) null,
- deviceId varchar(50) not null,
- parental varchar(50) null,
- hasAudio bit(1) null,
- createTime varchar(50) not null,
- updateTime varchar(50) not null,
+ streamId varchar(50) null,
+ deviceId varchar(50) not null,
+ parental varchar(50) null,
+ hasAudio bit null,
+ createTime varchar(50) not null,
+ updateTime varchar(50) not null,
primary key (channelId, deviceId)
);
create table device_mobile_position
(
- deviceId varchar(50) not null,
+ deviceId varchar(50) not null,
deviceName varchar(255) null,
- time varchar(50) not null,
+ time varchar(50) not null,
longitude double not null,
latitude double not null,
altitude double null,
speed double null,
direction double null,
- reportSource varchar(50) null,
- geodeticSystem varchar(50) null,
- cnLng varchar(50) null,
- cnLat varchar(50) null,
+ reportSource varchar(50) null,
+ geodeticSystem varchar(50) null,
+ cnLng varchar(50) null,
+ cnLat varchar(50) null,
primary key (deviceId, time)
);
create table gb_stream
(
- app varchar(255) not null,
- stream varchar(255) not null,
- gbId varchar(50) not null,
- name varchar(255) null,
- longitude double null,
- latitude double null,
- streamType varchar(50) null,
- status int null,
+ app varchar(255) not null,
+ stream varchar(255) not null,
+ gbId varchar(50) not null,
+ name varchar(255) null,
+ longitude double null,
+ latitude double null,
+ streamType varchar(50) null,
+ mediaServerId varchar(50) null,
+ status int null,
primary key (app, stream, gbId)
);
+create table media_server
+(
+ id varchar(255) not null
+ primary key,
+ ip varchar(50) not null,
+ hookIp varchar(50) not null,
+ sdpIp varchar(50) not null,
+ streamIp varchar(50) not null,
+ httpPort int not null,
+ httpSSlPort int not null,
+ rtmpPort int not null,
+ rtmpSSlPort int not null,
+ rtpProxyPort int not null,
+ rtspPort int not null,
+ rtspSSLPort int not null,
+ autoConfig int not null,
+ secret varchar(50) not null,
+ streamNoneReaderDelayMS int not null,
+ rtpEnable int not null,
+ rtpPortRange varchar(50) not null,
+ recordAssistPort int not null,
+ defaultServer int not null,
+ createTime varchar(50) not null,
+ updateTime varchar(50) not null,
+ constraint media_server_i
+ unique (ip, httpPort)
+);
+
create table parent_platform
(
- id int auto_increment,
+ id int auto_increment,
enable int null,
name varchar(255) null,
- serverGBId varchar(50) not null,
- serverGBDomain varchar(50) null,
- serverIP varchar(50) null,
+ serverGBId varchar(50) not null,
+ serverGBDomain varchar(50) null,
+ serverIP varchar(50) null,
serverPort int null,
- deviceGBId varchar(50) not null,
- deviceIp varchar(50) null,
- devicePort varchar(50) null,
+ deviceGBId varchar(50) not null,
+ deviceIp varchar(50) null,
+ devicePort varchar(50) null,
username varchar(255) null,
- password varchar(50) null,
- expires varchar(50) null,
- keepTimeout varchar(50) null,
- transport varchar(50) null,
- characterSet varchar(50) null,
+ password varchar(50) null,
+ expires varchar(50) null,
+ keepTimeout varchar(50) null,
+ transport varchar(50) null,
+ characterSet varchar(50) null,
ptz int null,
rtcp int null,
- status bit(1) null,
+ status bit null,
primary key (id, serverGBId)
);
@@ -121,7 +154,7 @@ create table platform_gb_channel
create table platform_gb_stream
(
- platformId varchar(50) not null,
+ platformId varchar(50) not null,
app varchar(255) not null,
stream varchar(255) not null,
primary key (platformId, app, stream)
@@ -129,7 +162,7 @@ create table platform_gb_stream
create table stream_proxy
(
- type varchar(50) not null,
+ type varchar(50) not null,
app varchar(255) not null,
stream varchar(255) not null,
url varchar(255) null,
@@ -137,11 +170,12 @@ create table stream_proxy
dst_url varchar(255) null,
timeout_ms int null,
ffmpeg_cmd_key varchar(255) null,
- rtp_type varchar(50) null,
- mediaServerId varchar(50) null,
- enable_hls bit(1) null,
- enable_mp4 bit(1) null,
- enable bit(1) not null,
+ rtp_type varchar(50) null,
+ mediaServerId varchar(50) null,
+ enable_hls bit null,
+ enable_mp4 bit null,
+ enable bit not null,
+ createTime varchar(50) not null,
primary key (app, stream)
);
@@ -149,11 +183,12 @@ create table stream_push
(
app varchar(255) not null,
stream varchar(255) not null,
- totalReaderCount varchar(50) null,
+ totalReaderCount varchar(50) null,
originType int null,
- originTypeStr varchar(50) null,
+ originTypeStr varchar(50) null,
createStamp int null,
aliveSecond int null,
+ mediaServerId varchar(50) null,
primary key (app, stream)
);
@@ -164,31 +199,6 @@ create table user
username varchar(255) not null,
password varchar(255) not null,
roleId int not null,
- create_time varchar(50) not null
+ create_time varchar(50) not null
);
-insert into user (username, password, roleId, create_time) values ('admin', '21232f297a57a5a743894a0e4a801fc3', '0', '2021-04-13 14:14:57');
-
-create table media_server (
- id varchar(255)
- primary key,
- ip varchar(50) NOT NULL,
- hookIp varchar(50) NOT NULL,
- sdpIp varchar(50) NOT NULL,
- streamIp varchar(50) NOT NULL,
- httpPort int NOT NULL,
- httpSSlPort int NOT NULL,
- rtmpPort int NOT NULL,
- rtmpSSlPort int NOT NULL,
- rtpProxyPort int NOT NULL,
- rtspPort int NOT NULL,
- rtspSSLPort int NOT NULL,
- autoConfig int NOT NULL,
- secret varchar(50) NOT NULL,
- streamNoneReaderDelayMS int NOT NULL,
- rtpEnable int NOT NULL,
- rtpPortRange varchar(50) NOT NULL,
- recordAssistPort int NOT NULL,
- createTime varchar(50) not null,
- updateTime varchar(50) not null
-);
\ No newline at end of file
diff --git a/src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java b/src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java
index 57493143..cb2b1732 100644
--- a/src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java
+++ b/src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java
@@ -12,6 +12,8 @@ public class VideoManagerConstants {
public static final String MEDIA_SERVER_PREFIX = "VMP_MEDIA_SERVER_";
+ public static final String MEDIA_SERVERS_ONLINE_PREFIX = "VMP_MEDIA_ONLINE_SERVERS";
+
public static final String MEDIA_STREAM_PREFIX = "VMP_MEDIA_STREAM";
public static final String DEVICE_PREFIX = "VMP_DEVICE_";
@@ -45,4 +47,8 @@ public class VideoManagerConstants {
public static final String EVENT_OUTLINE_UNREGISTER = "1";
public static final String EVENT_OUTLINE_TIMEOUT = "2";
+
+ public static final String MEDIA_SSRC_USED_PREFIX = "VMP_media_used_ssrc_";
+
+ public static final String MEDIA_TRANSACTION_USED_PREFIX = "VMP_media_transaction_";
}
diff --git a/src/main/java/com/genersoft/iot/vmp/conf/MediaConfig.java b/src/main/java/com/genersoft/iot/vmp/conf/MediaConfig.java
index f2a0bcd0..744e56f0 100644
--- a/src/main/java/com/genersoft/iot/vmp/conf/MediaConfig.java
+++ b/src/main/java/com/genersoft/iot/vmp/conf/MediaConfig.java
@@ -1,13 +1,16 @@
package com.genersoft.iot.vmp.conf;
-import com.genersoft.iot.vmp.media.zlm.dto.IMediaServerItem;
+import com.genersoft.iot.vmp.gb28181.session.SsrcConfig;
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.StringUtils;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
@Configuration("mediaConfig")
-public class MediaConfig implements IMediaServerItem {
+public class MediaConfig{
@Value("${media.id:}")
private String id;
@@ -21,6 +24,9 @@ public class MediaConfig implements IMediaServerItem {
@Value("${sip.ip}")
private String sipIp;
+ @Value("${sip.domain}")
+ private String sipDomain;
+
@Value("${media.sdp-ip:${media.ip}}")
private String sdpIp;
@@ -66,31 +72,14 @@ public class MediaConfig implements IMediaServerItem {
@Value("${media.record-assist-port:0}")
private Integer recordAssistPort = 0;
- private String updateTime;
-
- private String createTime;
-
- private boolean docker = false;
-
- private int count;
-
-
public String getId() {
return id;
}
- public void setId(String id) {
- this.id = id;
- }
-
public String getIp() {
return ip;
}
- public void setIp(String ip) {
- this.ip = ip;
- }
-
public String getHookIp() {
if (StringUtils.isEmpty(hookIp)){
return sipIp;
@@ -100,78 +89,26 @@ public class MediaConfig implements IMediaServerItem {
}
- public void setHookIp(String hookIp) {
- this.hookIp = hookIp;
- }
-
public String getSipIp() {
return sipIp;
}
- public void setSipIp(String sipIp) {
- this.sipIp = sipIp;
- }
-
- public void setSdpIp(String sdpIp) {
- this.sdpIp = sdpIp;
- }
-
- public void setStreamIp(String streamIp) {
- this.streamIp = streamIp;
- }
-
public int getHttpPort() {
return httpPort;
}
- @Override
- public void setHttpPort(int httpPort) {
-
- }
-
- public void setHttpPort(Integer httpPort) {
- this.httpPort = httpPort;
- }
-
public int getHttpSSlPort() {
return httpSSlPort;
}
- @Override
- public void setHttpSSlPort(int httpSSlPort) {
-
- }
-
- public void setHttpSSlPort(Integer httpSSlPort) {
- this.httpSSlPort = httpSSlPort;
- }
-
public int getRtmpPort() {
return rtmpPort;
}
-
- @Override
- public void setRtmpPort(int rtmpPort) {
-
- }
-
- public void setRtmpPort(Integer rtmpPort) {
- this.rtmpPort = rtmpPort;
- }
-
+
public int getRtmpSSlPort() {
return rtmpSSlPort;
}
- @Override
- public void setRtmpSSlPort(int rtmpSSlPort) {
-
- }
-
- public void setRtmpSSlPort(Integer rtmpSSlPort) {
- this.rtmpSSlPort = rtmpSSlPort;
- }
-
public int getRtpProxyPort() {
if (rtpProxyPort == null) {
return 0;
@@ -181,104 +118,38 @@ public class MediaConfig implements IMediaServerItem {
}
- @Override
- public void setRtpProxyPort(int rtpProxyPort) {
-
- }
-
- public void setRtpProxyPort(Integer rtpProxyPort) {
- this.rtpProxyPort = rtpProxyPort;
- }
-
public int getRtspPort() {
return rtspPort;
}
- @Override
- public void setRtspPort(int rtspPort) {
-
- }
-
- public void setRtspPort(Integer rtspPort) {
- this.rtspPort = rtspPort;
- }
-
public int getRtspSSLPort() {
return rtspSSLPort;
}
- @Override
- public void setRtspSSLPort(int rtspSSLPort) {
-
- }
-
- public void setRtspSSLPort(Integer rtspSSLPort) {
- this.rtspSSLPort = rtspSSLPort;
- }
-
public boolean isAutoConfig() {
return autoConfig;
}
- public void setAutoConfig(boolean autoConfig) {
- this.autoConfig = autoConfig;
- }
-
public String getSecret() {
return secret;
}
- public void setSecret(String secret) {
- this.secret = secret;
- }
-
public String getStreamNoneReaderDelayMS() {
return streamNoneReaderDelayMS;
}
- public void setStreamNoneReaderDelayMS(String streamNoneReaderDelayMS) {
- this.streamNoneReaderDelayMS = streamNoneReaderDelayMS;
- }
-
public boolean isRtpEnable() {
return rtpEnable;
}
- public void setRtpEnable(boolean rtpEnable) {
- this.rtpEnable = rtpEnable;
- }
-
public String getRtpPortRange() {
return rtpPortRange;
}
-
- public void setRtpPortRange(String rtpPortRange) {
- this.rtpPortRange = rtpPortRange;
- }
-
+
public int getRecordAssistPort() {
return recordAssistPort;
}
- @Override
- public void setRecordAssistPort(int recordAssistPort) {
-
- }
-
- public void setRecordAssistPort(Integer recordAssistPort) {
- this.recordAssistPort = recordAssistPort;
- }
-
- @Override
- public boolean isDocker() {
- return docker;
- }
-
- @Override
- public void setDocker(boolean docker) {
- this.docker = docker;
- }
-
public String getSdpIp() {
if (StringUtils.isEmpty(sdpIp)){
return ip;
@@ -295,13 +166,11 @@ public class MediaConfig implements IMediaServerItem {
}
}
-
-
public MediaServerItem getMediaSerItem(){
MediaServerItem mediaServerItem = new MediaServerItem();
mediaServerItem.setId(id);
mediaServerItem.setIp(ip);
- mediaServerItem.setDocker(true);
+ mediaServerItem.setDefaultServer(true);
mediaServerItem.setHookIp(hookIp);
mediaServerItem.setSdpIp(sdpIp);
mediaServerItem.setStreamIp(streamIp);
@@ -318,39 +187,12 @@ public class MediaConfig implements IMediaServerItem {
mediaServerItem.setRtpEnable(rtpEnable);
mediaServerItem.setRtpPortRange(rtpPortRange);
mediaServerItem.setRecordAssistPort(recordAssistPort);
- mediaServerItem.setCreateTime(createTime);
- mediaServerItem.setUpdateTime(updateTime);
- mediaServerItem.setCount(count);
- return mediaServerItem;
- }
-
- @Override
- public String getUpdateTime() {
- return updateTime;
- }
- @Override
- public void setUpdateTime(String updateTime) {
- this.updateTime = updateTime;
- }
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ mediaServerItem.setCreateTime(format.format(new Date(System.currentTimeMillis())));
+ mediaServerItem.setUpdateTime(format.format(new Date(System.currentTimeMillis())));
- @Override
- public String getCreateTime() {
- return createTime;
- }
-
- @Override
- public void setCreateTime(String createTime) {
- this.createTime = createTime;
- }
-
- @Override
- public int getCount() {
- return count;
+ return mediaServerItem;
}
- @Override
- public void setCount(int count) {
- this.count = count;
- }
}
diff --git a/src/main/java/com/genersoft/iot/vmp/conf/ProxyServletConfig.java b/src/main/java/com/genersoft/iot/vmp/conf/ProxyServletConfig.java
index c2fb3262..ab327b0e 100644
--- a/src/main/java/com/genersoft/iot/vmp/conf/ProxyServletConfig.java
+++ b/src/main/java/com/genersoft/iot/vmp/conf/ProxyServletConfig.java
@@ -1,6 +1,6 @@
package com.genersoft.iot.vmp.conf;
-import com.genersoft.iot.vmp.media.zlm.dto.IMediaServerItem;
+import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
import com.genersoft.iot.vmp.service.IMediaServerService;
import org.apache.catalina.connector.ClientAbortException;
import org.apache.http.HttpHost;
@@ -49,7 +49,7 @@ public class ProxyServletConfig {
@Override
protected String rewriteQueryStringFromRequest(HttpServletRequest servletRequest, String queryString) {
String queryStr = super.rewriteQueryStringFromRequest(servletRequest, queryString);
- IMediaServerItem mediaInfo = getMediaInfoByUri(servletRequest.getRequestURI());
+ MediaServerItem mediaInfo = getMediaInfoByUri(servletRequest.getRequestURI());
if (mediaInfo != null) {
if (!StringUtils.isEmpty(queryStr)) {
queryStr += "&secret=" + mediaInfo.getSecret();
@@ -88,7 +88,7 @@ public class ProxyServletConfig {
@Override
protected String getTargetUri(HttpServletRequest servletRequest) {
String requestURI = servletRequest.getRequestURI();
- IMediaServerItem mediaInfo = getMediaInfoByUri(requestURI);
+ MediaServerItem mediaInfo = getMediaInfoByUri(requestURI);
String uri = null;
if (mediaInfo != null) {
@@ -106,7 +106,7 @@ public class ProxyServletConfig {
@Override
protected HttpHost getTargetHost(HttpServletRequest servletRequest) {
String requestURI = servletRequest.getRequestURI();
- IMediaServerItem mediaInfo = getMediaInfoByUri(requestURI);
+ MediaServerItem mediaInfo = getMediaInfoByUri(requestURI);
HttpHost host;
if (mediaInfo != null) {
host = new HttpHost(mediaInfo.getIp(), mediaInfo.getHttpPort());
@@ -120,7 +120,7 @@ public class ProxyServletConfig {
/**
* 根据uri获取流媒体信息
*/
- IMediaServerItem getMediaInfoByUri(String uri){
+ MediaServerItem getMediaInfoByUri(String uri){
String[] split = uri.split("/");
String mediaServerId = split[2];
return mediaServerService.getOne(mediaServerId);
@@ -132,7 +132,7 @@ public class ProxyServletConfig {
@Override
protected String rewriteUrlFromRequest(HttpServletRequest servletRequest) {
String requestURI = servletRequest.getRequestURI();
- IMediaServerItem mediaInfo = getMediaInfoByUri(requestURI);
+ MediaServerItem mediaInfo = getMediaInfoByUri(requestURI);
String url = super.rewriteUrlFromRequest(servletRequest);
if (mediaInfo == null) {
return url;
@@ -186,7 +186,7 @@ public class ProxyServletConfig {
@Override
protected String getTargetUri(HttpServletRequest servletRequest) {
String requestURI = servletRequest.getRequestURI();
- IMediaServerItem mediaInfo = getMediaInfoByUri(requestURI);
+ MediaServerItem mediaInfo = getMediaInfoByUri(requestURI);
String uri = null;
if (mediaInfo != null) {
@@ -204,7 +204,7 @@ public class ProxyServletConfig {
@Override
protected HttpHost getTargetHost(HttpServletRequest servletRequest) {
String requestURI = servletRequest.getRequestURI();
- IMediaServerItem mediaInfo = getMediaInfoByUri(requestURI);
+ MediaServerItem mediaInfo = getMediaInfoByUri(requestURI);
HttpHost host;
if (mediaInfo != null) {
host = new HttpHost(mediaInfo.getIp(), mediaInfo.getRecordAssistPort());
@@ -218,7 +218,7 @@ public class ProxyServletConfig {
/**
* 根据uri获取流媒体信息
*/
- IMediaServerItem getMediaInfoByUri(String uri){
+ MediaServerItem getMediaInfoByUri(String uri){
String[] split = uri.split("/");
String mediaServerId = split[2];
return mediaServerService.getOne(mediaServerId);
@@ -230,7 +230,7 @@ public class ProxyServletConfig {
@Override
protected String rewriteUrlFromRequest(HttpServletRequest servletRequest) {
String requestURI = servletRequest.getRequestURI();
- IMediaServerItem mediaInfo = getMediaInfoByUri(requestURI);
+ MediaServerItem mediaInfo = getMediaInfoByUri(requestURI);
String url = super.rewriteUrlFromRequest(servletRequest);
if (mediaInfo == null) {
return url;
diff --git a/src/main/java/com/genersoft/iot/vmp/conf/RedisConfig.java b/src/main/java/com/genersoft/iot/vmp/conf/RedisConfig.java
index 0b3e23be..ee907882 100644
--- a/src/main/java/com/genersoft/iot/vmp/conf/RedisConfig.java
+++ b/src/main/java/com/genersoft/iot/vmp/conf/RedisConfig.java
@@ -1,5 +1,7 @@
package com.genersoft.iot.vmp.conf;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -10,6 +12,8 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
import com.alibaba.fastjson.parser.ParserConfig;
import com.genersoft.iot.vmp.utils.redis.FastJsonRedisSerializer;
+import redis.clients.jedis.JedisPool;
+import redis.clients.jedis.JedisPoolConfig;
/**
* @Description:Redis中间件配置类,使用spring-data-redis集成,自动从application.yml中加载redis配置
@@ -20,6 +24,37 @@ import com.genersoft.iot.vmp.utils.redis.FastJsonRedisSerializer;
@Configuration
public class RedisConfig extends CachingConfigurerSupport {
+ @Value("${spring.redis.host}")
+ private String host;
+ @Value("${spring.redis.port}")
+ private int port;
+ @Value("${spring.redis.database}")
+ private int database;
+ @Value("${spring.redis.password}")
+ private String password;
+ @Value("${spring.redis.timeout}")
+ private int timeout;
+ @Value("${spring.redis.poolMaxTotal:1000}")
+ private int poolMaxTotal;
+ @Value("${spring.redis.poolMaxIdle:500}")
+ private int poolMaxIdle;
+ @Value("${spring.redis.poolMaxWait:5}")
+ private int poolMaxWait;
+
+ @Bean
+ public JedisPool jedisPool() {
+ if (StringUtils.isBlank(password)) {
+ password = null;
+ }
+ JedisPoolConfig poolConfig = new JedisPoolConfig();
+ poolConfig.setMaxIdle(poolMaxIdle);
+ poolConfig.setMaxTotal(poolMaxTotal);
+ // 秒转毫秒
+ poolConfig.setMaxWaitMillis(poolMaxWait * 1000L);
+ JedisPool jp = new JedisPool(poolConfig, host, port, timeout * 1000, password, database);
+ return jp;
+ }
+
@Bean("redisTemplate")
public RedisTemplate