From 21367a09a61653f701006db128230fcb8b25d543 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Tue, 15 Mar 2022 17:45:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8E=A8=E6=B5=81=E5=85=B3?= =?UTF-8?q?=E8=81=94=E5=B9=B3=E5=8F=B0=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/media/zlm/ZLMMediaListManager.java | 18 +++++++++++++++--- .../impl/VideoManagerStoragerImpl.java | 4 ++-- 2 files changed, 17 insertions(+), 5 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 c8844959..a4f7815e 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 @@ -128,15 +128,27 @@ public class ZLMMediaListManager { if (gbStreams.size() > 0) { for (GbStream gbStream : gbStreams) { // 出现使用相同国标Id的视频流时,使用新流替换旧流, - gbStreamMapper.del(gbStream.getApp(), gbStream.getStream()); - if (!gbStream.isStatus()) { - streamPushMapper.del(gbStream.getApp(), gbStream.getStream()); + if (queryKey != null) { + Matcher matcherForStream = pattern.matcher(gbStream.getStream()); + String queryKeyForStream = null; + if (matcherForStream.find()) { //此处find()每次被调用后,会偏移到下一个匹配 + queryKeyForStream = matcherForStream.group(); + } + if (queryKeyForStream == null || !queryKeyForStream.equals(queryKey)) { + // 此时不是同一个流 + gbStreamMapper.del(gbStream.getApp(), gbStream.getStream()); + if (!gbStream.isStatus()) { + streamPushMapper.del(gbStream.getApp(), gbStream.getStream()); + } + } } } } StreamProxyItem streamProxyItem = gbStreamMapper.selectOne(transform.getApp(), transform.getStream()); if (streamProxyItem != null) { transform.setGbStreamId(streamProxyItem.getGbStreamId()); + transform.setPlatformId(streamProxyItem.getPlatformId()); + transform.setCatalogId(streamProxyItem.getCatalogId()); gbStreamMapper.update(transform); }else { transform.setCreateStamp(System.currentTimeMillis()); diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java index 0ba0ab4a..e1ccf9a2 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java @@ -885,9 +885,9 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { List parentPlatforms = parentPlatformMapper.selectAllAhareAllLiveStream(); if (parentPlatforms.size() > 0) { for (ParentPlatform parentPlatform : parentPlatforms) { - StreamProxyItem streamProxyItems = platformGbStreamMapper.selectOne(streamPushItem.getApp(), streamPushItem.getStream(), + StreamProxyItem streamProxyItem = platformGbStreamMapper.selectOne(streamPushItem.getApp(), streamPushItem.getStream(), parentPlatform.getServerGBId()); - if (streamProxyItems == null) { + if (streamProxyItem == null) { streamPushItem.setCatalogId(parentPlatform.getCatalogId()); streamPushItem.setPlatformId(parentPlatform.getServerGBId()); platformGbStreamMapper.add(streamPushItem);