From 8a42f15d34d8656dcee9b180c0135fd9ffe59c7a Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Mon, 18 Nov 2024 16:26:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96zlm=E6=8E=A5=E5=85=A5?= =?UTF-8?q?=E6=98=AF=E6=8B=89=E6=B5=81=E4=BB=A3=E7=90=86=E7=9A=84=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/streamProxy/dao/StreamProxyMapper.java | 4 ++-- .../vmp/streamProxy/dao/provider/StreamProxyProvider.java | 5 ++--- .../streamProxy/service/impl/StreamProxyServiceImpl.java | 8 +++----- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/streamProxy/dao/StreamProxyMapper.java b/src/main/java/com/genersoft/iot/vmp/streamProxy/dao/StreamProxyMapper.java index 551b6e3c..82d48e21 100755 --- a/src/main/java/com/genersoft/iot/vmp/streamProxy/dao/StreamProxyMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/streamProxy/dao/StreamProxyMapper.java @@ -48,8 +48,8 @@ public interface StreamProxyMapper { @SelectProvider(type = StreamProxyProvider.class, method = "selectOneByAppAndStream") StreamProxy selectOneByAppAndStream(@Param("app") String app, @Param("stream") String stream); - @SelectProvider(type = StreamProxyProvider.class, method = "selectForEnableInMediaServer") - List selectForEnableInMediaServer(@Param("mediaServerId") String mediaServerId, @Param("enable") boolean enable); + @SelectProvider(type = StreamProxyProvider.class, method = "selectForPushingInMediaServer") + List selectForPushingInMediaServer(@Param("mediaServerId") String mediaServerId, @Param("enable") boolean enable); @Select("select count(1) from wvp_stream_proxy") diff --git a/src/main/java/com/genersoft/iot/vmp/streamProxy/dao/provider/StreamProxyProvider.java b/src/main/java/com/genersoft/iot/vmp/streamProxy/dao/provider/StreamProxyProvider.java index d43a94fe..6586fc64 100644 --- a/src/main/java/com/genersoft/iot/vmp/streamProxy/dao/provider/StreamProxyProvider.java +++ b/src/main/java/com/genersoft/iot/vmp/streamProxy/dao/provider/StreamProxyProvider.java @@ -19,9 +19,8 @@ public class StreamProxyProvider { return getBaseSelectSql() + " WHERE st.id = " + params.get("id"); } - public String selectForEnableInMediaServer(Map params ){ - return getBaseSelectSql() + String.format(" WHERE st.enable=%s and st.media_server_id= '%s' order by st.create_time desc", - params.get("enable"), params.get("mediaServerId")); + public String selectForPushingInMediaServer(Map params ){ + return getBaseSelectSql() + " WHERE st.pulling=1 and st.media_server_id=#{mediaServerId} order by st.create_time desc"; } public String selectOneByAppAndStream(Map params ){ diff --git a/src/main/java/com/genersoft/iot/vmp/streamProxy/service/impl/StreamProxyServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/streamProxy/service/impl/StreamProxyServiceImpl.java index a657d508..88f9454a 100755 --- a/src/main/java/com/genersoft/iot/vmp/streamProxy/service/impl/StreamProxyServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/streamProxy/service/impl/StreamProxyServiceImpl.java @@ -296,7 +296,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService { // 这里主要是控制数据库/redis缓存/以及zlm中存在的代理流 三者状态一致。以数据库中数据为根本 redisCatchStorage.removeStream(mediaServer.getId(), "PULL"); - List streamProxies = streamProxyMapper.selectForEnableInMediaServer(mediaServer.getId(), true); + List streamProxies = streamProxyMapper.selectForPushingInMediaServer(mediaServer.getId(), true); if (streamProxies.isEmpty()) { return; } @@ -353,18 +353,16 @@ public class StreamProxyServiceImpl implements IStreamProxyService { streamProxyMapper.deleteByList(streamProxiesForRemove); } - if (!streamProxyMapForDb.isEmpty()) { for (StreamProxy streamProxy : streamProxyMapForDb.values()) { - log.info("恢复流代理," + streamProxy.getApp() + "/" + streamProxy.getStream()); - mediaServerService.startProxy(mediaServer, streamProxy); + streamProxyMapper.offline(streamProxy.getId()); } } } @Override public void zlmServerOffline(MediaServer mediaServer) { - List streamProxies = streamProxyMapper.selectForEnableInMediaServer(mediaServer.getId(), true); + List streamProxies = streamProxyMapper.selectForPushingInMediaServer(mediaServer.getId(), true); // 清理redis相关的缓存 redisCatchStorage.removeStream(mediaServer.getId(), "PULL");