清理过期的推流鉴权信息
parent
6b8ecd1f9d
commit
5f7c53823a
|
@ -221,6 +221,12 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||||
streamInfoPushItemMap.put(onStreamChangedHookParam.getApp() + onStreamChangedHookParam.getStream(), onStreamChangedHookParam);
|
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 ->{
|
zlmresTfulUtils.getMediaList(mediaServerItem, (mediaList ->{
|
||||||
if (mediaList == null) {
|
if (mediaList == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -239,6 +245,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||||
for (StreamPushItem streamPushItem : streamPushItems) {
|
for (StreamPushItem streamPushItem : streamPushItems) {
|
||||||
pushItemMap.remove(streamPushItem.getApp() + streamPushItem.getStream());
|
pushItemMap.remove(streamPushItem.getApp() + streamPushItem.getStream());
|
||||||
streamInfoPushItemMap.remove(streamPushItem.getApp() + streamPushItem.getStream());
|
streamInfoPushItemMap.remove(streamPushItem.getApp() + streamPushItem.getStream());
|
||||||
|
streamAuthorityInfoInfoMap.remove(streamPushItem.getApp() + streamPushItem.getStream());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<StreamPushItem> offlinePushItems = new ArrayList<>(pushItemMap.values());
|
List<StreamPushItem> offlinePushItems = new ArrayList<>(pushItemMap.values());
|
||||||
|
@ -274,6 +281,14 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||||
redisCatchStorage.removeStream(mediaServerItem.getId(), "PUSH", offlineOnStreamChangedHookParam.getApp(), offlineOnStreamChangedHookParam.getStream());
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -233,6 +233,8 @@ public interface IRedisCatchStorage {
|
||||||
*/
|
*/
|
||||||
StreamAuthorityInfo getStreamAuthorityInfo(String app, String stream);
|
StreamAuthorityInfo getStreamAuthorityInfo(String app, String stream);
|
||||||
|
|
||||||
|
List<StreamAuthorityInfo> getAllStreamAuthorityInfo();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送redis消息 查询所有推流设备的状态
|
* 发送redis消息 查询所有推流设备的状态
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -714,6 +714,18 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<StreamAuthorityInfo> getAllStreamAuthorityInfo() {
|
||||||
|
String scanKey = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_*_*" ;
|
||||||
|
List<StreamAuthorityInfo> result = new ArrayList<>();
|
||||||
|
List<Object> keys = RedisUtil.scan(scanKey);
|
||||||
|
for (Object o : keys) {
|
||||||
|
String key = (String) o;
|
||||||
|
result.add((StreamAuthorityInfo) RedisUtil.get(key));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OnStreamChangedHookParam getStreamInfo(String app, String streamId, String mediaServerId) {
|
public OnStreamChangedHookParam getStreamInfo(String app, String streamId, String mediaServerId) {
|
||||||
|
|
Loading…
Reference in New Issue