648540858
2023-03-21 82adc0cb23f3ee47322e78889cdaba57e9309000
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java
@@ -36,7 +36,7 @@
            // 设置连接超时时间
            httpClientBuilder.connectTimeout(5,TimeUnit.SECONDS);
            // 设置读取超时时间
            httpClientBuilder.readTimeout(5,TimeUnit.SECONDS);
            httpClientBuilder.readTimeout(10,TimeUnit.SECONDS);
            // 设置连接池
            httpClientBuilder.connectionPool(new ConnectionPool(16, 5, TimeUnit.MINUTES));
            if (logger.isDebugEnabled()) {
@@ -85,6 +85,7 @@
            if (callback == null) {
                try {
                    Response response = client.newCall(request).execute();
                    if (response.isSuccessful()) {
                        ResponseBody responseBody = response.body();
                        if (responseBody != null) {
@@ -92,6 +93,8 @@
                            responseJSON = JSON.parseObject(responseStr);
                        }
                    }else {
                        System.out.println( 2222);
                        System.out.println( response.code());
                        response.close();
                        Objects.requireNonNull(response.body()).close();
                    }
@@ -100,11 +103,11 @@
                    if(e instanceof SocketTimeoutException){
                        //读取超时超时异常
                        logger.error(String.format("读取ZLM数据失败: %s, %s", url, e.getMessage()));
                        logger.error(String.format("读取ZLM数据超时失败: %s, %s", url, e.getMessage()));
                    }
                    if(e instanceof ConnectException){
                        //判断连接异常,我这里是报Failed to connect to 10.7.5.144
                        logger.error(String.format("连接ZLM失败: %s, %s", url, e.getMessage()));
                        logger.error(String.format("连接ZLM连接失败: %s, %s", url, e.getMessage()));
                    }
                }catch (Exception e){
@@ -284,6 +287,14 @@
        return sendPost(mediaServerItem, "startSendRtp",param, null);
    }
    public JSONObject startSendRtpPassive(MediaServerItem mediaServerItem, Map<String, Object> param) {
        return sendPost(mediaServerItem, "startSendRtpPassive",param, null);
    }
    public JSONObject startSendRtpPassive(MediaServerItem mediaServerItem, Map<String, Object> param, RequestCallback callback) {
        return sendPost(mediaServerItem, "startSendRtpPassive",param, callback);
    }
    public JSONObject stopSendRtp(MediaServerItem mediaServerItem, Map<String, Object> param) {
        return sendPost(mediaServerItem, "stopSendRtp",param, null);
    }