修复端口分配的并发问题
This commit is contained in:
@@ -139,8 +139,8 @@ public class RtpController {
|
||||
redisTemplate.opsForValue().set(receiveKey, otherRtpSendInfo);
|
||||
if (isSend != null && isSend) {
|
||||
// 预创建发流信息
|
||||
int portForVideo = sendRtpPortManager.getNextPort(mediaServerItem.getId());
|
||||
int portForAudio = sendRtpPortManager.getNextPort(mediaServerItem.getId());
|
||||
int portForVideo = sendRtpPortManager.getNextPort(mediaServerItem);
|
||||
int portForAudio = sendRtpPortManager.getNextPort(mediaServerItem);
|
||||
|
||||
otherRtpSendInfo.setSendLocalIp(mediaServerItem.getSdpIp());
|
||||
otherRtpSendInfo.setSendLocalPortForVideo(portForVideo);
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.conf.SipConfig;
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import com.genersoft.iot.vmp.conf.VersionInfo;
|
||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||
import com.genersoft.iot.vmp.media.zlm.SendRtpPortManager;
|
||||
import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.IHookSubscribe;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||
@@ -72,6 +73,9 @@ public class ServerController {
|
||||
@Autowired
|
||||
private IRedisCatchStorage redisCatchStorage;
|
||||
|
||||
@Autowired
|
||||
private SendRtpPortManager sendRtpPortManager;
|
||||
|
||||
|
||||
@GetMapping(value = "/media_server/list")
|
||||
@ResponseBody
|
||||
@@ -262,4 +266,12 @@ public class ServerController {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/test/getPort")
|
||||
@ResponseBody
|
||||
public int getPort() {
|
||||
int result = sendRtpPortManager.getNextPort(mediaServerService.getDefaultMediaServer());
|
||||
System.out.println(result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user