From d60452560e37305e62f8cdd6cc08c6b3d3430a10 Mon Sep 17 00:00:00 2001 From: WuPeng <wp@zafu.edu.cn> Date: 星期日, 27 十一月 2022 10:28:42 +0800 Subject: [PATCH] 弃用废弃方法toJavaObject,改用to方法,消除编译警告。 --- src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java | 30 +++++++++++++++++++++++++++--- 1 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java index e2b5a28..54a2890 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java @@ -183,7 +183,7 @@ if (!"rtp".equals(param.getApp())) { if (userSetting.getPushAuthority()) { -// 鎺ㄦ祦閴存潈 + // 鎺ㄦ祦閴存潈 if (param.getParams() == null) { logger.info("鎺ㄦ祦閴存潈澶辫触锛� 缂哄皯涓嶈鍙傛暟锛歴ign=md5(user琛ㄧ殑pushKey)"); ret.put("code", 401); @@ -505,6 +505,7 @@ // 淇敼鏁版嵁 streamProxyService.stop(param.getApp(), param.getStream()); }else { + // 鏃犱汉瑙傜湅涓嶅仛澶勭悊 ret.put("close", false); } return ret; @@ -568,8 +569,6 @@ public JSONObject onServerStarted(HttpServletRequest request, @RequestBody JSONObject jsonObject){ jsonObject.put("ip", request.getRemoteAddr()); - System.out.println(jsonObject.toJSONString() - ); ZLMServerConfig zlmServerConfig = JSON.to(ZLMServerConfig.class, jsonObject); zlmServerConfig.setIp(request.getRemoteAddr()); logger.info("[ZLM HOOK] zlm 鍚姩 " + zlmServerConfig.getGeneralMediaServerId()); @@ -626,6 +625,31 @@ return ret; } + /** + * rtpServer鏀舵祦瓒呮椂 + */ + @ResponseBody + @PostMapping(value = "/on_rtp_server_timeout", produces = "application/json;charset=UTF-8") + public JSONObject onRtpServerTimeout(HttpServletRequest request, @RequestBody OnRtpServerTimeoutHookParam param){ + logger.info("[ZLM HOOK] rtpServer鏀舵祦瓒呮椂锛歿}->{}({})", param.getMediaServerId(), param.getStream_id(), param.getSsrc()); + + JSONObject ret = new JSONObject(); + ret.put("code", 0); + ret.put("msg", "success"); + + taskExecutor.execute(()->{ + JSONObject json = (JSONObject) JSON.toJSON(param); + List<ZlmHttpHookSubscribe.Event> subscribes = this.subscribe.getSubscribes(HookType.on_rtp_server_timeout); + if (subscribes != null && subscribes.size() > 0) { + for (ZlmHttpHookSubscribe.Event subscribe : subscribes) { + subscribe.response(null, json); + } + } + }); + + return ret; + } + private Map<String, String> urlParamToMap(String params) { HashMap<String, String> map = new HashMap<>(); if (ObjectUtils.isEmpty(params)) { -- Gitblit v1.8.0