From 5ba0fba03d9fcb09eea0c1e703a4f050378d7992 Mon Sep 17 00:00:00 2001
From: panlinlin <648540858@qq.com>
Date: 星期一, 26 四月 2021 09:13:17 +0800
Subject: [PATCH] 添加部分onvif代码

---
 src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 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 2a76f26..5795690 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
@@ -251,10 +251,9 @@
 		JSONArray tracks = json.getJSONArray("tracks");
 		boolean regist = json.getBoolean("regist");
 		if (tracks != null) {
-			System.out.println("222222" + schema);
+			System.out.println("on_stream_changed->>" + schema);
 		}
 		if ("rtmp".equals(schema)){
-
 			if ("rtp".equals(app) && !regist ) {
 				StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId);
 				if (streamInfo!=null){
@@ -295,25 +294,26 @@
 		
 		String streamId = json.getString("stream");
 		String app = json.getString("app");
-		StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId);
-
 
 		if ("rtp".equals(app)){
 			JSONObject ret = new JSONObject();
 			ret.put("code", 0);
 			ret.put("close", true);
-			if (streamInfo != null) {
-				if (redisCatchStorage.isChannelSendingRTP(streamInfo.getChannelId())) {
+			StreamInfo streamInfoForPlayCatch = redisCatchStorage.queryPlayByStreamId(streamId);
+			if (streamInfoForPlayCatch != null) {
+				if (redisCatchStorage.isChannelSendingRTP(streamInfoForPlayCatch.getChannelId())) {
 					ret.put("close", false);
 				} else {
-					cmder.streamByeCmd(streamId);
-					redisCatchStorage.stopPlay(streamInfo);
-					storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId());
+					cmder.streamByeCmd(streamInfoForPlayCatch.getDeviceID(), streamInfoForPlayCatch.getChannelId());
+					redisCatchStorage.stopPlay(streamInfoForPlayCatch);
+					storager.stopPlay(streamInfoForPlayCatch.getDeviceID(), streamInfoForPlayCatch.getChannelId());
 				}
 			}else{
-				cmder.streamByeCmd(streamId);
-				streamInfo = redisCatchStorage.queryPlaybackByStreamId(streamId);
-				redisCatchStorage.stopPlayback(streamInfo);
+				StreamInfo streamInfoForPlayBackCatch = redisCatchStorage.queryPlaybackByStreamId(streamId);
+				if (streamInfoForPlayBackCatch != null) {
+					cmder.streamByeCmd(streamInfoForPlayBackCatch.getDeviceID(), streamInfoForPlayBackCatch.getChannelId());
+					redisCatchStorage.stopPlayback(streamInfoForPlayBackCatch);
+				}
 			}
 			return new ResponseEntity<String>(ret.toString(),HttpStatus.OK);
 		}else {

--
Gitblit v1.8.0