Commit 8d6de7242957737e571f44503f686a8aa39e9b61

Authored by 648540858
1 parent dbdb9ca0

优化日志

README.md
... ... @@ -27,7 +27,7 @@ wvp使用文档 [https://doc.wvp-pro.cn](https://doc.wvp-pro.cn)
27 27 ZLM使用文档 [https://github.com/ZLMediaKit/ZLMediaKit](https://github.com/ZLMediaKit/ZLMediaKit)
28 28 > wvp文档由gitee提供服务,如果遇到打不开请多刷新几次。
29 29  
30   -# 社群地址
  30 +# 付费社群
31 31 [![社群](doc/_media/shequ.png "shequ")](https://t.zsxq.com/0d8VAD3Dm)
32 32 > 收费是为了提供更好的服务,也是对作者更大的激励。加入星球的用户三天后可以私信我留下微信号,我会拉大家入群。加入三天内不满意可以直接退款,大家不需要有顾虑,来白嫖三天也不是不可以。
33 33  
... ... @@ -105,6 +105,7 @@ https://gitee.com/pan648540858/wvp-GB28181-pro.git
105 105 - [X] 支持打包可执行jar和war
106 106 - [X] 支持跨域请求,支持前后端分离部署
107 107 - [X] 支持Mysql,Postgresql,金仓等数据库
  108 +- [X] 支持Onvif(目前在onvif分支,需要安装onvif服务,服务请在知识星球获取)
108 109  
109 110 # 授权协议
110 111 本项目自有代码使用宽松的MIT协议,在保留版权信息的情况下可以自由应用于各自商用、非商业的项目。 但是本项目也零碎的使用了一些其他的开源代码,在商用的情况下请自行替代或剔除; 由于使用本项目而产生的商业纠纷或侵权行为一概与本项目及开发者无关,请自行承担法律风险。 在使用本项目代码时,也应该在授权协议中同时表明本项目依赖的第三方库的协议
... ...
doc/README.md
... ... @@ -14,7 +14,7 @@
14 14 - 完全开源,且使用MIT许可协议。保留版权的情况下可以用于商业项目。
15 15 - 支持多流媒体节点负载均衡。
16 16  
17   -# 社群
  17 +# 付费社群
18 18 [![社群](_media/shequ.png "shequ")](https://t.zsxq.com/0d8VAD3Dm)
19 19 > 收费是为了提供更好的服务,也是对作者更大的激励。加入星球的用户三天后可以私信我留下微信号,我会拉大家入群。加入三天内不满意可以直接退款,大家不需要有顾虑,来白嫖三天也不是不可以。
20 20  
... ... @@ -62,16 +62,16 @@
62 62 - [X] 注册
63 63 - [X] 注销
64 64 - [X] 实时视音频点播
65   -- [ ] 设备控制
66   - - [ ] 云台控制
  65 +- [X] 设备控制
  66 + - [X] 云台控制
67 67 - [ ] 远程启动
68   - - [ ] 录像控制
69   - - [ ] 报警布防/撤防
70   - - [ ] 报警复位
71   - - [ ] 强制关键帧
72   - - [ ] 拉框放大
73   - - [ ] 拉框缩小
74   - - [ ] 看守位控制
  68 + - [X] 录像控制
  69 + - [X] 报警布防/撤防
  70 + - [X] 报警复位
  71 + - [X] 强制关键帧
  72 + - [X] 拉框放大
  73 + - [X] 拉框缩小
  74 + - [X] 看守位控制
75 75 - [ ] 设备配置
76 76 - [ ] 报警事件通知和分发
77 77 - [X] 设备目录订阅
... ... @@ -79,7 +79,7 @@
79 79 - [X] 设备目录查询
80 80 - [X] 设备状态查询
81 81 - [ ] 设备配置查询
82   - - [ ] 设备预置位查询
  82 + - [X] 设备预置位查询
83 83 - [X] 状态信息报送
84 84 - [X] 设备视音频文件检索
85 85 - [X] 历史视音频的回放
... ... @@ -87,7 +87,7 @@
87 87 - [x] 暂停
88 88 - [x] 进/退
89 89 - [x] 停止
90   -- [ ] 视音频文件下载
  90 +- [X] 视音频文件下载
91 91 - [ ] ~~校时~~
92 92 - [X] 订阅和通知
93 93 - [X] 事件订阅
... ...
doc/_media/1372762149.jpg 0 → 100644

126 KB

doc/_media/903207146.jpg 0 → 100644

131 KB

... ... @@ -11,7 +11,7 @@
11 11  
12 12 <groupId>com.genersoft</groupId>
13 13 <artifactId>wvp-pro</artifactId>
14   - <version>2.6.8</version>
  14 + <version>2.6.9</version>
15 15 <name>web video platform</name>
16 16 <description>国标28181视频平台</description>
17 17 <packaging>${project.packaging}</packaging>
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/session/SSRCFactory.java
1 1 package com.genersoft.iot.vmp.gb28181.session;
2 2  
3 3 import com.genersoft.iot.vmp.conf.SipConfig;
  4 +import com.genersoft.iot.vmp.conf.UserSetting;
4 5 import org.springframework.beans.factory.annotation.Autowired;
5 6 import org.springframework.data.redis.core.StringRedisTemplate;
6 7 import org.springframework.stereotype.Component;
... ... @@ -31,10 +32,13 @@ public class SSRCFactory {
31 32 @Autowired
32 33 private SipConfig sipConfig;
33 34  
  35 + @Autowired
  36 + private UserSetting userSetting;
  37 +
34 38  
35 39 public void initMediaServerSSRC(String mediaServerId, Set<String> usedSet) {
36 40 String ssrcPrefix = sipConfig.getDomain().substring(3, 8);
37   - String redisKey = SSRC_INFO_KEY + mediaServerId;
  41 + String redisKey = SSRC_INFO_KEY + userSetting.getServerId() + "_" + mediaServerId;
38 42 List<String> ssrcList = new ArrayList<>();
39 43 for (int i = 1; i < MAX_STREAM_COUNT; i++) {
40 44 String ssrc = String.format("%s%04d", ssrcPrefix, i);
... ... @@ -77,7 +81,7 @@ public class SSRCFactory {
77 81 return;
78 82 }
79 83 String sn = ssrc.substring(1);
80   - String redisKey = SSRC_INFO_KEY + mediaServerId;
  84 + String redisKey = SSRC_INFO_KEY + userSetting.getServerId() + "_" + mediaServerId;
81 85 redisTemplate.opsForSet().add(redisKey, sn);
82 86 }
83 87  
... ... @@ -86,7 +90,7 @@ public class SSRCFactory {
86 90 */
87 91 private String getSN(String mediaServerId) {
88 92 String sn = null;
89   - String redisKey = SSRC_INFO_KEY + mediaServerId;
  93 + String redisKey = SSRC_INFO_KEY + userSetting.getServerId() + "_" + mediaServerId;
90 94 Long size = redisTemplate.opsForSet().size(redisKey);
91 95 if (size == null || size == 0) {
92 96 throw new RuntimeException("ssrc已经用完");
... ... @@ -113,7 +117,7 @@ public class SSRCFactory {
113 117 * @param mediaServerId 流媒体服务ID
114 118 */
115 119 public boolean hasMediaServerSSRC(String mediaServerId) {
116   - String redisKey = SSRC_INFO_KEY + mediaServerId;
  120 + String redisKey = SSRC_INFO_KEY + userSetting.getServerId() + "_" + mediaServerId;
117 121 return redisTemplate.opsForSet().members(redisKey) != null;
118 122 }
119 123  
... ... @@ -126,7 +130,7 @@ public class SSRCFactory {
126 130 */
127 131 public boolean checkSsrc(String mediaServerId, String ssrc) {
128 132 String sn = ssrc.substring(1);
129   - String redisKey = SSRC_INFO_KEY + mediaServerId;
  133 + String redisKey = SSRC_INFO_KEY + userSetting.getServerId() + "_" + mediaServerId;
130 134 return redisTemplate.opsForSet().isMember(redisKey, sn) != null;
131 135 }
132 136 }
... ...
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
... ... @@ -188,7 +188,20 @@ public class PlayServiceImpl implements IPlayService {
188 188 null);
189 189 return;
190 190 }
191   - logger.info("[点播开始] deviceId: {}, channelId: {},收流端口:{}, 收流模式:{}, SSRC: {}, SSRC校验:{}", device.getDeviceId(), channelId, ssrcInfo.getPort(), device.getStreamMode(), ssrcInfo.getSsrc(), device.isSsrcCheck());
  191 + logger.info("\r\n" +
  192 + " [点播开始] \r\n" +
  193 + "deviceId : {}, \r\n" +
  194 + "channelId : {},\r\n" +
  195 + "收流端口 : {}, \r\n" +
  196 + "收流模式 : {}, \r\n" +
  197 + "SSRC : {}, \r\n" +
  198 + "SSRC校验 :{}",
  199 + device.getDeviceId(),
  200 + channelId,
  201 + ssrcInfo.getPort(),
  202 + device.getStreamMode(),
  203 + ssrcInfo.getSsrc(),
  204 + device.isSsrcCheck());
192 205  
193 206 //端口获取失败的ssrcInfo 没有必要发送点播指令
194 207 if (ssrcInfo.getPort() <= 0) {
... ... @@ -329,23 +342,13 @@ public class PlayServiceImpl implements IPlayService {
329 342 return;
330 343 }
331 344 logger.info("[点播消息] 收到invite 200, 发现下级自定义了ssrc: {}", ssrcInResponse);
  345 +
332 346 if (!mediaServerItem.isRtpEnable() || device.isSsrcCheck()) {
333 347 logger.info("[点播消息] SSRC修正 {}->{}", ssrcInfo.getSsrc(), ssrcInResponse);
334   - if (!ssrcFactory.checkSsrc(mediaServerItem.getId(),ssrcInResponse)) {
335   - // ssrc 不可用
336   - logger.info("[点播消息] SSRC修正时发现ssrc不可使用 {}->{}", ssrcInfo.getSsrc(), ssrcInResponse);
337   - // 释放ssrc
338   - ssrcFactory.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
339   - streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream());
340 348  
341   - callback.run(InviteErrorCode.ERROR_FOR_SSRC_UNAVAILABLE.getCode(),
342   - InviteErrorCode.ERROR_FOR_SSRC_UNAVAILABLE.getMsg(), null);
343   - inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channelId, null,
344   - InviteErrorCode.ERROR_FOR_SSRC_UNAVAILABLE.getCode(),
345   - InviteErrorCode.ERROR_FOR_SSRC_UNAVAILABLE.getMsg(), null);
  349 + // 释放ssrc
  350 + mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
346 351  
347   - return;
348   - }
349 352 // 单端口模式streamId也有变化,重新设置监听即可
350 353 if (!mediaServerItem.isRtpEnable()) {
351 354 // 添加订阅
... ... @@ -388,8 +391,6 @@ public class PlayServiceImpl implements IPlayService {
388 391 }
389 392  
390 393 dynamicTask.stop(timeOutTaskKey);
391   - // 释放ssrc
392   - mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
393 394  
394 395 streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream());
395 396  
... ... @@ -654,17 +655,8 @@ public class PlayServiceImpl implements IPlayService {
654 655 if (!mediaServerItem.isRtpEnable() || device.isSsrcCheck()) {
655 656 logger.info("[录像回放] SSRC修正 {}->{}", ssrcInfo.getSsrc(), ssrcInResponse);
656 657  
657   - if (!ssrcFactory.checkSsrc(mediaServerItem.getId(),ssrcInResponse)) {
658   - // ssrc 不可用
659   - logger.info("[录像回放] SSRC修正时发现ssrc不可使用 {}->{}", ssrcInfo.getSsrc(), ssrcInResponse);
660   - // 释放ssrc
661   - dynamicTask.stop(playBackTimeOutTaskKey);
662   - mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
663   - streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream());
664   - callback.run(InviteErrorCode.ERROR_FOR_SSRC_UNAVAILABLE.getCode(),
665   - InviteErrorCode.ERROR_FOR_SSRC_UNAVAILABLE.getMsg(), null);
666   - return;
667   - }
  658 + // 释放ssrc
  659 + mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
668 660  
669 661 // 单端口模式streamId也有变化,需要重新设置监听
670 662 if (!mediaServerItem.isRtpEnable()) {
... ... @@ -693,8 +685,6 @@ public class PlayServiceImpl implements IPlayService {
693 685 }
694 686  
695 687 dynamicTask.stop(playBackTimeOutTaskKey);
696   - // 释放ssrc
697   - mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
698 688  
699 689 streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream());
700 690  
... ... @@ -858,15 +848,8 @@ public class PlayServiceImpl implements IPlayService {
858 848 if (!mediaServerItem.isRtpEnable() || device.isSsrcCheck()) {
859 849 logger.info("[录像下载] SSRC修正 {}->{}", ssrcInfo.getSsrc(), ssrcInResponse);
860 850  
861   - if (!ssrcFactory.checkSsrc(mediaServerItem.getId(),ssrcInResponse)) {
862   - // ssrc 不可用
863   - // 释放ssrc
864   - mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
865   - streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream());
866   - callback.run(InviteErrorCode.ERROR_FOR_SSRC_UNAVAILABLE.getCode(),
867   - InviteErrorCode.ERROR_FOR_SSRC_UNAVAILABLE.getMsg(), null);
868   - return;
869   - }
  851 + // 释放ssrc
  852 + mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
870 853  
871 854 // 单端口模式streamId也有变化,需要重新设置监听
872 855 if (!mediaServerItem.isRtpEnable()) {
... ... @@ -892,8 +875,6 @@ public class PlayServiceImpl implements IPlayService {
892 875 }
893 876  
894 877 dynamicTask.stop(downLoadTimeOutTaskKey);
895   - // 释放ssrc
896   - mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
897 878  
898 879 streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream());
899 880  
... ...