From db2ccfedfa17eb3cb5ca73ac3b6bc4b5a05d4148 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期三, 19 四月 2023 11:09:26 +0800
Subject: [PATCH] 优化notify性能,增加notify超出处理能力时直接回复错误码,不做处理。

---
 src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
index 7a8ac98..b62e114 100644
--- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
@@ -116,7 +116,7 @@
     @PostMapping(value = "/on_server_keepalive", produces = "application/json;charset=UTF-8")
     public HookResult onServerKeepalive(@RequestBody OnServerKeepaliveHookParam param) {
 
-        logger.info("[ZLM HOOK] 鏀跺埌zlm蹇冭烦锛�" + param.getMediaServerId());
+//        logger.info("[ZLM HOOK] 鏀跺埌zlm蹇冭烦锛�" + param.getMediaServerId());
 
         taskExecutor.execute(() -> {
             List<ZlmHttpHookSubscribe.Event> subscribes = this.subscribe.getSubscribes(HookType.on_server_keepalive);
@@ -253,6 +253,24 @@
                 result.setEnable_mp4(true);
             }
         }
+        if (mediaInfo.getRecordAssistPort() > 0 && userSetting.getRecordPath() == null) {
+            logger.info("鎺ㄦ祦鏃跺彂鐜板皻鏈缃綍鍍忚矾寰勶紝浠巃ssist鏈嶅姟涓鍙�");
+            JSONObject info = assistRESTfulUtils.getInfo(mediaInfo, null);
+            if (info != null && info.getInteger("code") != null && info.getInteger("code") == 0 ) {
+                JSONObject dataJson = info.getJSONObject("data");
+                if (dataJson != null) {
+                    String recordPath = dataJson.getString("record");
+                    userSetting.setRecordPath(recordPath);
+                    result.setMp4_save_path(recordPath);
+                    // 淇敼zlm涓殑褰曞儚璺緞
+                    if (mediaInfo.isAutoConfig()) {
+                        taskExecutor.execute(() -> {
+                            mediaServerService.setZLMConfig(mediaInfo, false);
+                        });
+                    }
+                }
+            }
+        }
         return result;
     }
 
@@ -377,7 +395,7 @@
                     List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServerByStream(param.getStream());
                     if (sendRtpItems.size() > 0) {
                         for (SendRtpItem sendRtpItem : sendRtpItems) {
-                            if (sendRtpItem.getApp().equals(param.getApp())) {
+                            if (sendRtpItem != null && sendRtpItem.getApp().equals(param.getApp())) {
                                 String platformId = sendRtpItem.getPlatformId();
                                 ParentPlatform platform = storager.queryParentPlatByServerGBId(platformId);
                                 Device device = deviceService.getDevice(platformId);

--
Gitblit v1.8.0