Forráskód Böngészése

fix: 修复设备异常离线问题

kindring 1 éve
szülő
commit
303626ab6a

+ 2 - 0
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java

@@ -269,6 +269,8 @@ public class ZLMHttpHookListener {
             logger.info("[ZLM HOOK] 流注册, {}->{}->{}/{}", param.getMediaServerId(), param.getSchema(), param.getApp(), param.getStream());
         } else {
             logger.info("[ZLM HOOK] 流注销, {}->{}->{}/{}", param.getMediaServerId(), param.getSchema(), param.getApp(), param.getStream());
+            // todo 根据某些字段与设备在线状态, 判断是否需要重新拉流
+            // 判断是否需要重新拉流
         }
 
 

+ 2 - 1
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java

@@ -214,6 +214,7 @@ public class DeviceServiceImpl implements IDeviceService {
         List<SsrcTransaction> ssrcTransactions = streamSession.getSsrcTransactionForAll(deviceId, null, null, null);
         if (ssrcTransactions != null && ssrcTransactions.size() > 0) {
             for (SsrcTransaction ssrcTransaction : ssrcTransactions) {
+                logger.info("[设备离线] 释放ssrc: {}", ssrcTransaction);
                 mediaServerService.releaseSsrc(ssrcTransaction.getMediaServerId(), ssrcTransaction.getSsrc());
                 mediaServerService.closeRTPServer(ssrcTransaction.getMediaServerId(), ssrcTransaction.getStream());
                 streamSession.remove(deviceId, ssrcTransaction.getChannelId(), ssrcTransaction.getStream());
@@ -339,7 +340,7 @@ public class DeviceServiceImpl implements IDeviceService {
 
     @Override
     public boolean expire(Device device) {
-        Instant registerTimeDate = Instant.from(DateUtil.formatter.parse(device.getRegisterTime()));
+        Instant registerTimeDate = Instant.from(DateUtil.formatter.parse(device.getUpdateTime()));
         Instant expireInstant = registerTimeDate.plusMillis(TimeUnit.SECONDS.toMillis(device.getExpires()));
 //      // 多添加2分钟,用于心跳包更新
         expireInstant = expireInstant.plusMillis(TimeUnit.MINUTES.toMillis(2));

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java

@@ -784,7 +784,7 @@ public class PlayServiceImpl implements IPlayService {
                 logger.error("[录像流]回放超时 发送BYE失败 {}", e.getMessage());
             } catch (SsrcTransactionNotFoundException e) {
                 // 点播超时回复BYE 同时释放ssrc以及此次点播的资源
-                logger.info("回放超时")
+                logger.info("回放超时");
                 mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
                 mediaServerService.closeRTPServer(mediaServerItem.getId(), ssrcInfo.getStream());
                 streamSession.remove(deviceId, channelId, ssrcInfo.getStream());

+ 5 - 1
参考文档/数据库扩展.md

@@ -108,4 +108,8 @@
 | shareExpires | int    | 1 - 10 | 分享过期时间/分  默认5                  |
 | shareTime    | string | ''     | 分享码创建时间,时间戳,用于计算分享是否过期,主用户操作刷新 |
 | isShare      | int    | 1-3    | 分享状态, 0 未分享 1 分享中              |
-| playChannel  | string | ""     | 分享播放的通道编码,用于点进去直接播放            |
+| playChannel  | string | ""     | 分享播放的通道编码,用于点进去直接播放            |
+
+## 重播机制
+
+1. 设备端配置是否会在断开推流时重新连接服务端