old mode 100644
new mode 100755
| | |
| | | * @param tcpMode 0/null udp 模式,1 tcp 被动模式, 2 tcp 主动模式。 |
| | | * @return |
| | | */ |
| | | public int createRTPServer(MediaServerItem mediaServerItem, String streamId, int ssrc, Integer port, Boolean onlyAuto, Boolean reUsePort, Integer tcpMode) { |
| | | public int createRTPServer(MediaServerItem mediaServerItem, String streamId, long ssrc, Integer port, Boolean onlyAuto, Boolean reUsePort, Integer tcpMode) { |
| | | int result = -1; |
| | | // 查询此rtp server 是否已经存在 |
| | | JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(mediaServerItem, streamId); |
| | |
| | | }else { |
| | | param.put("port", port); |
| | | } |
| | | param.put("ssrc", ssrc); |
| | | if (onlyAuto != null) { |
| | | param.put("only_audio", onlyAuto?"1":"0"); |
| | | } |
| | | if (ssrc != 0) { |
| | | param.put("ssrc", ssrc); |
| | | } |
| | | |
| | | JSONObject openRtpServerResultJson = zlmresTfulUtils.openRtpServer(mediaServerItem, param); |
| | | logger.info(JSONObject.toJSONString(openRtpServerResultJson)); |
| | | if (openRtpServerResultJson != null) { |
| | |
| | | public SendRtpItem createSendRtpItem(MediaServerItem serverItem, String ip, int port, String ssrc, String platformId, |
| | | String deviceId, String channelId, boolean tcp, boolean rtcp){ |
| | | |
| | | // 默认为随机端口 |
| | | int localPort = 0; |
| | | if (userSetting.getGbSendStreamStrict()) { |
| | | localPort = sendRtpPortManager.getNextPort(serverItem.getId()); |
| | | if (localPort == 0) { |
| | | return null; |
| | | } |
| | | int localPort = sendRtpPortManager.getNextPort(serverItem); |
| | | if (localPort == 0) { |
| | | return null; |
| | | } |
| | | SendRtpItem sendRtpItem = new SendRtpItem(); |
| | | sendRtpItem.setIp(ip); |
| | |
| | | */ |
| | | public SendRtpItem createSendRtpItem(MediaServerItem serverItem, String ip, int port, String ssrc, String platformId, |
| | | String app, String stream, String channelId, boolean tcp, boolean rtcp){ |
| | | // 默认为随机端口 |
| | | int localPort = 0; |
| | | if (userSetting.getGbSendStreamStrict()) { |
| | | localPort = sendRtpPortManager.getNextPort(serverItem.getId()); |
| | | if (localPort == 0) { |
| | | return null; |
| | | } |
| | | |
| | | int localPort = sendRtpPortManager.getNextPort(serverItem); |
| | | if (localPort == 0) { |
| | | return null; |
| | | } |
| | | SendRtpItem sendRtpItem = new SendRtpItem(); |
| | | sendRtpItem.setIp(ip); |
| | |
| | | * 调用zlm RESTful API —— stopSendRtp |
| | | */ |
| | | public Boolean stopSendRtpStream(MediaServerItem mediaServerItem, Map<String, Object>param) { |
| | | if (mediaServerItem == null) { |
| | | logger.error("[停止RTP推流] 失败: 媒体节点为NULL"); |
| | | return false; |
| | | } |
| | | Boolean result = false; |
| | | JSONObject jsonObject = zlmresTfulUtils.stopSendRtp(mediaServerItem, param); |
| | | if (jsonObject == null) { |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | public JSONObject stopSendRtpStream(MediaServerItem mediaServerItem, SendRtpItem sendRtpItem) { |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("vhost", "__defaultVhost__"); |
| | | param.put("app", sendRtpItem.getApp()); |
| | | param.put("stream", sendRtpItem.getStream()); |
| | | param.put("ssrc", sendRtpItem.getSsrc()); |
| | | return zlmresTfulUtils.stopSendRtp(mediaServerItem, param); |
| | | } |
| | | } |