From a1c02605c18a069a4ca3ad2c5562853c37c0d14e Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Tue, 2 Apr 2024 14:41:02 +0800 Subject: [PATCH] =?UTF-8?q?abl-=E5=AE=9E=E7=8E=B0closeRtpServer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../media/abl/ABLMediaNodeServerService.java | 31 ++++++++++++++++--- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/media/abl/ABLMediaNodeServerService.java b/src/main/java/com/genersoft/iot/vmp/media/abl/ABLMediaNodeServerService.java index 644be243..110c0cbb 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/abl/ABLMediaNodeServerService.java +++ b/src/main/java/com/genersoft/iot/vmp/media/abl/ABLMediaNodeServerService.java @@ -1,20 +1,26 @@ package com.genersoft.iot.vmp.media.abl; +import com.alibaba.fastjson2.JSONObject; import com.genersoft.iot.vmp.common.CommonCallback; import com.genersoft.iot.vmp.common.StreamInfo; import com.genersoft.iot.vmp.media.bean.MediaInfo; -import com.genersoft.iot.vmp.media.service.IMediaNodeServerService; import com.genersoft.iot.vmp.media.bean.MediaServer; +import com.genersoft.iot.vmp.media.service.IMediaNodeServerService; import com.genersoft.iot.vmp.vmanager.bean.WVPResult; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.HashMap; import java.util.List; import java.util.Map; @Service("abl") public class ABLMediaNodeServerService implements IMediaNodeServerService { + private final static Logger logger = LoggerFactory.getLogger(ABLMediaNodeServerService.class); + @Autowired private ABLRESTfulUtils ablresTfulUtils; @@ -24,13 +30,28 @@ public class ABLMediaNodeServerService implements IMediaNodeServerService { } @Override - public void closeRtpServer(MediaServer mediaServerItem, String streamId) { - + public void closeRtpServer(MediaServer mediaServer, String streamId) { + closeRtpServer(mediaServer, streamId, null); } @Override - public void closeRtpServer(MediaServer mediaServerItem, String streamId, CommonCallback callback) { - + public void closeRtpServer(MediaServer serverItem, String streamId, CommonCallback callback) { + if (serverItem == null) { + return; + } + Map param = new HashMap<>(); + param.put("stream_id", streamId); + param.put("force", 1); + JSONObject jsonObject = ablresTfulUtils.closeStreams(serverItem, "rtp", streamId); + logger.info("关闭RTP Server " + jsonObject); + if (jsonObject != null ) { + if (jsonObject.getInteger("code") != 0) { + logger.error("关闭RTP Server 失败: " + jsonObject.getString("msg")); + } + }else { + // 检查ZLM状态 + logger.error("关闭RTP Server 失败: 请检查ZLM服务"); + } } @Override