From 66eda32ab97d6e94e9f274d6faa4df586c452dfb Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期日, 25 六月 2023 10:18:29 +0800 Subject: [PATCH] 优化端口预占用 --- src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java b/src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java index 42ff5ba..80b97f2 100644 --- a/src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java +++ b/src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java @@ -3,6 +3,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import java.io.Serializable; +import java.util.Objects; @Schema(description = "娴佷俊鎭�") public class StreamInfo implements Serializable, Cloneable{ @@ -168,7 +169,7 @@ } public void setRtmp(String host, int port, int sslPort, String app, String stream, String callIdParam) { - String file = String.format("%s/%s/%s", app, stream, callIdParam); + String file = String.format("%s/%s%s", app, stream, callIdParam); if (port > 0) { this.rtmp = new StreamURL("rtmp", host, port, file); } @@ -178,7 +179,7 @@ } public void setRtsp(String host, int port, int sslPort, String app, String stream, String callIdParam) { - String file = String.format("%s/%s/%s", app, stream, callIdParam); + String file = String.format("%s/%s%s", app, stream, callIdParam); if (port > 0) { this.rtsp = new StreamURL("rtsp", host, port, file); } @@ -236,8 +237,11 @@ } } - public void setRtc(String host, int port, int sslPort, String app, String stream, String callIdParam) { - String file = String.format("index/api/webrtc?app=%s&stream=%s&type=play%s", app, stream, callIdParam); + public void setRtc(String host, int port, int sslPort, String app, String stream, String callIdParam, boolean isPlay) { + if (callIdParam != null) { + callIdParam = Objects.equals(callIdParam, "") ? callIdParam : callIdParam.replace("?", "&"); + } + String file = String.format("index/api/webrtc?app=%s&stream=%s&type=%s%s", app, stream, isPlay?"play":"push", callIdParam); if (port > 0) { this.rtc = new StreamURL("http", host, port, file); } @@ -520,7 +524,7 @@ try{ instance = (StreamInfo)super.clone(); }catch(CloneNotSupportedException e) { - logger.error("鏈鐞嗙殑寮傚父 ", e); + e.printStackTrace(); } return instance; } -- Gitblit v1.8.0