From fc0ad32f815535a5a4aee55f92eaac92cbd4d97b Mon Sep 17 00:00:00 2001
From: jiang <893224616@qq.com>
Date: 星期二, 19 七月 2022 18:13:19 +0800
Subject: [PATCH] 1.修复新增用户没有pushkey的问题 2.将重置pushkey改为修改pushkey

---
 src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java |   16 +++++++++++++---
 1 files changed, 13 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 f4a2744..055cccb 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
@@ -87,6 +87,9 @@
 	@Autowired
 	private VideoStreamSessionManager sessionManager;
 
+	@Autowired
+	private AssistRESTfulUtils assistRESTfulUtils;
+
 	/**
 	 * 鏈嶅姟鍣ㄥ畾鏃朵笂鎶ユ椂闂达紝涓婃姤闂撮殧鍙厤缃紝榛樿10s涓婃姤涓�娆�
 	 *
@@ -200,6 +203,8 @@
 
 		logger.info("[ ZLM HOOK ]on_publish API璋冪敤锛屽弬鏁帮細" + json.toString());
 		JSONObject ret = new JSONObject();
+		String mediaServerId = json.getString("mediaServerId");
+		MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId);
 		if (!"rtp".equals(param.getApp())) {
 			// 鎺ㄦ祦閴存潈
 			if (param.getParams() == null) {
@@ -231,6 +236,10 @@
 			streamAuthorityInfo.setSign(sign);
 			// 閴存潈閫氳繃
 			redisCatchStorage.updateStreamAuthorityInfo(param.getApp(), param.getStream(), streamAuthorityInfo);
+			// 閫氱煡assist鏂扮殑callId
+			if (mediaInfo != null) {
+				assistRESTfulUtils.addStreamCallInfo(mediaInfo, param.getApp(), param.getStream(), callId, null);
+			}
 		}
 
 		ret.put("code", 0);
@@ -240,10 +249,9 @@
 			ret.put("enable_audio", true);
 		}
 
-		String mediaServerId = json.getString("mediaServerId");
+
 		ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_publish, json);
 		if (subscribe != null) {
-			MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId);
 			if (mediaInfo != null) {
 				subscribe.response(mediaInfo, json);
 			}else {
@@ -270,8 +278,10 @@
 				ret.put("mp4_max_second", 10);
 				ret.put("enable_mp4", true);
 				ret.put("enable_audio", true);
+
 			}
 		}
+
 
 
 		return new ResponseEntity<String>(ret.toString(), HttpStatus.OK);
@@ -451,7 +461,7 @@
 							StreamInfo streamInfoByAppAndStream = mediaService.getStreamInfoByAppAndStream(mediaServerItem,
 									app, stream, tracks, streamAuthorityInfo.getCallId());
 							item.setStreamInfo(streamInfoByAppAndStream);
-
+							item.setSeverId(userSetting.getServerId());
 							redisCatchStorage.addStream(mediaServerItem, type, app, stream, item);
 							if (item.getOriginType() == OriginType.RTSP_PUSH.ordinal()
 									|| item.getOriginType() == OriginType.RTMP_PUSH.ordinal()

--
Gitblit v1.8.0