From 722f1d0ee761cee4f8a1a99da46cc799380303e8 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Mon, 1 Apr 2024 16:17:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BD=E6=A0=87=E7=BA=A7=E8=81=94-=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=8B=89=E6=B5=81=E4=BB=A3=E7=90=86=E6=92=AD=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 | 2 +- .../iot/vmp/media/zlm/ZLMMediaNodeServerService.java | 3 +-- .../iot/vmp/service/impl/StreamProxyServiceImpl.java | 9 +++++++-- 3 files changed, 9 insertions(+), 5 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 c9aad4d4..dc24874e 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 @@ -151,7 +151,7 @@ public class ZLMHttpHookListener { logger.info("[ZLM HOOK] 播放鉴权 失败:{}->{}", param.getMediaServerId(), param); return new HookResult(401, "Unauthorized"); } - logger.info("[ZLM HOOK] 播放鉴权 失败:{}->{}", param.getMediaServerId(), param); + logger.info("[ZLM HOOK] 播放鉴权成功:{}->{}", param.getMediaServerId(), param); return HookResult.SUCCESS(); } diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaNodeServerService.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaNodeServerService.java index 11e6063b..06c8c3e5 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaNodeServerService.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaNodeServerService.java @@ -257,14 +257,13 @@ public class ZLMMediaNodeServerService implements IMediaNodeServerService { public WVPResult addStreamProxy(MediaServer mediaServer, String app, String stream, String url, boolean enableAudio, boolean enableMp4, String rtpType) { JSONObject jsonObject = zlmresTfulUtils.addStreamProxy(mediaServer, app, stream, url, enableAudio, enableMp4, rtpType); if (jsonObject.getInteger("code") != 0) { - logger.warn("[addStreamProxy] 添加代理失败"); return WVPResult.fail(ErrorCode.ERROR100.getCode(), "添加代理失败"); }else { JSONObject data = jsonObject.getJSONObject("data"); if (data == null) { return WVPResult.fail(ErrorCode.ERROR100.getCode(), "代理结果异常: " + jsonObject); }else { - return WVPResult.success(""); + return WVPResult.success(data.getString("key")); } } } diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java index 2ac9de67..60dd8af8 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java @@ -361,8 +361,6 @@ public class StreamProxyServiceImpl implements IStreamProxyService { result = mediaServerService.addStreamProxy(mediaServer, param.getApp(), param.getStream(), param.getUrl().trim(), param.isEnableAudio(), param.isEnableMp4(), param.getRtpType()); } - System.out.println("addStreamProxyToZlm===="); - System.out.println(result); if (result != null && result.getCode() == 0) { String key = result.getData(); if (key == null) { @@ -381,6 +379,13 @@ public class StreamProxyServiceImpl implements IStreamProxyService { return null; } MediaServer mediaServer = mediaServerService.getOne(param.getMediaServerId()); + if (mediaServer == null) { + return null; + } + List mediaList = mediaServerService.getMediaList(mediaServer, param.getApp(), param.getStream(), null); + if (mediaList.isEmpty()) { + return true; + } Boolean result = false; if ("ffmpeg".equalsIgnoreCase(param.getType())){ result = mediaServerService.delFFmpegSource(mediaServer, param.getStreamKey());