From 2f165d595af3565bd17612ee0f5866ace8ab43f4 Mon Sep 17 00:00:00 2001
From: panlinlin <648540858@qq.com>
Date: 星期二, 02 三月 2021 18:23:06 +0800
Subject: [PATCH] 对级联点播信令进行处理

---
 src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java |   35 +++++++++--------------------------
 1 files changed, 9 insertions(+), 26 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 afd969a..70026a8 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
@@ -86,9 +86,6 @@
 		if (logger.isDebugEnabled()) {
 			logger.debug("ZLM HOOK on_flow_report API璋冪敤锛屽弬鏁帮細" + json.toString());
 		}
-		// TODO Auto-generated method stub
-
-		
 		JSONObject ret = new JSONObject();
 		ret.put("code", 0);
 		ret.put("msg", "success");
@@ -106,8 +103,6 @@
 		if (logger.isDebugEnabled()) {
 			logger.debug("ZLM HOOK on_http_access API 璋冪敤锛屽弬鏁帮細" + json.toString());
 		}
-		// TODO Auto-generated method stub
-		
 		JSONObject ret = new JSONObject();
 		ret.put("code", 0);
 		ret.put("err", "");
@@ -127,8 +122,6 @@
 		if (logger.isDebugEnabled()) {
 			logger.debug("ZLM HOOK on_play API璋冪敤锛屽弬鏁帮細" + json.toString());
 		}
-		// TODO Auto-generated method stub
-		
 		JSONObject ret = new JSONObject();
 		ret.put("code", 0);
 		ret.put("msg", "success");
@@ -146,15 +139,10 @@
 		if (logger.isDebugEnabled()) {
 			logger.debug("ZLM HOOK on_publish API璋冪敤锛屽弬鏁帮細" + json.toString());
 		}
-		String app = json.getString("app");
-		String streamId = json.getString("id");
 
 		ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_publish, json);
 		if (subscribe != null) subscribe.response(json);
 
-
-		// TODO Auto-generated method stub
-		
 		JSONObject ret = new JSONObject();
 		ret.put("code", 0);
 		ret.put("msg", "success");
@@ -175,8 +163,6 @@
 		if (logger.isDebugEnabled()) {
 			logger.debug("ZLM HOOK on_record_mp4 API璋冪敤锛屽弬鏁帮細" + json.toString());
 		}
-		// TODO Auto-generated method stub
-		
 		JSONObject ret = new JSONObject();
 		ret.put("code", 0);
 		ret.put("msg", "success");
@@ -194,8 +180,6 @@
 		if (logger.isDebugEnabled()) {
 			logger.debug("ZLM HOOK on_rtsp_realm API璋冪敤锛屽弬鏁帮細" + json.toString());
 		}
-		// TODO Auto-generated method stub
-		
 		JSONObject ret = new JSONObject();
 		ret.put("code", 0);
 		ret.put("realm", "");
@@ -214,8 +198,6 @@
 		if (logger.isDebugEnabled()) {
 			logger.debug("ZLM HOOK on_rtsp_auth API璋冪敤锛屽弬鏁帮細" + json.toString());
 		}
-		// TODO Auto-generated method stub
-		
 		JSONObject ret = new JSONObject();
 		ret.put("code", 0);
 		ret.put("encrypted", false);
@@ -234,8 +216,13 @@
 		if (logger.isDebugEnabled()) {
 			logger.debug("ZLM HOOK on_shell_login API璋冪敤锛屽弬鏁帮細" + json.toString());
 		}
-		// TODO Auto-generated method stub
-		
+		// TODO 濡傛灉鏄甫鏈塺tpstream鍒欏紑鍚寜闇�鎷夋祦
+		String app = json.getString("app");
+		String stream = json.getString("stream");
+
+		ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_publish, json);
+		if (subscribe != null) subscribe.response(json);
+
 		JSONObject ret = new JSONObject();
 		ret.put("code", 0);
 		ret.put("msg", "success");
@@ -261,13 +248,12 @@
 		if ("rtp".equals(app) && !regist ) {
 			if (streamInfo!=null){
 				redisCatchStorage.stopPlay(streamInfo);
+				storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId());
 			}else{
 				streamInfo = redisCatchStorage.queryPlaybackByStreamId(streamId);
 				redisCatchStorage.stopPlayback(streamInfo);
 			}
 		}
-
-
 		JSONObject ret = new JSONObject();
 		ret.put("code", 0);
 		ret.put("msg", "success");
@@ -292,6 +278,7 @@
 		StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId);
 		if (streamInfo!=null){
 			redisCatchStorage.stopPlay(streamInfo);
+			storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId());
 		}else{
 			streamInfo = redisCatchStorage.queryPlaybackByStreamId(streamId);
 			redisCatchStorage.stopPlayback(streamInfo);
@@ -314,8 +301,6 @@
 		if (logger.isDebugEnabled()) {
 			logger.debug("ZLM HOOK on_stream_not_found API璋冪敤锛屽弬鏁帮細" + json.toString());
 		}
-		// TODO Auto-generated method stub
-
 		if (autoApplyPlay) {
 			String app = json.getString("app");
 			String streamId = json.getString("stream");
@@ -365,8 +350,6 @@
 		mediaServerConfig.setWanIp(StringUtils.isEmpty(mediaWanIp)? mediaIp: mediaWanIp);
 		mediaServerConfig.setLocalIP(mediaIp);
 		redisCatchStorage.updateMediaInfo(mediaServerConfig);
-		// TODO Auto-generated method stub
-		
 		JSONObject ret = new JSONObject();
 		ret.put("code", 0);
 		ret.put("msg", "success");

--
Gitblit v1.8.0