Commit 0a3d25fb5b54bc55ea70ac5ac209728c09f028dd

Authored by 648540858
1 parent ba8fffd9

修复非必传参数

src/main/java/com/genersoft/iot/vmp/vmanager/rtp/RtpController.java
@@ -28,10 +28,8 @@ import org.slf4j.LoggerFactory; @@ -28,10 +28,8 @@ import org.slf4j.LoggerFactory;
28 import org.springframework.beans.factory.annotation.Autowired; 28 import org.springframework.beans.factory.annotation.Autowired;
29 import org.springframework.beans.factory.annotation.Value; 29 import org.springframework.beans.factory.annotation.Value;
30 import org.springframework.data.redis.core.RedisTemplate; 30 import org.springframework.data.redis.core.RedisTemplate;
31 -import org.springframework.web.bind.annotation.GetMapping;  
32 -import org.springframework.web.bind.annotation.RequestMapping;  
33 -import org.springframework.web.bind.annotation.ResponseBody;  
34 -import org.springframework.web.bind.annotation.RestController; 31 +import org.springframework.util.ObjectUtils;
  32 +import org.springframework.web.bind.annotation.*;
35 33
36 import java.io.IOException; 34 import java.io.IOException;
37 import java.util.HashMap; 35 import java.util.HashMap;
@@ -95,7 +93,7 @@ public class RtpController { @@ -95,7 +93,7 @@ public class RtpController {
95 @Parameter(name = "stream", description = "形成的流的ID", required = true) 93 @Parameter(name = "stream", description = "形成的流的ID", required = true)
96 @Parameter(name = "tcpMode", description = "收流模式, 0为UDP, 1为TCP被动", required = true) 94 @Parameter(name = "tcpMode", description = "收流模式, 0为UDP, 1为TCP被动", required = true)
97 @Parameter(name = "callBack", description = "回调地址,如果收流超时会通道回调通知,回调为get请求,参数为callId", required = true) 95 @Parameter(name = "callBack", description = "回调地址,如果收流超时会通道回调通知,回调为get请求,参数为callId", required = true)
98 - public OtherRtpSendInfo openRtpServer(Boolean isSend, String ssrc, String callId, String stream, Integer tcpMode, String callBack) { 96 + public OtherRtpSendInfo openRtpServer(Boolean isSend, @RequestParam(required = false)String ssrc, String callId, String stream, Integer tcpMode, String callBack) {
99 97
100 logger.info("[第三方服务对接->开启收流和获取发流信息] isSend->{}, ssrc->{}, callId->{}, stream->{}, tcpMode->{}, callBack->{}", 98 logger.info("[第三方服务对接->开启收流和获取发流信息] isSend->{}, ssrc->{}, callId->{}, stream->{}, tcpMode->{}, callBack->{}",
101 isSend, ssrc, callId, stream, tcpMode==0?"UDP":"TCP被动", callBack); 99 isSend, ssrc, callId, stream, tcpMode==0?"UDP":"TCP被动", callBack);
@@ -159,7 +157,7 @@ public class RtpController { @@ -159,7 +157,7 @@ public class RtpController {
159 logger.info("[第三方服务对接->开启收流和获取发流信息] 端口保持超时 callId->{}", callId); 157 logger.info("[第三方服务对接->开启收流和获取发流信息] 端口保持超时 callId->{}", callId);
160 redisTemplate.delete(key); 158 redisTemplate.delete(key);
161 zlmServerFactory.releasePort(mediaServerItem, callId); 159 zlmServerFactory.releasePort(mediaServerItem, callId);
162 - }, 300000); 160 + }, 15000);
163 otherRtpSendInfo.setIp(mediaServerItem.getSdpIp()); 161 otherRtpSendInfo.setIp(mediaServerItem.getSdpIp());
164 otherRtpSendInfo.setPort(port); 162 otherRtpSendInfo.setPort(port);
165 logger.info("[开启收流和获取发流信息] 结果,callId->{}, {}", callId, otherRtpSendInfo); 163 logger.info("[开启收流和获取发流信息] 结果,callId->{}, {}", callId, otherRtpSendInfo);
@@ -189,9 +187,12 @@ public class RtpController { @@ -189,9 +187,12 @@ public class RtpController {
189 @Parameter(name = "onlyAudio", description = "是否只有音频", required = true) 187 @Parameter(name = "onlyAudio", description = "是否只有音频", required = true)
190 @Parameter(name = "isUdp", description = "是否为UDP", required = true) 188 @Parameter(name = "isUdp", description = "是否为UDP", required = true)
191 @Parameter(name = "streamType", description = "流类型,1为es流,2为ps流, 默认es流", required = false) 189 @Parameter(name = "streamType", description = "流类型,1为es流,2为ps流, 默认es流", required = false)
192 - public void sendRTP(String ssrc, String ip, Integer port, String app, String stream, String callId, Boolean onlyAudio, Boolean isUdp, Integer streamType) { 190 + public void sendRTP(String ssrc, String ip, Integer port, String app, String stream, String callId, Boolean onlyAudio, Boolean isUdp, @RequestParam(required = false)Integer streamType) {
193 logger.info("[第三方服务对接->发送流] ssrc->{}, ip->{}, port->{}, app->{}, stream->{}, callId->{}, onlyAudio->{}, streamType->{}", 191 logger.info("[第三方服务对接->发送流] ssrc->{}, ip->{}, port->{}, app->{}, stream->{}, callId->{}, onlyAudio->{}, streamType->{}",
194 ssrc, ip, port, app, stream, callId, onlyAudio, streamType == 1? "ES":"PS"); 192 ssrc, ip, port, app, stream, callId, onlyAudio, streamType == 1? "ES":"PS");
  193 + if (ObjectUtils.isEmpty(streamType)) {
  194 + streamType = 1;
  195 + }
195 MediaServerItem mediaServerItem = mediaServerService.getDefaultMediaServer(); 196 MediaServerItem mediaServerItem = mediaServerService.getDefaultMediaServer();
196 String key = VideoManagerConstants.WVP_OTHER_SEND_RTP_INFO + userSetting.getServerId() + callId; 197 String key = VideoManagerConstants.WVP_OTHER_SEND_RTP_INFO + userSetting.getServerId() + callId;
197 OtherRtpSendInfo sendInfo = (OtherRtpSendInfo)redisTemplate.opsForValue().get(key); 198 OtherRtpSendInfo sendInfo = (OtherRtpSendInfo)redisTemplate.opsForValue().get(key);