Commit fe9965bc637d28e2e9a2dc19b04eeb3bc5f0d869

Authored by xiaoQQya
1 parent 0772f698

perf(streamInfo): 优化点播接口返回流信息中的 RTMP/RTSP/RTC 链接

src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java
@@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.common; @@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.common;
3 import io.swagger.v3.oas.annotations.media.Schema; 3 import io.swagger.v3.oas.annotations.media.Schema;
4 4
5 import java.io.Serializable; 5 import java.io.Serializable;
  6 +import java.util.Objects;
6 7
7 @Schema(description = "流信息") 8 @Schema(description = "流信息")
8 public class StreamInfo implements Serializable, Cloneable{ 9 public class StreamInfo implements Serializable, Cloneable{
@@ -168,7 +169,7 @@ public class StreamInfo implements Serializable, Cloneable{ @@ -168,7 +169,7 @@ public class StreamInfo implements Serializable, Cloneable{
168 } 169 }
169 170
170 public void setRtmp(String host, int port, int sslPort, String app, String stream, String callIdParam) { 171 public void setRtmp(String host, int port, int sslPort, String app, String stream, String callIdParam) {
171 - String file = String.format("%s/%s/%s", app, stream, callIdParam); 172 + String file = String.format("%s/%s%s", app, stream, callIdParam);
172 if (port > 0) { 173 if (port > 0) {
173 this.rtmp = new StreamURL("rtmp", host, port, file); 174 this.rtmp = new StreamURL("rtmp", host, port, file);
174 } 175 }
@@ -178,7 +179,7 @@ public class StreamInfo implements Serializable, Cloneable{ @@ -178,7 +179,7 @@ public class StreamInfo implements Serializable, Cloneable{
178 } 179 }
179 180
180 public void setRtsp(String host, int port, int sslPort, String app, String stream, String callIdParam) { 181 public void setRtsp(String host, int port, int sslPort, String app, String stream, String callIdParam) {
181 - String file = String.format("%s/%s/%s", app, stream, callIdParam); 182 + String file = String.format("%s/%s%s", app, stream, callIdParam);
182 if (port > 0) { 183 if (port > 0) {
183 this.rtsp = new StreamURL("rtsp", host, port, file); 184 this.rtsp = new StreamURL("rtsp", host, port, file);
184 } 185 }
@@ -237,6 +238,7 @@ public class StreamInfo implements Serializable, Cloneable{ @@ -237,6 +238,7 @@ public class StreamInfo implements Serializable, Cloneable{
237 } 238 }
238 239
239 public void setRtc(String host, int port, int sslPort, String app, String stream, String callIdParam) { 240 public void setRtc(String host, int port, int sslPort, String app, String stream, String callIdParam) {
  241 + callIdParam = Objects.equals(callIdParam, "") ? callIdParam : callIdParam.replace("?", "&");
240 String file = String.format("index/api/webrtc?app=%s&stream=%s&type=play%s", app, stream, callIdParam); 242 String file = String.format("index/api/webrtc?app=%s&stream=%s&type=play%s", app, stream, callIdParam);
241 if (port > 0) { 243 if (port > 0) {
242 this.rtc = new StreamURL("http", host, port, file); 244 this.rtc = new StreamURL("http", host, port, file);