From 74714711aa87dcd1259f5aebe55d362be732ffa2 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期二, 18 十月 2022 17:35:42 +0800
Subject: [PATCH] 优化sip消息构建,去除ServerTransaction的使用
---
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java | 14 ++++++--------
1 files changed, 6 insertions(+), 8 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 1c8689b..20a31fe 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
@@ -24,6 +24,8 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;
+import org.springframework.util.ObjectUtils;
+import org.springframework.util.StringUtils;
import org.springframework.web.context.request.async.DeferredResult;
import com.alibaba.fastjson.JSON;
@@ -113,9 +115,6 @@
@Autowired
private ThreadPoolTaskExecutor taskExecutor;
- @Value("${server.ssl.enabled}")
- private boolean sslEnabled;
-
@Override
public PlayResult play(MediaServerItem mediaServerItem, String deviceId, String channelId,
ZlmHttpHookSubscribe.Event hookEvent, SipSubscribe.Event errorEvent,
@@ -130,7 +129,7 @@
String uuid = UUID.randomUUID().toString();
msg.setId(uuid);
playResult.setUuid(uuid);
- DeferredResult<WVPResult<String>> result = new DeferredResult<>(userSetting.getPlayTimeout().longValue());
+ DeferredResult<WVPResult<StreamInfo>> result = new DeferredResult<>(userSetting.getPlayTimeout().longValue());
playResult.setResult(result);
// 褰曞儚鏌ヨ浠hannelId浣滀负deviceId鏌ヨ
resultHolder.put(key, uuid, result);
@@ -149,7 +148,7 @@
if (Objects.requireNonNull(wvpResult).getCode() == 0) {
StreamInfo streamInfoForSuccess = (StreamInfo) wvpResult.getData();
MediaServerItem mediaInfo = mediaServerService.getOne(streamInfoForSuccess.getMediaServerId());
- String streamUrl = sslEnabled ? streamInfoForSuccess.getHttps_fmp4() : streamInfoForSuccess.getFmp4();
+ String streamUrl = streamInfoForSuccess.getFmp4();
// 璇锋眰鎴浘
logger.info("[璇锋眰鎴浘]: " + fileName);
@@ -408,12 +407,11 @@
if (device == null) {
return null;
}
- String mediaServerId = device.getMediaServerId();
MediaServerItem mediaServerItem;
- if (mediaServerId == null) {
+ if (ObjectUtils.isEmpty(device.getMediaServerId()) || "auto".equals(device.getMediaServerId())) {
mediaServerItem = mediaServerService.getMediaServerForMinimumLoad();
} else {
- mediaServerItem = mediaServerService.getOne(mediaServerId);
+ mediaServerItem = mediaServerService.getOne(device.getMediaServerId());
}
if (mediaServerItem == null) {
logger.warn("鐐规挱鏃舵湭鎵惧埌鍙娇鐢ㄧ殑ZLM...");
--
Gitblit v1.8.0