| | |
| | | return result; |
| | | } |
| | | |
| | | // private int getPortFromportRange(MediaServerItem mediaServerItem) { |
| | | // int currentPort = mediaServerItem.getCurrentPort(); |
| | | // if (currentPort == 0) { |
| | | // String[] portRangeStrArray = mediaServerItem.getSendRtpPortRange().split(","); |
| | | // if (portRangeStrArray.length != 2) { |
| | | // portRangeArray[0] = 30000; |
| | | // portRangeArray[1] = 30500; |
| | | // }else { |
| | | // portRangeArray[0] = Integer.parseInt(portRangeStrArray[0]); |
| | | // portRangeArray[1] = Integer.parseInt(portRangeStrArray[1]); |
| | | // } |
| | | // } |
| | | // |
| | | // if (currentPort == 0 || currentPort++ > portRangeArray[1]) { |
| | | // currentPort = portRangeArray[0]; |
| | | // mediaServerItem.setCurrentPort(currentPort); |
| | | // return portRangeArray[0]; |
| | | // } else { |
| | | // if (currentPort % 2 == 1) { |
| | | // currentPort++; |
| | | // } |
| | | // currentPort++; |
| | | // mediaServerItem.setCurrentPort(currentPort); |
| | | // return currentPort; |
| | | // } |
| | | // } |
| | | |
| | | /** |
| | | * 创建一个国标推流 |
| | | * @param ip 推流ip |
| | |
| | | } |
| | | |
| | | /** |
| | | * 调用zlm RESTFUL API —— startSendRtpPassive |
| | | */ |
| | | public JSONObject startSendRtpPassive(MediaServerItem mediaServerItem, Map<String, Object>param) { |
| | | return zlmresTfulUtils.startSendRtpPassive(mediaServerItem, param); |
| | | } |
| | | |
| | | /** |
| | | * 查询待转推的流是否就绪 |
| | | */ |
| | | public Boolean isRtpReady(MediaServerItem mediaServerItem, String streamId) { |
| | |
| | | return 0; |
| | | } |
| | | Integer code = mediaInfo.getInteger("code"); |
| | | if ( code < 0) { |
| | | if (code < 0) { |
| | | logger.warn("查询流({}/{})是否有其它观看者时得到: {}", app, streamId, mediaInfo.getString("msg")); |
| | | return -1; |
| | | } |
| | | if ( code == 0 && mediaInfo.getBoolean("online") != null && !mediaInfo.getBoolean("online")) { |
| | | if ( code == 0 && mediaInfo.getBoolean("online") != null && ! mediaInfo.getBoolean("online")) { |
| | | logger.warn("查询流({}/{})是否有其它观看者时得到: {}", app, streamId, mediaInfo.getString("msg")); |
| | | return -1; |
| | | } |
| | |
| | | Boolean result = false; |
| | | JSONObject jsonObject = zlmresTfulUtils.stopSendRtp(mediaServerItem, param); |
| | | if (jsonObject == null) { |
| | | logger.error("停止RTP推流失败: 请检查ZLM服务"); |
| | | logger.error("[停止RTP推流] 失败: 请检查ZLM服务"); |
| | | } else if (jsonObject.getInteger("code") == 0) { |
| | | result= true; |
| | | logger.info("停止RTP推流成功"); |
| | | logger.info("[停止RTP推流] 成功"); |
| | | } else { |
| | | logger.error("停止RTP推流失败: {}, 参数:{}",jsonObject.getString("msg"),JSONObject.toJSON(param)); |
| | | logger.error("[停止RTP推流] 失败: {}, 参数:{}->\r\n{}",jsonObject.getString("msg"),JSONObject.toJSON(param), jsonObject); |
| | | } |
| | | return result; |
| | | } |