From 1af77ab5f7c11a4b3d59c1989b51b9fca29679ce Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期二, 18 十月 2022 22:18:49 +0800
Subject: [PATCH] Merge pull request #645 from IKangXu/wvp-28181-2.0

---
 src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 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 50a1fa5..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
@@ -17,6 +17,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.text.ParseException;
 import java.util.*;
 import java.util.concurrent.ConcurrentHashMap;
 
@@ -67,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());
@@ -81,11 +81,14 @@
             streamPushMapper.update(transform);
             gbStreamMapper.updateMediaServer(mediaItem.getApp(), mediaItem.getStream(), mediaItem.getMediaServerId());
         }
-        if (transform != null) {
-            if (getChannelOnlineEventLister(transform.getApp(), transform.getStream()) != null)  {
-                getChannelOnlineEventLister(transform.getApp(), transform.getStream()).run(transform.getApp(), transform.getStream(), transform.getServerId());
-                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;
     }
@@ -94,8 +97,13 @@
         MediaServerItem mediaServerItem = mediaServerService.getOne(mediaServerId);
         // 鏌ョ湅鎺ㄦ祦鐘舵��
         if (zlmrtpServerFactory.isStreamReady(mediaServerItem, app, stream)) {
-            if (getChannelOnlineEventLister(app, stream) != null)  {
-                getChannelOnlineEventLister(app, stream).run(app, stream, mediaServerId);
+            ChannelOnlineEvent channelOnlineEventLister = getChannelOnlineEventLister(app, stream);
+            if (channelOnlineEventLister != null)  {
+                try {
+                    channelOnlineEventLister.run(app, stream, mediaServerId);
+                } catch (ParseException e) {
+                    logger.error("sendStreamEvent: ", e);
+                }
                 removedChannelOnlineEventLister(app, stream);
             }
         }

--
Gitblit v1.8.0