修复多zlm节点上线时的空指针异常+单端口收流未设置到zlm的BUG

pull/1669/head
648540858 2024-10-24 15:55:38 +08:00
parent 2cd21a26d4
commit 0ddc374c34
4 changed files with 8 additions and 4 deletions

View File

@ -184,7 +184,7 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In
return;
}
log.info("[收到bye] 来自:{}, 通道: {}, 类型: {}", ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId(), ssrcTransaction.getType());
// TODO 结束点播 避免等待
if (ssrcTransaction.getPlatformId() != null ) {
Platform platform = platformService.queryPlatformByServerGBId(ssrcTransaction.getPlatformId());

View File

@ -273,6 +273,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
public void update(MediaServer mediaSerItem) {
mediaServerMapper.update(mediaSerItem);
MediaServer mediaServerInRedis = getOne(mediaSerItem.getId());
// 获取完整数据
MediaServer mediaServerInDataBase = mediaServerMapper.queryOne(mediaSerItem.getId());
if (mediaServerInDataBase == null) {
return;
@ -350,7 +351,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
Set<Object> mediaServerIdSet = redisTemplate.opsForZSet().reverseRange(key, 0, -1);
List<MediaServer> result = new ArrayList<>();
if (mediaServerIdSet != null && mediaServerIdSet.size() > 0) {
if (mediaServerIdSet != null && !mediaServerIdSet.isEmpty()) {
for (Object mediaServerId : mediaServerIdSet) {
String mediaServerIdStr = (String) mediaServerId;
String serverKey = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + ":" + mediaServerIdStr;

View File

@ -129,7 +129,8 @@ public class ZLMMediaServerStatusManager {
}
if (!offlineZlmPrimaryMap.isEmpty()) {
for (MediaServer mediaServerItem : offlineZlmPrimaryMap.values()) {
if (offlineZlmTimeMap.get(mediaServerItem.getId()) < System.currentTimeMillis() - 30*60*1000) {
if (offlineZlmTimeMap.get(mediaServerItem.getId()) != null
&& offlineZlmTimeMap.get(mediaServerItem.getId()) < System.currentTimeMillis() - 30*60*1000) {
offlineZlmsecondaryMap.put(mediaServerItem.getId(), mediaServerItem);
offlineZlmPrimaryMap.remove(mediaServerItem.getId());
continue;
@ -281,6 +282,8 @@ public class ZLMMediaServerStatusManager {
// 等zlm支持给每个rtpServer设置关闭音频的时候可以不设置此选项
if (mediaServerItem.isRtpEnable() && !ObjectUtils.isEmpty(mediaServerItem.getRtpPortRange())) {
param.put("rtp_proxy.port_range", mediaServerItem.getRtpPortRange().replace(",", "-"));
}else {
param.put("rtp_proxy.port", mediaServerItem.getRtpProxyPort());
}
if (!ObjectUtils.isEmpty(mediaServerItem.getRecordPath())) {

View File

@ -228,7 +228,7 @@ public class ServerController {
public List<MediaServerLoad> getMediaLoad() {
List<MediaServerLoad> result = new ArrayList<>();
List<MediaServer> allOnline = mediaServerService.getAllOnline();
if (allOnline.size() == 0) {
if (allOnline.isEmpty()) {
return result;
}else {
for (MediaServer mediaServerItem : allOnline) {