From d295f3c51271c26a5f65c0184bfa27fe1af80f54 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Tue, 18 Apr 2023 14:06:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=90=88=E5=B9=B6=E5=90=8E?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/genersoft/iot/vmp/common/StreamInfo.java | 4 ++-- .../iot/vmp/service/impl/PlayServiceImpl.java | 5 ++--- .../iot/vmp/web/gb28181/ApiDeviceController.java | 3 +-- src/main/resources/all-device-compatible.yml | 12 ++++++++++++ src/main/resources/application.yml | 12 +----------- src/main/resources/device-compatible.yml | 0 6 files changed, 18 insertions(+), 18 deletions(-) create mode 100644 src/main/resources/all-device-compatible.yml create mode 100644 src/main/resources/device-compatible.yml diff --git a/src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java b/src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java index a501dafa..80b97f22 100644 --- a/src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java +++ b/src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java @@ -237,11 +237,11 @@ 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, boolean isPlay) { if (callIdParam != null) { callIdParam = Objects.equals(callIdParam, "") ? callIdParam : callIdParam.replace("?", "&"); } - 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=%s%s", app, stream, isPlay?"play":"push", callIdParam); if (port > 0) { this.rtc = new StreamURL("http", host, port, file); } diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java index a67b951f..ad79c200 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java @@ -36,7 +36,6 @@ import com.genersoft.iot.vmp.service.redisMsg.RedisGbPlayMsgListener; 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.redis.RedisUtil; import com.genersoft.iot.vmp.vmanager.bean.AudioBroadcastResult; import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; import com.genersoft.iot.vmp.vmanager.bean.StreamContent; @@ -47,8 +46,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.stereotype.Service; import org.springframework.util.ObjectUtils; @@ -878,7 +877,7 @@ public class PlayServiceImpl implements IPlayService { // 关闭rtp server mediaServerService.closeRTPServer(mediaServerItem, ssrcInfo.getStream()); // 重新开启ssrc server - mediaServerService.openRTPServer(mediaServerItem, ssrcInfo.getStream(), ssrcInResponse, device.isSsrcCheck(), true, ssrcInfo.getPort()); + mediaServerService.openRTPServer(mediaServerItem, ssrcInfo.getStream(), ssrcInResponse, device.isSsrcCheck(), true, ssrcInfo.getPort(), false); } } } diff --git a/src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiDeviceController.java b/src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiDeviceController.java index 08f79bf4..3abec02b 100644 --- a/src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiDeviceController.java +++ b/src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiDeviceController.java @@ -18,7 +18,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.ObjectUtils; -import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @@ -128,7 +127,7 @@ public class ApiDeviceController { // } List deviceChannels; List channelIds = null; - if (!StringUtils.isEmpty(code)) { + if (!ObjectUtils.isEmpty(code)) { String[] split = code.trim().split(","); channelIds = Arrays.asList(split); } diff --git a/src/main/resources/all-device-compatible.yml b/src/main/resources/all-device-compatible.yml new file mode 100644 index 00000000..24d425de --- /dev/null +++ b/src/main/resources/all-device-compatible.yml @@ -0,0 +1,12 @@ +# 设备列表 + # 国标编号, 标识哪些设备使用这套兼容配置,优先级 id > model > manufacturer +- id: 88880000013200000888 + # 型号 + model: DH-P40A2-PV + # 生产商 + manufacturer: Dahua + # 收到ack消息后开始发流,默认false, 回复200ok后直接开始发流 + push-stream-after-ack: false + # 国标级联发流严格模式,严格模式会使用与sdp信息中一致的端口发流,端口共享media.rtp.port-range,这会损失一些性能, + # 非严格模式使用随机端口发流,性能更好, 默认关闭 + gb-send-stream-strict: false diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 4efb527d..c0615df6 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -3,14 +3,4 @@ spring: name: wvp profiles: active: local - # flayway相关配置 - flyway: - enabled: true #是否启用flyway(默认true) - locations: classpath:db/migration #这个路径指的是fly版本控制的sql语句存放的路径,可以多个,可以给每个环境使用不同位置,比如classpath:db/migration,classpath:test/db/migration - baseline-on-migrate: true #开启自动创建flyway元数据表标识 默认: false - # 与 baseline-on-migrate: true 搭配使用,将当前数据库初始版本设置为0 - baseline-version: 0 - clean-disabled: true #禁止flyway执行清理 - # 假如已经执行了版本1和版本3,如果增加了一个版本2,下面这个选项将会允许执行版本2的脚本 - out-of-order: true - table: flyway_schema_history_${spring.application.name} #用于记录所有的版本变化记录 \ No newline at end of file + include: device-compatible \ No newline at end of file diff --git a/src/main/resources/device-compatible.yml b/src/main/resources/device-compatible.yml new file mode 100644 index 00000000..e69de29b