From 5973dcd9752079aaf32b4b5f00bd90d689844ec8 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Sun, 31 Mar 2024 00:34:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=82=B9=E6=92=AD=E4=B8=8E?= =?UTF-8?q?=E5=BD=95=E5=83=8F=E5=9B=9E=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java | 7 +++++-- 1 file changed, 5 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 2717fc3d..7873cf5b 100755 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java @@ -173,7 +173,7 @@ public class ZLMHttpHookListener { String mediaServerId = json.getString("mediaServerId"); MediaServer mediaServer = mediaServerService.getOne(mediaServerId); if (mediaServer == null) { - return new HookResultForOnPublish(200, "success"); + return new HookResultForOnPublish(0, "success"); } ResultForOnPublish resultForOnPublish = mediaService.authenticatePublish(mediaServer, param.getApp(), param.getStream(), param.getParams()); @@ -197,6 +197,9 @@ public class ZLMHttpHookListener { public HookResult onStreamChanged(@RequestBody OnStreamChangedHookParam param) { MediaServer mediaServer = mediaServerService.getOne(param.getMediaServerId()); + if (mediaServer == null) { + return HookResult.SUCCESS(); + } if (param.isRegist()) { logger.info("[ZLM HOOK] 流注册, {}->{}->{}/{}", param.getMediaServerId(), param.getSchema(), param.getApp(), param.getStream()); @@ -329,9 +332,9 @@ public class ZLMHttpHookListener { logger.info("[ZLM HOOK] 录像完成事件:{}->{}", param.getMediaServerId(), param.getFile_path()); try { - MediaRecordMp4Event event = new MediaRecordMp4Event(this); MediaServer mediaServerItem = mediaServerService.getOne(param.getMediaServerId()); if (mediaServerItem != null) { + MediaRecordMp4Event event = MediaRecordMp4Event.getInstance(this, param, mediaServerItem); event.setMediaServer(mediaServerItem); applicationEventPublisher.publishEvent(event); }