From f635f9c3003ae10f7be8e934b81bc480c82617ba Mon Sep 17 00:00:00 2001 From: xiaoxie <hotcoffie@163.com> Date: 星期三, 20 四月 2022 13:56:30 +0800 Subject: [PATCH] 修复录像列表:实测部分厂家(TP-Link IPC43AW)录像列表接口,返回的xml报文数据中有多余的空格,导致解析String为Integer失败,增加trim修复这个问题 --- src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 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 57afd93..cf8e006 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 @@ -81,14 +81,20 @@ return result; } - public int createRTPServer(MediaServerItem mediaServerItem, String streamId) { - - Map<String, Object> param = new HashMap<>(); + public int createRTPServer(MediaServerItem mediaServerItem, String streamId, int ssrc) { int result = -1; + // 鏌ヨ姝tp server 鏄惁宸茬粡瀛樺湪 + JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(mediaServerItem, streamId); + if (rtpInfo != null && rtpInfo.getInteger("code") == 0 && rtpInfo.getBoolean("exist")) { + result = rtpInfo.getInteger("local_port"); + return result; + } + Map<String, Object> param = new HashMap<>(); // 鎺ㄦ祦绔彛璁剧疆0鍒欎娇鐢ㄩ殢鏈虹鍙� param.put("enable_tcp", 1); param.put("stream_id", streamId); param.put("port", 0); + param.put("ssrc", ssrc); JSONObject openRtpServerResultJson = zlmresTfulUtils.openRtpServer(mediaServerItem, param); if (openRtpServerResultJson != null) { @@ -301,7 +307,7 @@ result= true; logger.info("鍋滄RTP鎺ㄦ祦鎴愬姛"); } else { - logger.error("RTP鎺ㄦ祦澶辫触: {}, 鍙傛暟锛歿}",jsonObject.getString("msg"),JSONObject.toJSON(param)); + logger.error("鍋滄RTP鎺ㄦ祦澶辫触: {}, 鍙傛暟锛歿}",jsonObject.getString("msg"),JSONObject.toJSON(param)); } return result; } -- Gitblit v1.8.0