修复国标级联点播未使用自动自定义SSRC的BUG

pull/1669/head
648540858 2024-10-24 10:04:38 +08:00
parent 222c9eade5
commit 2cd21a26d4
4 changed files with 30 additions and 4 deletions

View File

@ -54,7 +54,7 @@ public class SipInviteSessionManager {
List<SsrcTransaction> result = new ArrayList<>(); List<SsrcTransaction> result = new ArrayList<>();
for (Object keyObj : scanResult) { for (Object keyObj : scanResult) {
SsrcTransaction ssrcTransaction = (SsrcTransaction)redisTemplate.opsForValue().get(keyObj); SsrcTransaction ssrcTransaction = (SsrcTransaction)redisTemplate.opsForValue().get(keyObj);
if (ssrcTransaction != null && ssrcTransaction.getDeviceId().equals(deviceId)) { if (ssrcTransaction != null && deviceId.equals(ssrcTransaction.getDeviceId())) {
result.add(ssrcTransaction); result.add(ssrcTransaction);
} }
} }

View File

@ -134,7 +134,7 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In
redisCatchStorage.sendPlatformStartPlayMsg(sendRtpItem, deviceChannel, parentPlatform); redisCatchStorage.sendPlatformStartPlayMsg(sendRtpItem, deviceChannel, parentPlatform);
}catch (ControllerException e) { }catch (ControllerException e) {
log.error("RTP推流失败: {}", e.getMessage()); log.error("RTP推流失败: ", e);
playService.startSendRtpStreamFailHand(sendRtpItem, parentPlatform, callIdHeader); playService.startSendRtpStreamFailHand(sendRtpItem, parentPlatform, callIdHeader);
} }
} }

View File

@ -4,10 +4,12 @@ import com.genersoft.iot.vmp.common.InviteSessionType;
import com.genersoft.iot.vmp.common.VideoManagerConstants; import com.genersoft.iot.vmp.common.VideoManagerConstants;
import com.genersoft.iot.vmp.conf.DynamicTask; import com.genersoft.iot.vmp.conf.DynamicTask;
import com.genersoft.iot.vmp.conf.SipConfig; import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.conf.exception.ControllerException; import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.gb28181.bean.*; import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.service.*; import com.genersoft.iot.vmp.gb28181.service.*;
import com.genersoft.iot.vmp.gb28181.session.AudioBroadcastManager; import com.genersoft.iot.vmp.gb28181.session.AudioBroadcastManager;
import com.genersoft.iot.vmp.gb28181.session.SSRCFactory;
import com.genersoft.iot.vmp.gb28181.session.SipInviteSessionManager; import com.genersoft.iot.vmp.gb28181.session.SipInviteSessionManager;
import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
@ -96,6 +98,12 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
@Autowired @Autowired
private SipInviteSessionManager sessionManager; private SipInviteSessionManager sessionManager;
@Autowired
private UserSetting userSetting;
@Autowired
private SSRCFactory ssrcFactory;
@Override @Override
public void afterPropertiesSet() throws Exception { public void afterPropertiesSet() throws Exception {
@ -136,6 +144,16 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
platform.getName(), channel.getGbName(), channel.getGbDeviceId(), inviteInfo.getIp(), platform.getName(), channel.getGbName(), channel.getGbDeviceId(), inviteInfo.getIp(),
inviteInfo.getPort(), inviteInfo.isTcp()?(inviteInfo.isTcpActive()?"TCP主动":"TCP被动"): "UDP", inviteInfo.getPort(), inviteInfo.isTcp()?(inviteInfo.isTcpActive()?"TCP主动":"TCP被动"): "UDP",
inviteInfo.getSessionName(), inviteInfo.getSsrc()); inviteInfo.getSessionName(), inviteInfo.getSsrc());
if(!userSetting.getUseCustomSsrcForParentInvite() && ObjectUtils.isEmpty(inviteInfo.getSsrc())) {
log.warn("[上级INVITE] 点播失败, 上级为携带SSRC, 并且本级未设置使用自定义ssrc");
// 通道存在发100TRYING
try {
responseAck(request, Response.BAD_REQUEST);
} catch (SipException | InvalidArgumentException | ParseException e) {
log.error("[命令发送失败] 上级Invite TRYING: {}", e.getMessage());
}
return;
}
// 通道存在发100TRYING // 通道存在发100TRYING
try { try {
responseAck(request, Response.TRYING); responseAck(request, Response.TRYING);
@ -152,7 +170,13 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
} }
}else { }else {
// 点播成功, TODO 可以在此处检测cancel命令是否存在存在则不发送 // 点播成功, TODO 可以在此处检测cancel命令是否存在存在则不发送
if (userSetting.getUseCustomSsrcForParentInvite()) {
// 上级平台点播时不使用上级平台指定的ssrc使用自定义的ssrc参考国标文档-点播外域设备媒体流SSRC处理方式
String ssrc = "Play".equalsIgnoreCase(inviteInfo.getSessionName())
? ssrcFactory.getPlaySsrc(streamInfo.getMediaServer().getId())
: ssrcFactory.getPlayBackSsrc(streamInfo.getMediaServer().getId());
inviteInfo.setSsrc(ssrc);
}
// 构建sendRTP内容 // 构建sendRTP内容
SendRtpInfo sendRtpItem = sendRtpServerService.createSendRtpInfo(streamInfo.getMediaServer(), SendRtpInfo sendRtpItem = sendRtpServerService.createSendRtpInfo(streamInfo.getMediaServer(),
inviteInfo.getIp(), inviteInfo.getPort(), inviteInfo.getSsrc(), platform.getServerGBId(), inviteInfo.getIp(), inviteInfo.getPort(), inviteInfo.getSsrc(), platform.getServerGBId(),

View File

@ -381,7 +381,9 @@ public class ZLMMediaNodeServerService implements IMediaNodeServerService {
param.put("dst_url", sendRtpItem.getIp()); param.put("dst_url", sendRtpItem.getIp());
param.put("dst_port", sendRtpItem.getPort()); param.put("dst_port", sendRtpItem.getPort());
JSONObject jsonObject = zlmresTfulUtils.startSendRtp(mediaServer, param); JSONObject jsonObject = zlmresTfulUtils.startSendRtp(mediaServer, param);
if (jsonObject == null || jsonObject.getInteger("code") != 0 ) { if (jsonObject == null ) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "连接zlm失败");
}else if (jsonObject.getInteger("code") != 0) {
throw new ControllerException(jsonObject.getInteger("code"), jsonObject.getString("msg")); throw new ControllerException(jsonObject.getInteger("code"), jsonObject.getString("msg"));
} }
log.info("[推流结果]{} ,参数: {}",jsonObject, JSONObject.toJSONString(param)); log.info("[推流结果]{} ,参数: {}",jsonObject, JSONObject.toJSONString(param));