From c551164c89f70e664b498c3a09e615928261e01a Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期六, 01 七月 2023 18:33:42 +0800
Subject: [PATCH] 合并主线
---
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java | 4 -
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java | 25 ++++--------
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java | 32 ++++-----------
3 files changed, 18 insertions(+), 43 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
index 93e5540..423a3b4 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
@@ -1026,9 +1026,7 @@
SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId,
device.getDeviceId(), broadcastCatch.getChannelId(),
- mediaTransmissionTCP, false, ssrcFromCallback -> {
- return redisCatchStorage.querySendRTPServer(requesterId, channelId, null, callIdHeader.getCallId()) != null;
- });
+ mediaTransmissionTCP, false);
if (sendRtpItem == null) {
logger.warn("鏈嶅姟鍣ㄧ鍙h祫婧愪笉瓒�");
diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java
index 52e7953..48fb00d 100644
--- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java
@@ -236,11 +236,6 @@
* 璋冪敤zlm RESTFUL API 鈥斺�� startSendRtpPassive
*/
public JSONObject startSendRtpPassive(MediaServerItem mediaServerItem, Map<String, Object>param) {
- System.out.println("=====================");
- for (String s : param.keySet()) {
- System.out.println(s + ": " + param.get(s));
- }
- System.out.println("=========END============");
return zlmresTfulUtils.startSendRtpPassive(mediaServerItem, param);
}
@@ -334,18 +329,14 @@
// 濡傛灉鏄潪涓ユ牸妯″紡锛岄渶瑕佸叧闂鍙e崰鐢�
JSONObject startSendRtpStreamResult = null;
if (sendRtpItem.getLocalPort() != 0) {
- HookSubscribeForRtpServerTimeout hookSubscribeForRtpServerTimeout = HookSubscribeFactory.on_rtp_server_timeout(sendRtpItem.getSsrc(), null, mediaInfo.getId());
- hookSubscribe.removeSubscribe(hookSubscribeForRtpServerTimeout);
- if (releasePort(mediaInfo, sendRtpItem.getSsrc())) {
- if (sendRtpItem.isTcpActive()) {
- startSendRtpStreamResult = startSendRtpPassive(mediaInfo, param);
- System.out.println(JSON.toJSON(param));
- }else {
- param.put("is_udp", is_Udp);
- param.put("dst_url", sendRtpItem.getIp());
- param.put("dst_port", sendRtpItem.getPort());
- startSendRtpStreamResult = startSendRtpStream(mediaInfo, param);
- }
+ if (sendRtpItem.isTcpActive()) {
+ startSendRtpStreamResult = startSendRtpPassive(mediaInfo, param);
+ System.out.println(JSON.toJSON(param));
+ }else {
+ param.put("is_udp", is_Udp);
+ param.put("dst_url", sendRtpItem.getIp());
+ param.put("dst_port", sendRtpItem.getPort());
+ startSendRtpStreamResult = startSendRtpStream(mediaInfo, param);
}
}else {
if (sendRtpItem.isTcpActive()) {
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 fffdb4d..71e9b65 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
@@ -16,14 +16,10 @@
import com.genersoft.iot.vmp.gb28181.session.AudioBroadcastManager;
import com.genersoft.iot.vmp.gb28181.session.SSRCFactory;
import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
-import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
-import com.genersoft.iot.vmp.media.zlm.AssistRESTfulUtils;
-import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
-import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
-import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
+import com.genersoft.iot.vmp.media.zlm.*;
import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory;
import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange;
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
@@ -94,7 +90,7 @@
private IInviteStreamService inviteStreamService;
@Autowired
- private DeferredResultHolder resultHolder;
+ private SendRtpPortManager sendRtpPortManager;
@Autowired
private ZLMRESTfulUtils zlmresTfulUtils;
@@ -235,9 +231,7 @@
sendRtpItem.setReceiveStream(stream + "_talk");
String callId = SipUtils.getNewCallId();
- int port = zlmrtpServerFactory.keepPort(mediaServerItem, playSsrc, 0, ssrcFromCallback ->{
- return redisCatchStorage.querySendRTPServer(device.getDeviceId(), channelId, null, callId) != null;
- });
+ int port = sendRtpPortManager.getNextPort(mediaServerItem.getId());
//绔彛鑾峰彇澶辫触鐨剆srcInfo 娌℃湁蹇呰鍙戦�佺偣鎾寚浠�
if (port <= 0) {
logger.info("[璇煶瀵硅] 绔彛鍒嗛厤寮傚父锛宒eviceId={},channelId={}", device.getDeviceId(), channelId);
@@ -265,9 +259,6 @@
}
}, userSetting.getPlayTimeout());
-
-
- zlmrtpServerFactory.releasePort(mediaServerItem, playSsrc);
Map<String, Object> param = new HashMap<>(12);
param.put("vhost","__defaultVhost__");
param.put("app", sendRtpItem.getApp());
@@ -1467,18 +1458,13 @@
// 濡傛灉鏄弗鏍兼ā寮忥紝闇�瑕佸叧闂鍙e崰鐢�
JSONObject startSendRtpStreamResult = null;
if (sendRtpItem.getLocalPort() != 0) {
- if (zlmrtpServerFactory.releasePort(mediaInfo, sendRtpItem.getSsrc())) {
- if (sendRtpItem.isTcpActive()) {
- startSendRtpStreamResult = zlmrtpServerFactory.startSendRtpPassive(mediaInfo, param);
- } else {
- param.put("dst_url", sendRtpItem.getIp());
- param.put("dst_port", sendRtpItem.getPort());
- startSendRtpStreamResult = zlmrtpServerFactory.startSendRtpStream(mediaInfo, param);
- }
- }else {
- // TODO 閲婃斁澶辫触鐨勫鐞�
+ if (sendRtpItem.isTcpActive()) {
+ startSendRtpStreamResult = zlmrtpServerFactory.startSendRtpPassive(mediaInfo, param);
+ } else {
+ param.put("dst_url", sendRtpItem.getIp());
+ param.put("dst_port", sendRtpItem.getPort());
+ startSendRtpStreamResult = zlmrtpServerFactory.startSendRtpStream(mediaInfo, param);
}
-
} else {
if (sendRtpItem.isTcpActive()) {
startSendRtpStreamResult = zlmrtpServerFactory.startSendRtpPassive(mediaInfo, param);
--
Gitblit v1.8.0