修复web端管理节点负载不显示国标收流 #871

This commit is contained in:
648540858 2023-05-30 10:54:09 +08:00
parent 7e818d0c07
commit 7d1cf85fb9
5 changed files with 30 additions and 12 deletions

View File

@ -65,4 +65,9 @@ public interface IInviteStreamService {
* 清空一个设备的所有invite信息
*/
void clearInviteInfo(String deviceId);
/**
* 统计同一个zlm下的国标收流个数
*/
int getStreamInfoCount(String mediaServerId);
}

View File

@ -179,4 +179,23 @@ public class InviteStreamServiceImpl implements IInviteStreamService {
public void clearInviteInfo(String deviceId) {
removeInviteInfo(null, deviceId, null, null);
}
@Override
public int getStreamInfoCount(String mediaServerId) {
int count = 0;
String key = VideoManagerConstants.INVITE_PREFIX + "_*_*_*_*";
List<Object> scanResult = RedisUtil.scan(redisTemplate, key);
if (scanResult.size() == 0) {
return 0;
}else {
for (Object keyObj : scanResult) {
String keyStr = (String) keyObj;
InviteInfo inviteInfo = (InviteInfo) redisTemplate.opsForValue().get(keyStr);
if (inviteInfo != null && inviteInfo.getStreamInfo() != null && inviteInfo.getStreamInfo().getMediaServerId().equals(mediaServerId)) {
count++;
}
}
}
return count;
}
}

View File

@ -17,6 +17,7 @@ import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig;
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
import com.genersoft.iot.vmp.media.zlm.dto.ServerKeepaliveData;
import com.genersoft.iot.vmp.service.IInviteStreamService;
import com.genersoft.iot.vmp.service.IMediaServerService;
import com.genersoft.iot.vmp.service.bean.MediaServerLoad;
import com.genersoft.iot.vmp.service.bean.SSRCInfo;
@ -97,6 +98,9 @@ public class MediaServerServiceImpl implements IMediaServerService {
@Autowired
private IRedisCatchStorage redisCatchStorage;
@Autowired
private IInviteStreamService inviteStreamService;
@Autowired
private RedisTemplate<Object, Object> redisTemplate;
@ -735,7 +739,8 @@ public class MediaServerServiceImpl implements IMediaServerService {
result.setId(mediaServerItem.getId());
result.setPush(redisCatchStorage.getPushStreamCount(mediaServerItem.getId()));
result.setProxy(redisCatchStorage.getProxyStreamCount(mediaServerItem.getId()));
result.setGbReceive(redisCatchStorage.getGbReceiveCount(mediaServerItem.getId()));
result.setGbReceive(inviteStreamService.getStreamInfoCount(mediaServerItem.getId()));
result.setGbSend(redisCatchStorage.getGbSendCount(mediaServerItem.getId()));
return result;
}

View File

@ -191,8 +191,6 @@ public interface IRedisCatchStorage {
int getProxyStreamCount(String id);
int getGbReceiveCount(String id);
int getGbSendCount(String id);
void addDiskInfo(List<Map<String, Object>> diskInfo);

View File

@ -586,15 +586,6 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
return RedisUtil.scan(redisTemplate, key).size();
}
@Override
public int getGbReceiveCount(String id) {
String playKey = VideoManagerConstants.PLAYER_PREFIX + "_" + userSetting.getServerId() + "_" + id + "_*";
String playBackKey = VideoManagerConstants.PLAY_BLACK_PREFIX + "_" + userSetting.getServerId() + "_" + id + "_*";
String downloadKey = VideoManagerConstants.DOWNLOAD_PREFIX + "_" + userSetting.getServerId() + "_" + id + "_*";
return RedisUtil.scan(redisTemplate, playKey).size() + RedisUtil.scan(redisTemplate, playBackKey).size() + RedisUtil.scan(redisTemplate, downloadKey).size();
}
@Override
public int getGbSendCount(String id) {
String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX