From 2bf7cdc2df8482b775c05e783e49f3bb7ec58da5 Mon Sep 17 00:00:00 2001 From: ljm <1271952916@qq.com> Date: 星期四, 20 十月 2022 16:04:47 +0800 Subject: [PATCH] 【zlm心跳hook】重复查询redis了 变量也不需要多次定义 数据库有的话应该恢复zlm --- src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java | 23 +++++++++++------------ 1 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java index b545ccc..d615980 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java @@ -68,7 +68,6 @@ private Map<String, ChannelOnlineEvent> channelOnPublishEvents = new ConcurrentHashMap<>(); public StreamPushItem addPush(MediaItem mediaItem) { - // 鏌ユ壘姝ょ洿鎾祦鏄惁瀛樺湪redis棰勮gbId StreamPushItem transform = streamPushService.transform(mediaItem); StreamPushItem pushInDb = streamPushService.getPush(mediaItem.getApp(), mediaItem.getStream()); transform.setPushIng(mediaItem.isRegist()); @@ -82,15 +81,14 @@ streamPushMapper.update(transform); gbStreamMapper.updateMediaServer(mediaItem.getApp(), mediaItem.getStream(), mediaItem.getMediaServerId()); } - if (transform != null) { - if (getChannelOnlineEventLister(transform.getApp(), transform.getStream()) != null) { - try { - getChannelOnlineEventLister(transform.getApp(), transform.getStream()).run(transform.getApp(), transform.getStream(), transform.getServerId()); - } catch (ParseException e) { - throw new RuntimeException(e); - } - removedChannelOnlineEventLister(transform.getApp(), transform.getStream()); + ChannelOnlineEvent channelOnlineEventLister = getChannelOnlineEventLister(transform.getApp(), transform.getStream()); + if ( channelOnlineEventLister != null) { + try { + channelOnlineEventLister.run(transform.getApp(), transform.getStream(), transform.getServerId());; + } catch (ParseException e) { + logger.error("addPush: ", e); } + removedChannelOnlineEventLister(transform.getApp(), transform.getStream()); } return transform; } @@ -99,11 +97,12 @@ MediaServerItem mediaServerItem = mediaServerService.getOne(mediaServerId); // 鏌ョ湅鎺ㄦ祦鐘舵�� if (zlmrtpServerFactory.isStreamReady(mediaServerItem, app, stream)) { - if (getChannelOnlineEventLister(app, stream) != null) { + ChannelOnlineEvent channelOnlineEventLister = getChannelOnlineEventLister(app, stream); + if (channelOnlineEventLister != null) { try { - getChannelOnlineEventLister(app, stream).run(app, stream, mediaServerId); + channelOnlineEventLister.run(app, stream, mediaServerId); } catch (ParseException e) { - throw new RuntimeException(e); + logger.error("sendStreamEvent: ", e); } removedChannelOnlineEventLister(app, stream); } -- Gitblit v1.8.0