Browse Source

修复推流关联平台的bug

pull/403/head
648540858 3 years ago
parent
commit
66aac4526b
  1. 18
      src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java
  2. 4
      src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java

18
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java

@ -128,15 +128,27 @@ public class ZLMMediaListManager {
if (gbStreams.size() > 0) { if (gbStreams.size() > 0) {
for (GbStream gbStream : gbStreams) { for (GbStream gbStream : gbStreams) {
// 出现使用相同国标Id的视频流时,使用新流替换旧流, // 出现使用相同国标Id的视频流时,使用新流替换旧流,
gbStreamMapper.del(gbStream.getApp(), gbStream.getStream()); if (queryKey != null) {
if (!gbStream.isStatus()) { Matcher matcherForStream = pattern.matcher(gbStream.getStream());
streamPushMapper.del(gbStream.getApp(), 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()); StreamProxyItem streamProxyItem = gbStreamMapper.selectOne(transform.getApp(), transform.getStream());
if (streamProxyItem != null) { if (streamProxyItem != null) {
transform.setGbStreamId(streamProxyItem.getGbStreamId()); transform.setGbStreamId(streamProxyItem.getGbStreamId());
transform.setPlatformId(streamProxyItem.getPlatformId());
transform.setCatalogId(streamProxyItem.getCatalogId());
gbStreamMapper.update(transform); gbStreamMapper.update(transform);
}else { }else {
transform.setCreateStamp(System.currentTimeMillis()); transform.setCreateStamp(System.currentTimeMillis());

4
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java

@ -885,9 +885,9 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
List<ParentPlatform> parentPlatforms = parentPlatformMapper.selectAllAhareAllLiveStream(); List<ParentPlatform> parentPlatforms = parentPlatformMapper.selectAllAhareAllLiveStream();
if (parentPlatforms.size() > 0) { if (parentPlatforms.size() > 0) {
for (ParentPlatform parentPlatform : parentPlatforms) { for (ParentPlatform parentPlatform : parentPlatforms) {
StreamProxyItem streamProxyItems = platformGbStreamMapper.selectOne(streamPushItem.getApp(), streamPushItem.getStream(), StreamProxyItem streamProxyItem = platformGbStreamMapper.selectOne(streamPushItem.getApp(), streamPushItem.getStream(),
parentPlatform.getServerGBId()); parentPlatform.getServerGBId());
if (streamProxyItems == null) { if (streamProxyItem == null) {
streamPushItem.setCatalogId(parentPlatform.getCatalogId()); streamPushItem.setCatalogId(parentPlatform.getCatalogId());
streamPushItem.setPlatformId(parentPlatform.getServerGBId()); streamPushItem.setPlatformId(parentPlatform.getServerGBId());
platformGbStreamMapper.add(streamPushItem); platformGbStreamMapper.add(streamPushItem);

Loading…
Cancel
Save