From 20a3cb9e73d16bd08d99780b91ca0e8d8722a0f9 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Fri, 10 Dec 2021 11:28:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=AF=E7=94=A8=E5=A4=B1=E8=B4=A5=E7=9A=84?= =?UTF-8?q?=E6=B5=81=E8=BD=AC=E5=8F=91=E5=A6=82=E6=9E=9C=E5=BC=80=E5=90=AF?= =?UTF-8?q?=E6=97=A0=E4=BA=BA=E8=A7=82=E7=9C=8B=E8=87=AA=E5=8A=A8=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E5=88=99=E4=B8=8D=E4=BF=9D=E5=AD=98=E5=9C=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/StreamProxyServiceImpl.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) 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 19bf13a3..a972585a 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java @@ -105,24 +105,23 @@ public class StreamProxyServiceImpl implements IStreamProxyService { result.append("保存成功"); if (param.isEnable()) { JSONObject jsonObject = addStreamProxyToZlm(param); - if (jsonObject == null) { + if (jsonObject == null || jsonObject.getInteger("code") != 0) { streamLive = false; result.append(", 但是启用失败,请检查流地址是否可用"); param.setEnable(false); - videoManagerStorager.updateStreamProxy(param); - }else { - Integer code = jsonObject.getInteger("code"); - if (code == 0) { - streamLive = true; - StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStream( - mediaInfo, param.getApp(), param.getStream(), null); - wvpResult.setData(streamInfo); + // 直接移除 + if (param.isEnable_remove_none_reader()) { + del(param.getApp(), param.getStream()); }else { - result.append(", 但是启用失败,请检查流地址是否可用"); - param.setEnable(false); videoManagerStorager.updateStreamProxy(param); } + }else { + streamLive = true; + StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStream( + mediaInfo, param.getApp(), param.getStream(), null); + wvpResult.setData(streamInfo); + } } }else { @@ -202,8 +201,10 @@ public class StreamProxyServiceImpl implements IStreamProxyService { platformGbStreamMapper.delByAppAndStream(app, stream); // TODO 如果关联的推流, 那么状态设置为离线 } + redisCatchStorage.removeStream(streamProxyItem.getMediaServerId(), "PULL", app, stream); } + } @Override