修复国标点播下级平台,ssrc更新的时单端口错误更新rtpserver的问题

pull/844/head
648540858 2023-05-04 16:04:44 +08:00
parent 2bc2842224
commit 381c3bdc20
2 changed files with 18 additions and 30 deletions

View File

@ -349,7 +349,17 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
}else { }else {
ssrc = contentString.substring(ssrcIndex + 2, ssrcIndex + 12); ssrc = contentString.substring(ssrcIndex + 2, ssrcIndex + 12);
} }
logger.info("[上级点播] 用户:{} 通道:{}, 地址:{}:{} ssrc{}", username, channelId, addressStr, port, ssrc); String streamTypeStr = null;
if (mediaTransmissionTCP) {
if (tcpActive) {
streamTypeStr = "TCP-ACTIVE";
}else {
streamTypeStr = "TCP-PASSIVE";
}
}else {
streamTypeStr = "UDP";
}
logger.info("[上级点播] 平台:{} 通道:{}, 收流地址:{}:{},收流方式:{}, ssrc{}", username, channelId, addressStr, port, streamTypeStr, ssrc);
SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId, SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId,
device.getDeviceId(), channelId, mediaTransmissionTCP, platform.isRtcp()); device.getDeviceId(), channelId, mediaTransmissionTCP, platform.isRtcp());

View File

@ -326,9 +326,9 @@ public class PlayServiceImpl implements IPlayService {
logger.info("[点播消息] 收到invite 200, 发现下级自定义了ssrc: {}", ssrcInResponse); logger.info("[点播消息] 收到invite 200, 发现下级自定义了ssrc: {}", ssrcInResponse);
if (!mediaServerItem.isRtpEnable() || device.isSsrcCheck()) { if (!mediaServerItem.isRtpEnable() || device.isSsrcCheck()) {
logger.info("[点播消息] SSRC修正 {}->{}", ssrcInfo.getSsrc(), ssrcInResponse); logger.info("[点播消息] SSRC修正 {}->{}", ssrcInfo.getSsrc(), ssrcInResponse);
if (!ssrcFactory.checkSsrc(mediaServerItem.getId(),ssrcInResponse)) { if (!ssrcFactory.checkSsrc(mediaServerItem.getId(),ssrcInResponse)) {
// ssrc 不可用 // ssrc 不可用
logger.info("[点播消息] SSRC修正时发现ssrc不可使用 {}->{}", ssrcInfo.getSsrc(), ssrcInResponse);
// 释放ssrc // 释放ssrc
ssrcFactory.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc()); ssrcFactory.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream()); streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream());
@ -337,8 +337,7 @@ public class PlayServiceImpl implements IPlayService {
errorEvent.response(event); errorEvent.response(event);
return; return;
} }
// 单端口模式streamId也有变化重新设置监听即可
// 单端口模式streamId也有变化需要重新设置监听
if (!mediaServerItem.isRtpEnable()) { if (!mediaServerItem.isRtpEnable()) {
// 添加订阅 // 添加订阅
HookSubscribeForStreamChange hookSubscribe = HookSubscribeFactory.on_stream_changed("rtp", ssrcInfo.getStream(), true, "rtsp", mediaServerItem.getId()); HookSubscribeForStreamChange hookSubscribe = HookSubscribeFactory.on_stream_changed("rtp", ssrcInfo.getStream(), true, "rtsp", mediaServerItem.getId());
@ -351,8 +350,11 @@ public class PlayServiceImpl implements IPlayService {
onPublishHandlerForPlay(mediaServerItemInUse, response, device.getDeviceId(), channelId); onPublishHandlerForPlay(mediaServerItemInUse, response, device.getDeviceId(), channelId);
hookEvent.response(mediaServerItemInUse, response); hookEvent.response(mediaServerItemInUse, response);
}); });
return;
} }
// 更新ssrc
Boolean result = mediaServerService.updateRtpServerSSRC(mediaServerItem, ssrcInfo.getStream(), ssrcInResponse); Boolean result = mediaServerService.updateRtpServerSSRC(mediaServerItem, ssrcInfo.getStream(), ssrcInResponse);
if (!result) { if (!result) {
try { try {
@ -372,32 +374,8 @@ public class PlayServiceImpl implements IPlayService {
event.statusCode = 500; event.statusCode = 500;
errorEvent.response(event); errorEvent.response(event);
} }
// // 关闭rtp server }else {
// mediaServerService.closeRTPServer(mediaServerItem, ssrcInfo.getStream(), result->{ logger.info("[点播消息] 收到invite 200, 下级自定义了ssrc, 但是当前模式无需修正");
// if (result) {
// // 重新开启ssrc server
// mediaServerService.openRTPServer(mediaServerItem, ssrcInfo.getStream(), ssrcInResponse, device.isSsrcCheck(), false, ssrcInfo.getPort(), true, device.getStreamModeForParam());
// }else {
// try {
// logger.warn("[停止点播] {}/{}", device.getDeviceId(), channelId);
// cmder.streamByeCmd(device, channelId, ssrcInfo.getStream(), null, null);
// } catch (InvalidArgumentException | SipException | ParseException | SsrcTransactionNotFoundException e) {
// logger.error("[命令发送失败] 停止点播, 发送BYE: {}", e.getMessage());
// throw new ControllerException(ErrorCode.ERROR100.getCode(), "命令发送失败: " + e.getMessage());
// }
//
// dynamicTask.stop(timeOutTaskKey);
// // 释放ssrc
// mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
//
// streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream());
// event.msg = "下级自定义了ssrc,重新设置收流信息失败";
// event.statusCode = 500;
// errorEvent.response(event);
// }
// });
} }
} }
}, (event) -> { }, (event) -> {