From d7a1b94f905c5f28c9c8f2d48c3f9e28ebcf9cc4 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期六, 24 九月 2022 21:04:58 +0800 Subject: [PATCH] Merge branch 'wvp-28181-2.0' --- src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java | 31 +++++++++++++++++++++++++------ 1 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java index 6caff71..80ae95e 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java @@ -98,7 +98,18 @@ result = rtpInfo.getInteger("local_port"); if (result == 0) { // 姝ゆ椂璇存槑rtpServer宸茬粡鍒涘缓浣嗘槸娴佽繕娌℃湁鎺ㄤ笂鏉� - + // 姝ゆ椂閲嶆柊鎵撳紑rtpServer + Map<String, Object> param = new HashMap<>(); + param.put("stream_id", streamId); + JSONObject jsonObject = zlmresTfulUtils.closeRtpServer(mediaServerItem, param); + if (jsonObject != null ) { + System.out.println(jsonObject); + if (jsonObject.getInteger("code") == 0) { + return createRTPServer(mediaServerItem, streamId, ssrc, port); + }else { + logger.warn("[寮�鍚痳tpServer], 閲嶅惎RtpServer閿欒"); + } + } } return result; } @@ -139,6 +150,7 @@ param.put("stream_id", streamId); JSONObject jsonObject = zlmresTfulUtils.closeRtpServer(serverItem, param); if (jsonObject != null ) { + System.out.println(jsonObject); if (jsonObject.getInteger("code") == 0) { result = jsonObject.getInteger("hit") == 1; }else { @@ -272,6 +284,13 @@ } /** + * 璋冪敤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) { @@ -300,11 +319,11 @@ 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; } @@ -318,12 +337,12 @@ Boolean result = false; JSONObject jsonObject = zlmresTfulUtils.stopSendRtp(mediaServerItem, param); if (jsonObject == null) { - logger.error("鍋滄RTP鎺ㄦ祦澶辫触: 璇锋鏌LM鏈嶅姟"); + logger.error("[鍋滄RTP鎺ㄦ祦] 澶辫触: 璇锋鏌LM鏈嶅姟"); } 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; } -- Gitblit v1.8.0