From f8fe76add24fc2a26449c6b4007a303decb46d99 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期六, 27 三月 2021 13:56:56 +0800
Subject: [PATCH] Merge pull request #74 from lawrencehj/wvp-28181-2.0
---
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java | 34 ++++++++++++++++++++++------------
1 files changed, 22 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 90b5369..51c6e1b 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
@@ -51,8 +51,8 @@
@Autowired
private IRedisCatchStorage redisCatchStorage;
- // @Autowired
- // private ZLMRESTfulUtils zlmresTfulUtils;
+ @Autowired
+ private ZLMMediaListManager zlmMediaListManager;
@Autowired
private ZLMHttpHookSubscribe subscribe;
@@ -237,6 +237,7 @@
// 娴佹秷澶辩Щ闄edis play
String app = json.getString("app");
String streamId = json.getString("stream");
+ String schema = json.getString("schema");
boolean regist = json.getBoolean("regist");
StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId);
if ("rtp".equals(app) && !regist ) {
@@ -246,6 +247,10 @@
}else{
streamInfo = redisCatchStorage.queryPlaybackByStreamId(streamId);
redisCatchStorage.stopPlayback(streamInfo);
+ }
+ }else {
+ if (!"rtp".equals(app) && "rtsp".equals(schema)){
+ zlmMediaListManager.updateMediaList();
}
}
JSONObject ret = new JSONObject();
@@ -267,20 +272,25 @@
}
String streamId = json.getString("stream");
-
- cmder.streamByeCmd(streamId);
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);
- }
-
+
JSONObject ret = new JSONObject();
ret.put("code", 0);
ret.put("close", true);
+
+ if (streamInfo != null) {
+ if (redisCatchStorage.isChannelSendingRTP(streamInfo.getChannelId())) {
+ ret.put("close", false);
+ } else {
+ cmder.streamByeCmd(streamId);
+ redisCatchStorage.stopPlay(streamInfo);
+ storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId());
+ }
+ }else{
+ cmder.streamByeCmd(streamId);
+ streamInfo = redisCatchStorage.queryPlaybackByStreamId(streamId);
+ redisCatchStorage.stopPlayback(streamInfo);
+ }
return new ResponseEntity<String>(ret.toString(),HttpStatus.OK);
}
--
Gitblit v1.8.0