Commit ee7ef0bf4131ad7b6f91ca204c2b54b7c671dd08

Authored by 648540858
1 parent 7db2bf7b

优化级联平台注册的周期时间

src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java
@@ -90,7 +90,7 @@ public class ParentPlatform { @@ -90,7 +90,7 @@ public class ParentPlatform {
90 * 心跳周期(秒) 90 * 心跳周期(秒)
91 */ 91 */
92 @Schema(description = "心跳周期(秒)") 92 @Schema(description = "心跳周期(秒)")
93 - private String keepTimeout; 93 + private int keepTimeout;
94 94
95 /** 95 /**
96 * 传输协议 96 * 传输协议
@@ -294,11 +294,11 @@ public class ParentPlatform { @@ -294,11 +294,11 @@ public class ParentPlatform {
294 this.expires = expires; 294 this.expires = expires;
295 } 295 }
296 296
297 - public String getKeepTimeout() { 297 + public int getKeepTimeout() {
298 return keepTimeout; 298 return keepTimeout;
299 } 299 }
300 300
301 - public void setKeepTimeout(String keepTimeout) { 301 + public void setKeepTimeout(int keepTimeout) {
302 this.keepTimeout = keepTimeout; 302 this.keepTimeout = keepTimeout;
303 } 303 }
304 304
src/main/java/com/genersoft/iot/vmp/gb28181/conf/SipLoggerPass.java 0 → 100644
  1 +package com.genersoft.iot.vmp.gb28181.conf;
  2 +
  3 +import gov.nist.core.StackLogger;
  4 +
  5 +import java.util.Properties;
  6 +
  7 +/**
  8 + * sip日志格式化
  9 + */
  10 +public class SipLoggerPass implements StackLogger {
  11 +
  12 + @Override
  13 + public void logStackTrace() {
  14 +
  15 + }
  16 +
  17 + @Override
  18 + public void logStackTrace(int traceLevel) {
  19 +
  20 + }
  21 +
  22 + @Override
  23 + public int getLineCount() {
  24 + return 0;
  25 + }
  26 +
  27 + @Override
  28 + public void logException(Throwable ex) {
  29 +
  30 + }
  31 +
  32 + @Override
  33 + public void logDebug(String message) {
  34 +
  35 + }
  36 +
  37 + @Override
  38 + public void logDebug(String message, Exception ex) {
  39 +
  40 + }
  41 +
  42 + @Override
  43 + public void logTrace(String message) {
  44 +
  45 + }
  46 +
  47 + @Override
  48 + public void logFatalError(String message) {
  49 +
  50 + }
  51 +
  52 + @Override
  53 + public void logError(String message) {
  54 +
  55 + }
  56 +
  57 + @Override
  58 + public boolean isLoggingEnabled() {
  59 + return false;
  60 + }
  61 +
  62 + @Override
  63 + public boolean isLoggingEnabled(int logLevel) {
  64 + return false;
  65 + }
  66 +
  67 + @Override
  68 + public void logError(String message, Exception ex) {
  69 +
  70 + }
  71 +
  72 + @Override
  73 + public void logWarning(String string) {
  74 +
  75 + }
  76 +
  77 + @Override
  78 + public void logInfo(String string) {
  79 +
  80 + }
  81 +
  82 + @Override
  83 + public void disableLogging() {
  84 +
  85 + }
  86 +
  87 + @Override
  88 + public void enableLogging() {
  89 +
  90 + }
  91 +
  92 + @Override
  93 + public void setBuildTimeStamp(String buildTimeStamp) {
  94 +
  95 + }
  96 +
  97 + @Override
  98 + public void setStackProperties(Properties stackProperties) {
  99 +
  100 + }
  101 +
  102 + @Override
  103 + public String getLoggerName() {
  104 + return null;
  105 + }
  106 +}
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
@@ -103,7 +103,7 @@ public class ZLMHttpHookListener { @@ -103,7 +103,7 @@ public class ZLMHttpHookListener {
103 */ 103 */
104 @ResponseBody 104 @ResponseBody
105 @PostMapping(value = "/on_server_keepalive", produces = "application/json;charset=UTF-8") 105 @PostMapping(value = "/on_server_keepalive", produces = "application/json;charset=UTF-8")
106 - public ResponseEntity<String> onServerKeepalive(@RequestBody JSONObject json){ 106 + public JSONObject onServerKeepalive(@RequestBody JSONObject json){
107 107
108 logger.info("[ ZLM HOOK ] on_server_keepalive API调用,参数:" + json.toString()); 108 logger.info("[ ZLM HOOK ] on_server_keepalive API调用,参数:" + json.toString());
109 String mediaServerId = json.getString("mediaServerId"); 109 String mediaServerId = json.getString("mediaServerId");
@@ -118,7 +118,8 @@ public class ZLMHttpHookListener { @@ -118,7 +118,8 @@ public class ZLMHttpHookListener {
118 JSONObject ret = new JSONObject(); 118 JSONObject ret = new JSONObject();
119 ret.put("code", 0); 119 ret.put("code", 0);
120 ret.put("msg", "success"); 120 ret.put("msg", "success");
121 - return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); 121 +
  122 + return ret;
122 } 123 }
123 124
124 /** 125 /**
@@ -127,16 +128,15 @@ public class ZLMHttpHookListener { @@ -127,16 +128,15 @@ public class ZLMHttpHookListener {
127 */ 128 */
128 @ResponseBody 129 @ResponseBody
129 @PostMapping(value = "/on_flow_report", produces = "application/json;charset=UTF-8") 130 @PostMapping(value = "/on_flow_report", produces = "application/json;charset=UTF-8")
130 - public ResponseEntity<String> onFlowReport(@RequestBody JSONObject json){ 131 + public JSONObject onFlowReport(@RequestBody JSONObject json){
131 132
132 if (logger.isDebugEnabled()) { 133 if (logger.isDebugEnabled()) {
133 logger.debug("[ ZLM HOOK ]on_flow_report API调用,参数:" + json.toString()); 134 logger.debug("[ ZLM HOOK ]on_flow_report API调用,参数:" + json.toString());
134 } 135 }
135 - String mediaServerId = json.getString("mediaServerId");  
136 JSONObject ret = new JSONObject(); 136 JSONObject ret = new JSONObject();
137 ret.put("code", 0); 137 ret.put("code", 0);
138 ret.put("msg", "success"); 138 ret.put("msg", "success");
139 - return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); 139 + return ret;
140 } 140 }
141 141
142 /** 142 /**
@@ -145,7 +145,7 @@ public class ZLMHttpHookListener { @@ -145,7 +145,7 @@ public class ZLMHttpHookListener {
145 */ 145 */
146 @ResponseBody 146 @ResponseBody
147 @PostMapping(value = "/on_http_access", produces = "application/json;charset=UTF-8") 147 @PostMapping(value = "/on_http_access", produces = "application/json;charset=UTF-8")
148 - public ResponseEntity<String> onHttpAccess(@RequestBody JSONObject json){ 148 + public JSONObject onHttpAccess(@RequestBody JSONObject json){
149 149
150 if (logger.isDebugEnabled()) { 150 if (logger.isDebugEnabled()) {
151 logger.debug("[ ZLM HOOK ]on_http_access API 调用,参数:" + json.toString()); 151 logger.debug("[ ZLM HOOK ]on_http_access API 调用,参数:" + json.toString());
@@ -156,7 +156,7 @@ public class ZLMHttpHookListener { @@ -156,7 +156,7 @@ public class ZLMHttpHookListener {
156 ret.put("err", ""); 156 ret.put("err", "");
157 ret.put("path", ""); 157 ret.put("path", "");
158 ret.put("second", 600); 158 ret.put("second", 600);
159 - return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); 159 + return ret;
160 } 160 }
161 161
162 /** 162 /**
@@ -165,7 +165,7 @@ public class ZLMHttpHookListener { @@ -165,7 +165,7 @@ public class ZLMHttpHookListener {
165 */ 165 */
166 @ResponseBody 166 @ResponseBody
167 @PostMapping(value = "/on_play", produces = "application/json;charset=UTF-8") 167 @PostMapping(value = "/on_play", produces = "application/json;charset=UTF-8")
168 - public ResponseEntity<String> onPlay(@RequestBody OnPlayHookParam param){ 168 + public JSONObject onPlay(@RequestBody OnPlayHookParam param){
169 169
170 JSONObject json = (JSONObject)JSON.toJSON(param); 170 JSONObject json = (JSONObject)JSON.toJSON(param);
171 171
@@ -187,13 +187,13 @@ public class ZLMHttpHookListener { @@ -187,13 +187,13 @@ public class ZLMHttpHookListener {
187 if (streamAuthorityInfo != null && streamAuthorityInfo.getCallId() != null && !streamAuthorityInfo.getCallId().equals(paramMap.get("callId"))) { 187 if (streamAuthorityInfo != null && streamAuthorityInfo.getCallId() != null && !streamAuthorityInfo.getCallId().equals(paramMap.get("callId"))) {
188 ret.put("code", 401); 188 ret.put("code", 401);
189 ret.put("msg", "Unauthorized"); 189 ret.put("msg", "Unauthorized");
190 - return new ResponseEntity<>(ret.toString(),HttpStatus.OK); 190 + return ret;
191 } 191 }
192 } 192 }
193 193
194 ret.put("code", 0); 194 ret.put("code", 0);
195 ret.put("msg", "success"); 195 ret.put("msg", "success");
196 - return new ResponseEntity<>(ret.toString(),HttpStatus.OK); 196 + return ret;
197 } 197 }
198 198
199 /** 199 /**
@@ -202,7 +202,7 @@ public class ZLMHttpHookListener { @@ -202,7 +202,7 @@ public class ZLMHttpHookListener {
202 */ 202 */
203 @ResponseBody 203 @ResponseBody
204 @PostMapping(value = "/on_publish", produces = "application/json;charset=UTF-8") 204 @PostMapping(value = "/on_publish", produces = "application/json;charset=UTF-8")
205 - public ResponseEntity<String> onPublish(@RequestBody OnPublishHookParam param) { 205 + public JSONObject onPublish(@RequestBody OnPublishHookParam param) {
206 206
207 JSONObject json = (JSONObject) JSON.toJSON(param); 207 JSONObject json = (JSONObject) JSON.toJSON(param);
208 208
@@ -216,7 +216,7 @@ public class ZLMHttpHookListener { @@ -216,7 +216,7 @@ public class ZLMHttpHookListener {
216 logger.info("推流鉴权失败: 缺少不要参数:sign=md5(user表的pushKey)"); 216 logger.info("推流鉴权失败: 缺少不要参数:sign=md5(user表的pushKey)");
217 ret.put("code", 401); 217 ret.put("code", 401);
218 ret.put("msg", "Unauthorized"); 218 ret.put("msg", "Unauthorized");
219 - return new ResponseEntity<>(ret.toString(), HttpStatus.OK); 219 + return ret;
220 } 220 }
221 Map<String, String> paramMap = urlParamToMap(param.getParams()); 221 Map<String, String> paramMap = urlParamToMap(param.getParams());
222 String sign = paramMap.get("sign"); 222 String sign = paramMap.get("sign");
@@ -224,7 +224,7 @@ public class ZLMHttpHookListener { @@ -224,7 +224,7 @@ public class ZLMHttpHookListener {
224 logger.info("推流鉴权失败: 缺少不要参数:sign=md5(user表的pushKey)"); 224 logger.info("推流鉴权失败: 缺少不要参数:sign=md5(user表的pushKey)");
225 ret.put("code", 401); 225 ret.put("code", 401);
226 ret.put("msg", "Unauthorized"); 226 ret.put("msg", "Unauthorized");
227 - return new ResponseEntity<>(ret.toString(), HttpStatus.OK); 227 + return ret;
228 } 228 }
229 // 推流自定义播放鉴权码 229 // 推流自定义播放鉴权码
230 String callId = paramMap.get("callId"); 230 String callId = paramMap.get("callId");
@@ -234,7 +234,7 @@ public class ZLMHttpHookListener { @@ -234,7 +234,7 @@ public class ZLMHttpHookListener {
234 logger.info("推流鉴权失败: sign 无权限: callId={}. sign={}", callId, sign); 234 logger.info("推流鉴权失败: sign 无权限: callId={}. sign={}", callId, sign);
235 ret.put("code", 401); 235 ret.put("code", 401);
236 ret.put("msg", "Unauthorized"); 236 ret.put("msg", "Unauthorized");
237 - return new ResponseEntity<>(ret.toString(), HttpStatus.OK); 237 + return ret;
238 } 238 }
239 StreamAuthorityInfo streamAuthorityInfo = StreamAuthorityInfo.getInstanceByHook(param); 239 StreamAuthorityInfo streamAuthorityInfo = StreamAuthorityInfo.getInstanceByHook(param);
240 streamAuthorityInfo.setCallId(callId); 240 streamAuthorityInfo.setCallId(callId);
@@ -242,12 +242,11 @@ public class ZLMHttpHookListener { @@ -242,12 +242,11 @@ public class ZLMHttpHookListener {
242 // 鉴权通过 242 // 鉴权通过
243 redisCatchStorage.updateStreamAuthorityInfo(param.getApp(), param.getStream(), streamAuthorityInfo); 243 redisCatchStorage.updateStreamAuthorityInfo(param.getApp(), param.getStream(), streamAuthorityInfo);
244 // 通知assist新的callId 244 // 通知assist新的callId
245 - taskExecutor.execute(()->{  
246 - if (mediaInfo != null && mediaInfo.getRecordAssistPort() > 0) { 245 + if (mediaInfo != null && mediaInfo.getRecordAssistPort() > 0) {
  246 + taskExecutor.execute(()->{
247 assistRESTfulUtils.addStreamCallInfo(mediaInfo, param.getApp(), param.getStream(), callId, null); 247 assistRESTfulUtils.addStreamCallInfo(mediaInfo, param.getApp(), param.getStream(), callId, null);
248 - }  
249 - });  
250 - 248 + });
  249 + }
251 }else { 250 }else {
252 zlmMediaListManager.sendStreamEvent(param.getApp(),param.getStream(), param.getMediaServerId()); 251 zlmMediaListManager.sendStreamEvent(param.getApp(),param.getStream(), param.getMediaServerId());
253 } 252 }
@@ -291,10 +290,7 @@ public class ZLMHttpHookListener { @@ -291,10 +290,7 @@ public class ZLMHttpHookListener {
291 290
292 } 291 }
293 } 292 }
294 -  
295 -  
296 -  
297 - return new ResponseEntity<String>(ret.toString(), HttpStatus.OK); 293 + return ret;
298 } 294 }
299 295
300 296
@@ -305,7 +301,7 @@ public class ZLMHttpHookListener { @@ -305,7 +301,7 @@ public class ZLMHttpHookListener {
305 */ 301 */
306 @ResponseBody 302 @ResponseBody
307 @PostMapping(value = "/on_record_mp4", produces = "application/json;charset=UTF-8") 303 @PostMapping(value = "/on_record_mp4", produces = "application/json;charset=UTF-8")
308 - public ResponseEntity<String> onRecordMp4(@RequestBody JSONObject json){ 304 + public JSONObject onRecordMp4(@RequestBody JSONObject json){
309 305
310 if (logger.isDebugEnabled()) { 306 if (logger.isDebugEnabled()) {
311 logger.debug("[ ZLM HOOK ]on_record_mp4 API调用,参数:" + json.toString()); 307 logger.debug("[ ZLM HOOK ]on_record_mp4 API调用,参数:" + json.toString());
@@ -314,7 +310,7 @@ public class ZLMHttpHookListener { @@ -314,7 +310,7 @@ public class ZLMHttpHookListener {
314 JSONObject ret = new JSONObject(); 310 JSONObject ret = new JSONObject();
315 ret.put("code", 0); 311 ret.put("code", 0);
316 ret.put("msg", "success"); 312 ret.put("msg", "success");
317 - return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); 313 + return ret;
318 } 314 }
319 /** 315 /**
320 * 录制hls完成后通知事件;此事件对回复不敏感。 316 * 录制hls完成后通知事件;此事件对回复不敏感。
@@ -322,7 +318,7 @@ public class ZLMHttpHookListener { @@ -322,7 +318,7 @@ public class ZLMHttpHookListener {
322 */ 318 */
323 @ResponseBody 319 @ResponseBody
324 @PostMapping(value = "/on_record_ts", produces = "application/json;charset=UTF-8") 320 @PostMapping(value = "/on_record_ts", produces = "application/json;charset=UTF-8")
325 - public ResponseEntity<String> onRecordTs(@RequestBody JSONObject json){ 321 + public JSONObject onRecordTs(@RequestBody JSONObject json){
326 322
327 if (logger.isDebugEnabled()) { 323 if (logger.isDebugEnabled()) {
328 logger.debug("[ ZLM HOOK ]on_record_ts API调用,参数:" + json.toString()); 324 logger.debug("[ ZLM HOOK ]on_record_ts API调用,参数:" + json.toString());
@@ -331,7 +327,7 @@ public class ZLMHttpHookListener { @@ -331,7 +327,7 @@ public class ZLMHttpHookListener {
331 JSONObject ret = new JSONObject(); 327 JSONObject ret = new JSONObject();
332 ret.put("code", 0); 328 ret.put("code", 0);
333 ret.put("msg", "success"); 329 ret.put("msg", "success");
334 - return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); 330 + return ret;
335 } 331 }
336 332
337 /** 333 /**
@@ -340,7 +336,7 @@ public class ZLMHttpHookListener { @@ -340,7 +336,7 @@ public class ZLMHttpHookListener {
340 */ 336 */
341 @ResponseBody 337 @ResponseBody
342 @PostMapping(value = "/on_rtsp_realm", produces = "application/json;charset=UTF-8") 338 @PostMapping(value = "/on_rtsp_realm", produces = "application/json;charset=UTF-8")
343 - public ResponseEntity<String> onRtspRealm(@RequestBody JSONObject json){ 339 + public JSONObject onRtspRealm(@RequestBody JSONObject json){
344 340
345 if (logger.isDebugEnabled()) { 341 if (logger.isDebugEnabled()) {
346 logger.debug("[ ZLM HOOK ]on_rtsp_realm API调用,参数:" + json.toString()); 342 logger.debug("[ ZLM HOOK ]on_rtsp_realm API调用,参数:" + json.toString());
@@ -349,7 +345,7 @@ public class ZLMHttpHookListener { @@ -349,7 +345,7 @@ public class ZLMHttpHookListener {
349 JSONObject ret = new JSONObject(); 345 JSONObject ret = new JSONObject();
350 ret.put("code", 0); 346 ret.put("code", 0);
351 ret.put("realm", ""); 347 ret.put("realm", "");
352 - return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); 348 + return ret;
353 } 349 }
354 350
355 351
@@ -359,7 +355,7 @@ public class ZLMHttpHookListener { @@ -359,7 +355,7 @@ public class ZLMHttpHookListener {
359 */ 355 */
360 @ResponseBody 356 @ResponseBody
361 @PostMapping(value = "/on_rtsp_auth", produces = "application/json;charset=UTF-8") 357 @PostMapping(value = "/on_rtsp_auth", produces = "application/json;charset=UTF-8")
362 - public ResponseEntity<String> onRtspAuth(@RequestBody JSONObject json){ 358 + public JSONObject onRtspAuth(@RequestBody JSONObject json){
363 359
364 if (logger.isDebugEnabled()) { 360 if (logger.isDebugEnabled()) {
365 logger.debug("[ ZLM HOOK ]on_rtsp_auth API调用,参数:" + json.toString()); 361 logger.debug("[ ZLM HOOK ]on_rtsp_auth API调用,参数:" + json.toString());
@@ -369,7 +365,7 @@ public class ZLMHttpHookListener { @@ -369,7 +365,7 @@ public class ZLMHttpHookListener {
369 ret.put("code", 0); 365 ret.put("code", 0);
370 ret.put("encrypted", false); 366 ret.put("encrypted", false);
371 ret.put("passwd", "test"); 367 ret.put("passwd", "test");
372 - return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); 368 + return ret;
373 } 369 }
374 370
375 /** 371 /**
@@ -378,7 +374,7 @@ public class ZLMHttpHookListener { @@ -378,7 +374,7 @@ public class ZLMHttpHookListener {
378 */ 374 */
379 @ResponseBody 375 @ResponseBody
380 @PostMapping(value = "/on_shell_login", produces = "application/json;charset=UTF-8") 376 @PostMapping(value = "/on_shell_login", produces = "application/json;charset=UTF-8")
381 - public ResponseEntity<String> onShellLogin(@RequestBody JSONObject json){ 377 + public JSONObject onShellLogin(@RequestBody JSONObject json){
382 378
383 if (logger.isDebugEnabled()) { 379 if (logger.isDebugEnabled()) {
384 logger.debug("[ ZLM HOOK ]on_shell_login API调用,参数:" + json.toString()); 380 logger.debug("[ ZLM HOOK ]on_shell_login API调用,参数:" + json.toString());
@@ -396,7 +392,7 @@ public class ZLMHttpHookListener { @@ -396,7 +392,7 @@ public class ZLMHttpHookListener {
396 JSONObject ret = new JSONObject(); 392 JSONObject ret = new JSONObject();
397 ret.put("code", 0); 393 ret.put("code", 0);
398 ret.put("msg", "success"); 394 ret.put("msg", "success");
399 - return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); 395 + return ret;
400 } 396 }
401 397
402 /** 398 /**
@@ -405,7 +401,7 @@ public class ZLMHttpHookListener { @@ -405,7 +401,7 @@ public class ZLMHttpHookListener {
405 */ 401 */
406 @ResponseBody 402 @ResponseBody
407 @PostMapping(value = "/on_stream_changed", produces = "application/json;charset=UTF-8") 403 @PostMapping(value = "/on_stream_changed", produces = "application/json;charset=UTF-8")
408 - public ResponseEntity<String> onStreamChanged(@RequestBody MediaItem item){ 404 + public JSONObject onStreamChanged(@RequestBody MediaItem item){
409 405
410 logger.info("[ ZLM HOOK ]on_stream_changed API调用,参数:" + JSONObject.toJSONString(item)); 406 logger.info("[ ZLM HOOK ]on_stream_changed API调用,参数:" + JSONObject.toJSONString(item));
411 String mediaServerId = item.getMediaServerId(); 407 String mediaServerId = item.getMediaServerId();
@@ -520,7 +516,7 @@ public class ZLMHttpHookListener { @@ -520,7 +516,7 @@ public class ZLMHttpHookListener {
520 JSONObject ret = new JSONObject(); 516 JSONObject ret = new JSONObject();
521 ret.put("code", 0); 517 ret.put("code", 0);
522 ret.put("msg", "success"); 518 ret.put("msg", "success");
523 - return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); 519 + return ret;
524 } 520 }
525 521
526 /** 522 /**
@@ -529,7 +525,7 @@ public class ZLMHttpHookListener { @@ -529,7 +525,7 @@ public class ZLMHttpHookListener {
529 */ 525 */
530 @ResponseBody 526 @ResponseBody
531 @PostMapping(value = "/on_stream_none_reader", produces = "application/json;charset=UTF-8") 527 @PostMapping(value = "/on_stream_none_reader", produces = "application/json;charset=UTF-8")
532 - public ResponseEntity<String> onStreamNoneReader(@RequestBody JSONObject json){ 528 + public JSONObject onStreamNoneReader(@RequestBody JSONObject json){
533 529
534 logger.info("[ ZLM HOOK ]on_stream_none_reader API调用,参数:" + json.toString()); 530 logger.info("[ ZLM HOOK ]on_stream_none_reader API调用,参数:" + json.toString());
535 String mediaServerId = json.getString("mediaServerId"); 531 String mediaServerId = json.getString("mediaServerId");
@@ -574,7 +570,7 @@ public class ZLMHttpHookListener { @@ -574,7 +570,7 @@ public class ZLMHttpHookListener {
574 if (mediaServerItem != null && mediaServerItem.getStreamNoneReaderDelayMS() == -1) { 570 if (mediaServerItem != null && mediaServerItem.getStreamNoneReaderDelayMS() == -1) {
575 ret.put("close", false); 571 ret.put("close", false);
576 } 572 }
577 - return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); 573 + return ret;
578 }else { 574 }else {
579 StreamProxyItem streamProxyItem = streamProxyService.getStreamProxyByAppAndStream(app, streamId); 575 StreamProxyItem streamProxyItem = streamProxyService.getStreamProxyByAppAndStream(app, streamId);
580 if (streamProxyItem != null && streamProxyItem.isEnable_remove_none_reader()) { 576 if (streamProxyItem != null && streamProxyItem.isEnable_remove_none_reader()) {
@@ -585,7 +581,7 @@ public class ZLMHttpHookListener { @@ -585,7 +581,7 @@ public class ZLMHttpHookListener {
585 }else { 581 }else {
586 ret.put("close", false); 582 ret.put("close", false);
587 } 583 }
588 - return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); 584 + return ret;
589 } 585 }
590 } 586 }
591 587
@@ -595,7 +591,7 @@ public class ZLMHttpHookListener { @@ -595,7 +591,7 @@ public class ZLMHttpHookListener {
595 */ 591 */
596 @ResponseBody 592 @ResponseBody
597 @PostMapping(value = "/on_stream_not_found", produces = "application/json;charset=UTF-8") 593 @PostMapping(value = "/on_stream_not_found", produces = "application/json;charset=UTF-8")
598 - public ResponseEntity<String> onStreamNotFound(@RequestBody JSONObject json){ 594 + public JSONObject onStreamNotFound(@RequestBody JSONObject json){
599 if (logger.isDebugEnabled()) { 595 if (logger.isDebugEnabled()) {
600 logger.debug("[ ZLM HOOK ]on_stream_not_found API调用,参数:" + json.toString()); 596 logger.debug("[ ZLM HOOK ]on_stream_not_found API调用,参数:" + json.toString());
601 } 597 }
@@ -620,7 +616,7 @@ public class ZLMHttpHookListener { @@ -620,7 +616,7 @@ public class ZLMHttpHookListener {
620 JSONObject ret = new JSONObject(); 616 JSONObject ret = new JSONObject();
621 ret.put("code", 0); 617 ret.put("code", 0);
622 ret.put("msg", "success"); 618 ret.put("msg", "success");
623 - return new ResponseEntity<>(ret.toString(),HttpStatus.OK); 619 + return ret;
624 } 620 }
625 621
626 /** 622 /**
@@ -629,7 +625,7 @@ public class ZLMHttpHookListener { @@ -629,7 +625,7 @@ public class ZLMHttpHookListener {
629 */ 625 */
630 @ResponseBody 626 @ResponseBody
631 @PostMapping(value = "/on_server_started", produces = "application/json;charset=UTF-8") 627 @PostMapping(value = "/on_server_started", produces = "application/json;charset=UTF-8")
632 - public ResponseEntity<String> onServerStarted(HttpServletRequest request, @RequestBody JSONObject jsonObject){ 628 + public JSONObject onServerStarted(HttpServletRequest request, @RequestBody JSONObject jsonObject){
633 629
634 if (logger.isDebugEnabled()) { 630 if (logger.isDebugEnabled()) {
635 logger.debug("[ ZLM HOOK ]on_server_started API调用,参数:" + jsonObject.toString()); 631 logger.debug("[ ZLM HOOK ]on_server_started API调用,参数:" + jsonObject.toString());
@@ -650,7 +646,7 @@ public class ZLMHttpHookListener { @@ -650,7 +646,7 @@ public class ZLMHttpHookListener {
650 JSONObject ret = new JSONObject(); 646 JSONObject ret = new JSONObject();
651 ret.put("code", 0); 647 ret.put("code", 0);
652 ret.put("msg", "success"); 648 ret.put("msg", "success");
653 - return new ResponseEntity<>(ret.toString(),HttpStatus.OK); 649 + return ret;
654 } 650 }
655 651
656 private Map<String, String> urlParamToMap(String params) { 652 private Map<String, String> urlParamToMap(String params) {
src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java
@@ -125,7 +125,7 @@ public class PlatformServiceImpl implements IPlatformService { @@ -125,7 +125,7 @@ public class PlatformServiceImpl implements IPlatformService {
125 dynamicTask.startDelay(registerTaskKey, 125 dynamicTask.startDelay(registerTaskKey,
126 // 注册失败(注册成功时由程序直接调用了online方法) 126 // 注册失败(注册成功时由程序直接调用了online方法)
127 ()->commanderForPlatform.register(parentPlatform, eventResult -> offline(parentPlatform),null), 127 ()->commanderForPlatform.register(parentPlatform, eventResult -> offline(parentPlatform),null),
128 - parentPlatform.getExpires()*1000); 128 + (parentPlatform.getExpires() - 10) *1000);
129 129
130 final String keepaliveTaskKey = KEEPALIVE_KEY_PREFIX + parentPlatform.getServerGBId(); 130 final String keepaliveTaskKey = KEEPALIVE_KEY_PREFIX + parentPlatform.getServerGBId();
131 if (!dynamicTask.contains(keepaliveTaskKey)) { 131 if (!dynamicTask.contains(keepaliveTaskKey)) {
@@ -164,7 +164,7 @@ public class PlatformServiceImpl implements IPlatformService { @@ -164,7 +164,7 @@ public class PlatformServiceImpl implements IPlatformService {
164 redisCatchStorage.updatePlatformCatchInfo(platformCatch); 164 redisCatchStorage.updatePlatformCatchInfo(platformCatch);
165 } 165 }
166 }), 166 }),
167 - parentPlatform.getExpires()*1000); 167 + (parentPlatform.getKeepTimeout() - 10)*1000);
168 } 168 }
169 } 169 }
170 170
@@ -213,7 +213,6 @@ public class PlatformServiceImpl implements IPlatformService { @@ -213,7 +213,6 @@ public class PlatformServiceImpl implements IPlatformService {
213 param.put("stream", sendRtpItem.getStreamId()); 213 param.put("stream", sendRtpItem.getStreamId());
214 zlmrtpServerFactory.stopSendRtpStream(mediaInfo, param); 214 zlmrtpServerFactory.stopSendRtpStream(mediaInfo, param);
215 } 215 }
216 -  
217 } 216 }
218 } 217 }
219 218