From d295f3c51271c26a5f65c0184bfa27fe1af80f54 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期二, 18 四月 2023 14:06:07 +0800
Subject: [PATCH] 修复合并后的问题
---
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java | 28 +++++++++++++++++++---------
1 files changed, 19 insertions(+), 9 deletions(-)
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 c7d9966..a1524dd 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
@@ -92,7 +92,7 @@
return result;
}
- public int createRTPServer(MediaServerItem mediaServerItem, String streamId, int ssrc, Integer port) {
+ public int createRTPServer(MediaServerItem mediaServerItem, String streamId, int ssrc, Integer port, Boolean onlyAuto) {
int result = -1;
// 鏌ヨ姝tp server 鏄惁宸茬粡瀛樺湪
JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(mediaServerItem, streamId);
@@ -108,7 +108,7 @@
JSONObject jsonObject = zlmresTfulUtils.closeRtpServer(mediaServerItem, param);
if (jsonObject != null ) {
if (jsonObject.getInteger("code") == 0) {
- return createRTPServer(mediaServerItem, streamId, ssrc, port);
+ return createRTPServer(mediaServerItem, streamId, ssrc, port, onlyAuto);
}else {
logger.warn("[寮�鍚痳tpServer], 閲嶅惎RtpServer閿欒");
}
@@ -131,6 +131,9 @@
param.put("port", port);
}
param.put("ssrc", ssrc);
+ if (onlyAuto != null) {
+ param.put("only_audio", onlyAuto?"1":"0");
+ }
JSONObject openRtpServerResultJson = zlmresTfulUtils.openRtpServer(mediaServerItem, param);
logger.info(JSONObject.toJSONString(openRtpServerResultJson));
if (openRtpServerResultJson != null) {
@@ -229,7 +232,7 @@
sendRtpItem.setPort(port);
sendRtpItem.setSsrc(ssrc);
sendRtpItem.setApp(app);
- sendRtpItem.setStreamId(stream);
+ sendRtpItem.setStream(stream);
sendRtpItem.setPlatformId(platformId);
sendRtpItem.setChannelId(channelId);
sendRtpItem.setTcp(tcp);
@@ -256,11 +259,14 @@
// 璁㈤槄 zlm鍚姩浜嬩欢, 鏂扮殑zlm涔熶細浠庤繖閲岃繘鍏ョ郴缁�
hookSubscribe.addSubscribe(hookSubscribeForRtpServerTimeout,
(MediaServerItem mediaServerItem, JSONObject response)->{
- logger.info("[涓婄骇鐐规挱] {}->鐩戝惉绔彛鍒版湡缁х画淇濇寔鐩戝惉", ssrc);
+ logger.info("[淇濇寔绔彛] {}->鐩戝惉绔彛鍒版湡缁х画淇濇寔鐩戝惉", ssrc);
keepPort(serverItem, ssrc);
});
+ logger.info("[淇濇寔绔彛] {}->鐩戝惉绔彛: {}", ssrc, localPort);
+ logger.info("[淇濇寔绔彛] {}->鐩戝惉绔彛: {}", ssrc, localPort);
+ }else {
+ logger.info("[淇濇寔绔彛] 鐩戝惉绔彛澶辫触: {}", ssrc);
}
- logger.info("[涓婄骇鐐规挱] {}->鐩戝惉绔彛: {}", ssrc, localPort);
return localPort;
}
@@ -268,7 +274,7 @@
* 閲婃斁淇濇寔鐨勭鍙�
*/
public boolean releasePort(MediaServerItem serverItem, String ssrc) {
- logger.info("[涓婄骇鐐规挱] {}->閲婃斁鐩戝惉绔彛", ssrc);
+ logger.info("[淇濇寔绔彛] {}->閲婃斁鐩戝惉绔彛", ssrc);
boolean closeRTPServerResult = closeRtpServer(serverItem, ssrc);
HookSubscribeForRtpServerTimeout hookSubscribeForRtpServerTimeout = HookSubscribeFactory.on_rtp_server_timeout(ssrc, null, serverItem.getId());
// 璁㈤槄 zlm鍚姩浜嬩欢, 鏂扮殑zlm涔熶細浠庤繖閲岃繘鍏ョ郴缁�
@@ -288,6 +294,10 @@
*/
public JSONObject startSendRtpPassive(MediaServerItem mediaServerItem, Map<String, Object>param) {
return zlmresTfulUtils.startSendRtpPassive(mediaServerItem, param);
+ }
+
+ public JSONObject startSendRtpPassive(MediaServerItem mediaServerItem, Map<String, Object>param, ZLMRESTfulUtils.RequestCallback callback) {
+ return zlmresTfulUtils.startSendRtpPassive(mediaServerItem, param, callback);
}
/**
@@ -343,18 +353,18 @@
result= true;
logger.info("[鍋滄RTP鎺ㄦ祦] 鎴愬姛");
} else {
- logger.error("[鍋滄RTP鎺ㄦ祦] 澶辫触: {}, 鍙傛暟锛歿}->\r\n{}",jsonObject.getString("msg"), JSON.toJSON(param), jsonObject);
+ logger.warn("[鍋滄RTP鎺ㄦ祦] 澶辫触: {}, 鍙傛暟锛歿}->\r\n{}",jsonObject.getString("msg"), JSON.toJSON(param), jsonObject);
}
return result;
}
public JSONObject startSendRtp(MediaServerItem mediaInfo, SendRtpItem sendRtpItem) {
String is_Udp = sendRtpItem.isTcp() ? "0" : "1";
- logger.info("rtp/{}寮�濮嬪悜涓婄骇鎺ㄦ祦, 鐩爣={}:{}锛孲SRC={}", sendRtpItem.getStreamId(), sendRtpItem.getIp(), sendRtpItem.getPort(), sendRtpItem.getSsrc());
+ logger.info("rtp/{}寮�濮嬫帹娴�, 鐩爣={}:{}锛孲SRC={}", sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort(), sendRtpItem.getSsrc());
Map<String, Object> param = new HashMap<>(12);
param.put("vhost","__defaultVhost__");
param.put("app",sendRtpItem.getApp());
- param.put("stream",sendRtpItem.getStreamId());
+ param.put("stream",sendRtpItem.getStream());
param.put("ssrc", sendRtpItem.getSsrc());
param.put("src_port", sendRtpItem.getLocalPort());
param.put("pt", sendRtpItem.getPt());
--
Gitblit v1.8.0