Commit 0a3d25fb5b54bc55ea70ac5ac209728c09f028dd
1 parent
ba8fffd9
修复非必传参数
Showing
1 changed file
with
8 additions
and
7 deletions
src/main/java/com/genersoft/iot/vmp/vmanager/rtp/RtpController.java
| ... | ... | @@ -28,10 +28,8 @@ import org.slf4j.LoggerFactory; |
| 28 | 28 | import org.springframework.beans.factory.annotation.Autowired; |
| 29 | 29 | import org.springframework.beans.factory.annotation.Value; |
| 30 | 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 | 34 | import java.io.IOException; |
| 37 | 35 | import java.util.HashMap; |
| ... | ... | @@ -95,7 +93,7 @@ public class RtpController { |
| 95 | 93 | @Parameter(name = "stream", description = "形成的流的ID", required = true) |
| 96 | 94 | @Parameter(name = "tcpMode", description = "收流模式, 0为UDP, 1为TCP被动", required = true) |
| 97 | 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 | 98 | logger.info("[第三方服务对接->开启收流和获取发流信息] isSend->{}, ssrc->{}, callId->{}, stream->{}, tcpMode->{}, callBack->{}", |
| 101 | 99 | isSend, ssrc, callId, stream, tcpMode==0?"UDP":"TCP被动", callBack); |
| ... | ... | @@ -159,7 +157,7 @@ public class RtpController { |
| 159 | 157 | logger.info("[第三方服务对接->开启收流和获取发流信息] 端口保持超时 callId->{}", callId); |
| 160 | 158 | redisTemplate.delete(key); |
| 161 | 159 | zlmServerFactory.releasePort(mediaServerItem, callId); |
| 162 | - }, 300000); | |
| 160 | + }, 15000); | |
| 163 | 161 | otherRtpSendInfo.setIp(mediaServerItem.getSdpIp()); |
| 164 | 162 | otherRtpSendInfo.setPort(port); |
| 165 | 163 | logger.info("[开启收流和获取发流信息] 结果,callId->{}, {}", callId, otherRtpSendInfo); |
| ... | ... | @@ -189,9 +187,12 @@ public class RtpController { |
| 189 | 187 | @Parameter(name = "onlyAudio", description = "是否只有音频", required = true) |
| 190 | 188 | @Parameter(name = "isUdp", description = "是否为UDP", required = true) |
| 191 | 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 | 191 | logger.info("[第三方服务对接->发送流] ssrc->{}, ip->{}, port->{}, app->{}, stream->{}, callId->{}, onlyAudio->{}, streamType->{}", |
| 194 | 192 | ssrc, ip, port, app, stream, callId, onlyAudio, streamType == 1? "ES":"PS"); |
| 193 | + if (ObjectUtils.isEmpty(streamType)) { | |
| 194 | + streamType = 1; | |
| 195 | + } | |
| 195 | 196 | MediaServerItem mediaServerItem = mediaServerService.getDefaultMediaServer(); |
| 196 | 197 | String key = VideoManagerConstants.WVP_OTHER_SEND_RTP_INFO + userSetting.getServerId() + callId; |
| 197 | 198 | OtherRtpSendInfo sendInfo = (OtherRtpSendInfo)redisTemplate.opsForValue().get(key); | ... | ... |