From 2591997dfc8995a788b07dd41f42aac77c6fc4fb Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期五, 12 八月 2022 10:00:18 +0800
Subject: [PATCH] 修复文档错误
---
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java | 89 +++++++++++++++++++++++++++++++++++---------
1 files changed, 71 insertions(+), 18 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
index e6a8f6a..0c571e9 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
@@ -2,17 +2,17 @@
import java.math.BigDecimal;
import java.math.RoundingMode;
-import java.util.List;
-import java.util.Objects;
-import java.util.UUID;
+import java.util.*;
import javax.sip.ResponseEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.async.DeferredResult;
@@ -104,6 +104,10 @@
private ZLMHttpHookSubscribe subscribe;
+ @Qualifier("taskExecutor")
+ @Autowired
+ private ThreadPoolTaskExecutor taskExecutor;
+
@Override
@@ -135,21 +139,23 @@
result.onCompletion(()->{
// 鐐规挱缁撴潫鏃惰皟鐢ㄦ埅鍥炬帴鍙�
- // TODO 搴旇鍦ㄤ笂娴佹椂璋冪敤鏇村ソ锛岀粨鏉熶篃鍙兘鏄敊璇粨鏉�
- String path = "snap";
- String fileName = deviceId + "_" + channelId + ".jpg";
- ResponseEntity responseEntity = (ResponseEntity)result.getResult();
- if (responseEntity != null && responseEntity.getStatusCode() == HttpStatus.OK) {
- WVPResult wvpResult = (WVPResult)responseEntity.getBody();
- if (Objects.requireNonNull(wvpResult).getCode() == 0) {
- StreamInfo streamInfoForSuccess = (StreamInfo)wvpResult.getData();
- MediaServerItem mediaInfo = mediaServerService.getOne(streamInfoForSuccess.getMediaServerId());
- String streamUrl = streamInfoForSuccess.getFmp4();
- // 璇锋眰鎴浘
- logger.info("[璇锋眰鎴浘]: " + fileName);
- zlmresTfulUtils.getSnap(mediaInfo, streamUrl, 15, 1, path, fileName);
+ taskExecutor.execute(()->{
+ // TODO 搴旇鍦ㄤ笂娴佹椂璋冪敤鏇村ソ锛岀粨鏉熶篃鍙兘鏄敊璇粨鏉�
+ String path = "snap";
+ String fileName = deviceId + "_" + channelId + ".jpg";
+ ResponseEntity responseEntity = (ResponseEntity)result.getResult();
+ if (responseEntity != null && responseEntity.getStatusCode() == HttpStatus.OK) {
+ WVPResult wvpResult = (WVPResult)responseEntity.getBody();
+ if (Objects.requireNonNull(wvpResult).getCode() == 0) {
+ StreamInfo streamInfoForSuccess = (StreamInfo)wvpResult.getData();
+ MediaServerItem mediaInfo = mediaServerService.getOne(streamInfoForSuccess.getMediaServerId());
+ String streamUrl = streamInfoForSuccess.getFmp4();
+ // 璇锋眰鎴浘
+ logger.info("[璇锋眰鎴浘]: " + fileName);
+ zlmresTfulUtils.getSnap(mediaInfo, streamUrl, 15, 1, path, fileName);
+ }
}
- }
+ });
});
if (streamInfo != null) {
String streamId = streamInfo.getStream();
@@ -651,6 +657,53 @@
@Override
public void zlmServerOnline(String mediaServerId) {
- // 浼间箮娌″暐闇�瑕佸仛鐨�
+ // TODO 鏌ユ壘涔嬪墠鐨勭偣鎾紝娴佸鏋滀笉瀛樺湪鍒欑粰涓嬬骇鍙戦�乥ye
+// MediaServerItem mediaServerItem = mediaServerService.getOne(mediaServerId);
+// zlmresTfulUtils.getMediaList(mediaServerItem, (mediaList ->{
+// Integer code = mediaList.getInteger("code");
+// if (code == 0) {
+// JSONArray data = mediaList.getJSONArray("data");
+// if (data == null || data.size() == 0) {
+// zlmServerOffline(mediaServerId);
+// }else {
+// Map<String, JSONObject> mediaListMap = new HashMap<>();
+// for (int i = 0; i < data.size(); i++) {
+// JSONObject json = data.getJSONObject(i);
+// String app = json.getString("app");
+// if ("rtp".equals(app)) {
+// String stream = json.getString("stream");
+// if (mediaListMap.get(stream) != null) {
+// continue;
+// }
+// mediaListMap.put(stream, json);
+// // 澶勭悊姝e湪瑙傜湅鐨勫浗鏍囪澶�
+// List<SsrcTransaction> ssrcTransactions = streamSession.getSsrcTransactionForAll(null, null, null, stream);
+// if (ssrcTransactions.size() > 0) {
+// for (SsrcTransaction ssrcTransaction : ssrcTransactions) {
+// if(ssrcTransaction.getMediaServerId().equals(mediaServerId)) {
+// cmder.streamByeCmd(ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId(),
+// ssrcTransaction.getStream(), null);
+// }
+// }
+// }
+// }
+// }
+// if (mediaListMap.size() > 0 ) {
+// // 澶勭悊姝e湪鍚戜笂鎺ㄦ祦鐨勪笂绾у钩鍙�
+// List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServer(null);
+// if (sendRtpItems.size() > 0) {
+// for (SendRtpItem sendRtpItem : sendRtpItems) {
+// if (sendRtpItem.getMediaServerId().equals(mediaServerId)) {
+// if (mediaListMap.get(sendRtpItem.getStreamId()) == null) {
+// ParentPlatform platform = storager.queryParentPlatByServerGBId(sendRtpItem.getPlatformId());
+// sipCommanderFroPlatform.streamByeCmd(platform, sendRtpItem.getCallId());
+// }
+// }
+// }
+// }
+// }
+// }
+// }
+// }));
}
}
--
Gitblit v1.8.0