| | |
| | | int result = -1; |
| | | // 查询此rtp server 是否已经存在 |
| | | JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(mediaServerItem, streamId); |
| | | logger.info(JSONObject.toJSONString(rtpInfo)); |
| | | if(rtpInfo.getInteger("code") == 0){ |
| | | if (rtpInfo.getBoolean("exist")) { |
| | | result = rtpInfo.getInteger("local_port"); |
| | | if (result == 0) { |
| | | // 此时说明rtpServer已经创建但是流还没有推上来 |
| | | |
| | | } |
| | | return result; |
| | | } |
| | | }else if(rtpInfo.getInteger("code") == -2){ |
| | |
| | | } |
| | | param.put("ssrc", ssrc); |
| | | JSONObject openRtpServerResultJson = zlmresTfulUtils.openRtpServer(mediaServerItem, param); |
| | | |
| | | logger.info(JSONObject.toJSONString(openRtpServerResultJson)); |
| | | if (openRtpServerResultJson != null) { |
| | | if (openRtpServerResultJson.getInteger("code") == 0) { |
| | | result= openRtpServerResultJson.getInteger("port"); |
| | |
| | | * 查询待转推的流是否就绪 |
| | | */ |
| | | public Boolean isRtpReady(MediaServerItem mediaServerItem, String streamId) { |
| | | JSONObject mediaInfo = zlmresTfulUtils.getMediaInfo(mediaServerItem,"rtp", "rtmp", streamId); |
| | | JSONObject mediaInfo = zlmresTfulUtils.getMediaInfo(mediaServerItem,"rtp", "rtsp", streamId); |
| | | return (mediaInfo.getInteger("code") == 0 && mediaInfo.getBoolean("online")); |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | public int totalReaderCount(MediaServerItem mediaServerItem, String app, String streamId) { |
| | | JSONObject mediaInfo = zlmresTfulUtils.getMediaInfo(mediaServerItem, app, "rtmp", streamId); |
| | | JSONObject mediaInfo = zlmresTfulUtils.getMediaInfo(mediaServerItem, app, "rtsp", streamId); |
| | | if (mediaInfo == null) { |
| | | return 0; |
| | | } |