648540858
2022-03-28 60278ee6ad692ed30d9766533345ca764a8870e2
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
@@ -188,7 +188,7 @@
      JSONObject ret = new JSONObject();
      ret.put("code", 0);
      ret.put("msg", "success");
      ret.put("enableHls", true);
      ret.put("enable_hls", true);
      String mediaServerId = json.getString("mediaServerId");
      ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_publish, json);
      if (subscribe != null) {
@@ -203,9 +203,9 @@
       String app = json.getString("app");
       String stream = json.getString("stream");
      if ("rtp".equals(app)) {
         ret.put("enableMP4", userSetup.getRecordSip());
         ret.put("enable_mp4", userSetup.getRecordSip());
      }else {
         ret.put("enableMP4", userSetup.isRecordPushLive());
         ret.put("enable_mp4", userSetup.isRecordPushLive());
      }
      List<SsrcTransaction> ssrcTransactionForAll = sessionManager.getSsrcTransactionForAll(null, null, null, stream);
      if (ssrcTransactionForAll != null && ssrcTransactionForAll.size() == 1) {
@@ -215,7 +215,16 @@
         if (deviceChannel != null) {
            ret.put("enable_audio", deviceChannel.isHasAudio());
         }
         // 如果是录像下载就设置视频间隔十秒
         if (ssrcTransactionForAll.get(0).getType() == VideoStreamSessionManager.SessionType.download) {
            ret.put("mp4_max_second", 10);
            ret.put("enable_mp4", true);
            ret.put("enable_audio", true);
         }
      }
      return new ResponseEntity<String>(ret.toString(), HttpStatus.OK);
   }
   
@@ -324,7 +333,6 @@
         if (mediaInfo != null) {
            subscribe.response(mediaInfo, json);
         }
      }
      // 流消失移除redis play
      String app = item.getApp();
@@ -441,6 +449,7 @@
      if ("rtp".equals(app)){
         ret.put("close", true);
         StreamInfo streamInfoForPlayCatch = redisCatchStorage.queryPlayByStreamId(streamId);
         SsrcTransaction ssrcTransaction = sessionManager.getSsrcTransaction(null, null, null, streamId);
         if (streamInfoForPlayCatch != null) {
            // 如果在给上级推流,也不停止。
            if (redisCatchStorage.isChannelSendingRTP(streamInfoForPlayCatch.getChannelId())) {