| | |
| | | sendRtpItem.setPort(port); |
| | | sendRtpItem.setSsrc(ssrc); |
| | | sendRtpItem.setApp(app); |
| | | sendRtpItem.setStreamId(stream); |
| | | sendRtpItem.setStream(stream); |
| | | sendRtpItem.setPlatformId(platformId); |
| | | sendRtpItem.setChannelId(channelId); |
| | | sendRtpItem.setTcp(tcp); |
| | |
| | | // 订阅 zlm启动事件, 新的zlm也会从这里进入系统 |
| | | hookSubscribe.addSubscribe(hookSubscribeForRtpServerTimeout, |
| | | (MediaServerItem mediaServerItem, JSONObject response)->{ |
| | | logger.info("[上级点播] {}->监听端口到期继续保持监听", ssrc); |
| | | logger.info("[保持端口] {}->监听端口到期继续保持监听", ssrc); |
| | | keepPort(serverItem, ssrc); |
| | | }); |
| | | } |
| | | logger.info("[上级点播] {}->监听端口: {}", ssrc, localPort); |
| | | logger.info("[保持端口] {}->监听端口: {}", ssrc, localPort); |
| | | return localPort; |
| | | } |
| | | |
| | |
| | | * 释放保持的端口 |
| | | */ |
| | | public boolean releasePort(MediaServerItem serverItem, String ssrc) { |
| | | logger.info("[上级点播] {}->释放监听端口", ssrc); |
| | | logger.info("[保持端口] {}->释放监听端口", ssrc); |
| | | boolean closeRTPServerResult = closeRtpServer(serverItem, ssrc); |
| | | HookSubscribeForRtpServerTimeout hookSubscribeForRtpServerTimeout = HookSubscribeFactory.on_rtp_server_timeout(ssrc, null, serverItem.getId()); |
| | | // 订阅 zlm启动事件, 新的zlm也会从这里进入系统 |
| | |
| | | */ |
| | | public JSONObject startSendRtpPassive(MediaServerItem mediaServerItem, Map<String, Object>param) { |
| | | return zlmresTfulUtils.startSendRtpPassive(mediaServerItem, param); |
| | | } |
| | | |
| | | public JSONObject startSendRtpPassive(MediaServerItem mediaServerItem, Map<String, Object>param, ZLMRESTfulUtils.RequestCallback callback) { |
| | | return zlmresTfulUtils.startSendRtpPassive(mediaServerItem, param, callback); |
| | | } |
| | | |
| | | /** |
| | |
| | | result= true; |
| | | logger.info("[停止RTP推流] 成功"); |
| | | } else { |
| | | logger.error("[停止RTP推流] 失败: {}, 参数:{}->\r\n{}",jsonObject.getString("msg"), JSON.toJSON(param), jsonObject); |
| | | logger.warn("[停止RTP推流] 失败: {}, 参数:{}->\r\n{}",jsonObject.getString("msg"), JSON.toJSON(param), jsonObject); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | public JSONObject startSendRtp(MediaServerItem mediaInfo, SendRtpItem sendRtpItem) { |
| | | String is_Udp = sendRtpItem.isTcp() ? "0" : "1"; |
| | | logger.info("rtp/{}开始向上级推流, 目标={}:{},SSRC={}", sendRtpItem.getStreamId(), sendRtpItem.getIp(), sendRtpItem.getPort(), sendRtpItem.getSsrc()); |
| | | logger.info("rtp/{}开始推流, 目标={}:{},SSRC={}", sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort(), sendRtpItem.getSsrc()); |
| | | Map<String, Object> param = new HashMap<>(12); |
| | | param.put("vhost","__defaultVhost__"); |
| | | param.put("app",sendRtpItem.getApp()); |
| | | param.put("stream",sendRtpItem.getStreamId()); |
| | | param.put("stream",sendRtpItem.getStream()); |
| | | param.put("ssrc", sendRtpItem.getSsrc()); |
| | | param.put("src_port", sendRtpItem.getLocalPort()); |
| | | param.put("pt", sendRtpItem.getPt()); |