修复国标点播下级平台,ssrc更新的时单端口错误更新rtpserver的问题
| | |
| | | }else { |
| | | 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, |
| | | device.getDeviceId(), channelId, mediaTransmissionTCP, platform.isRtcp()); |
| | | |
| | |
| | | logger.info("[点播消息] 收到invite 200, 发现下级自定义了ssrc: {}", ssrcInResponse); |
| | | if (!mediaServerItem.isRtpEnable() || device.isSsrcCheck()) { |
| | | logger.info("[点播消息] SSRC修正 {}->{}", ssrcInfo.getSsrc(), ssrcInResponse); |
| | | |
| | | if (!ssrcFactory.checkSsrc(mediaServerItem.getId(),ssrcInResponse)) { |
| | | // ssrc 不可用 |
| | | logger.info("[点播消息] SSRC修正时发现ssrc不可使用 {}->{}", ssrcInfo.getSsrc(), ssrcInResponse); |
| | | // 释放ssrc |
| | | ssrcFactory.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc()); |
| | | streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream()); |
| | |
| | | errorEvent.response(event); |
| | | return; |
| | | } |
| | | |
| | | // 单端口模式streamId也有变化,需要重新设置监听 |
| | | // 单端口模式streamId也有变化,重新设置监听即可 |
| | | if (!mediaServerItem.isRtpEnable()) { |
| | | // 添加订阅 |
| | | HookSubscribeForStreamChange hookSubscribe = HookSubscribeFactory.on_stream_changed("rtp", ssrcInfo.getStream(), true, "rtsp", mediaServerItem.getId()); |
| | |
| | | onPublishHandlerForPlay(mediaServerItemInUse, response, device.getDeviceId(), channelId); |
| | | hookEvent.response(mediaServerItemInUse, response); |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | |
| | | // 更新ssrc |
| | | Boolean result = mediaServerService.updateRtpServerSSRC(mediaServerItem, ssrcInfo.getStream(), ssrcInResponse); |
| | | if (!result) { |
| | | try { |
| | |
| | | event.statusCode = 500; |
| | | errorEvent.response(event); |
| | | } |
| | | // // 关闭rtp server |
| | | // mediaServerService.closeRTPServer(mediaServerItem, ssrcInfo.getStream(), result->{ |
| | | // 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); |
| | | // } |
| | | // }); |
| | | |
| | | |
| | | }else { |
| | | logger.info("[点播消息] 收到invite 200, 下级自定义了ssrc, 但是当前模式无需修正"); |
| | | } |
| | | } |
| | | }, (event) -> { |