| | |
| | | @Override |
| | | public boolean stop(String app, String streamId) { |
| | | StreamPushItem streamPushItem = streamPushMapper.selectOne(app, streamId); |
| | | gbStreamService.sendCatalogMsg(streamPushItem, CatalogEvent.DEL); |
| | | if (streamPushItem != null) { |
| | | gbStreamService.sendCatalogMsg(streamPushItem, CatalogEvent.DEL); |
| | | } |
| | | |
| | | platformGbStreamMapper.delByAppAndStream(app, streamId); |
| | | gbStreamMapper.del(app, streamId); |
| | |
| | | streamInfoPushItemMap.put(onStreamChangedHookParam.getApp() + onStreamChangedHookParam.getStream(), onStreamChangedHookParam); |
| | | } |
| | | } |
| | | // 获取所有推流鉴权信息,清理过期的 |
| | | List<StreamAuthorityInfo> allStreamAuthorityInfo = redisCatchStorage.getAllStreamAuthorityInfo(); |
| | | Map<String, StreamAuthorityInfo> streamAuthorityInfoInfoMap = new HashMap<>(); |
| | | for (StreamAuthorityInfo streamAuthorityInfo : allStreamAuthorityInfo) { |
| | | streamAuthorityInfoInfoMap.put(streamAuthorityInfo.getApp() + streamAuthorityInfo.getStream(), streamAuthorityInfo); |
| | | } |
| | | zlmresTfulUtils.getMediaList(mediaServerItem, (mediaList ->{ |
| | | if (mediaList == null) { |
| | | return; |
| | |
| | | for (StreamPushItem streamPushItem : streamPushItems) { |
| | | pushItemMap.remove(streamPushItem.getApp() + streamPushItem.getStream()); |
| | | streamInfoPushItemMap.remove(streamPushItem.getApp() + streamPushItem.getStream()); |
| | | streamAuthorityInfoInfoMap.remove(streamPushItem.getApp() + streamPushItem.getStream()); |
| | | } |
| | | } |
| | | List<StreamPushItem> offlinePushItems = new ArrayList<>(pushItemMap.values()); |
| | |
| | | redisCatchStorage.sendStreamChangeMsg(type, jsonObject); |
| | | // 移除redis内流的信息 |
| | | redisCatchStorage.removeStream(mediaServerItem.getId(), "PUSH", offlineOnStreamChangedHookParam.getApp(), offlineOnStreamChangedHookParam.getStream()); |
| | | } |
| | | } |
| | | |
| | | Collection<StreamAuthorityInfo> streamAuthorityInfos = streamAuthorityInfoInfoMap.values(); |
| | | if (streamAuthorityInfos.size() > 0) { |
| | | for (StreamAuthorityInfo streamAuthorityInfo : streamAuthorityInfos) { |
| | | // 移除redis内流的信息 |
| | | redisCatchStorage.removeStreamAuthorityInfo(streamAuthorityInfo.getApp(), streamAuthorityInfo.getStream()); |
| | | } |
| | | } |
| | | })); |
| | |
| | | // 存储数据到stream_push表 |
| | | streamPushMapper.addAll(streamPushItems); |
| | | List<StreamPushItem> streamPushItemForGbStream = streamPushItems.stream() |
| | | .filter(streamPushItem-> streamPushItem.getId() != null) |
| | | .filter(streamPushItem-> streamPushItem.getGbId() != null) |
| | | .collect(Collectors.toList()); |
| | | // 存储数据到gb_stream表, id会返回到streamPushItemForGbStream里 |
| | | if (streamPushItemForGbStream.size() > 0) { |