Commit c551164c89f70e664b498c3a09e615928261e01a

Authored by 648540858
1 parent 975ace05

合并主线

src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
@@ -1026,9 +1026,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements @@ -1026,9 +1026,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
1026 1026
1027 SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId, 1027 SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId,
1028 device.getDeviceId(), broadcastCatch.getChannelId(), 1028 device.getDeviceId(), broadcastCatch.getChannelId(),
1029 - mediaTransmissionTCP, false, ssrcFromCallback -> {  
1030 - return redisCatchStorage.querySendRTPServer(requesterId, channelId, null, callIdHeader.getCallId()) != null;  
1031 - }); 1029 + mediaTransmissionTCP, false);
1032 1030
1033 if (sendRtpItem == null) { 1031 if (sendRtpItem == null) {
1034 logger.warn("服务器端口资源不足"); 1032 logger.warn("服务器端口资源不足");
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java
@@ -236,11 +236,6 @@ public class ZLMRTPServerFactory { @@ -236,11 +236,6 @@ public class ZLMRTPServerFactory {
236 * 调用zlm RESTFUL API —— startSendRtpPassive 236 * 调用zlm RESTFUL API —— startSendRtpPassive
237 */ 237 */
238 public JSONObject startSendRtpPassive(MediaServerItem mediaServerItem, Map<String, Object>param) { 238 public JSONObject startSendRtpPassive(MediaServerItem mediaServerItem, Map<String, Object>param) {
239 - System.out.println("=====================");  
240 - for (String s : param.keySet()) {  
241 - System.out.println(s + ": " + param.get(s));  
242 - }  
243 - System.out.println("=========END============");  
244 return zlmresTfulUtils.startSendRtpPassive(mediaServerItem, param); 239 return zlmresTfulUtils.startSendRtpPassive(mediaServerItem, param);
245 } 240 }
246 241
@@ -334,18 +329,14 @@ public class ZLMRTPServerFactory { @@ -334,18 +329,14 @@ public class ZLMRTPServerFactory {
334 // 如果是非严格模式,需要关闭端口占用 329 // 如果是非严格模式,需要关闭端口占用
335 JSONObject startSendRtpStreamResult = null; 330 JSONObject startSendRtpStreamResult = null;
336 if (sendRtpItem.getLocalPort() != 0) { 331 if (sendRtpItem.getLocalPort() != 0) {
337 - HookSubscribeForRtpServerTimeout hookSubscribeForRtpServerTimeout = HookSubscribeFactory.on_rtp_server_timeout(sendRtpItem.getSsrc(), null, mediaInfo.getId());  
338 - hookSubscribe.removeSubscribe(hookSubscribeForRtpServerTimeout);  
339 - if (releasePort(mediaInfo, sendRtpItem.getSsrc())) {  
340 - if (sendRtpItem.isTcpActive()) {  
341 - startSendRtpStreamResult = startSendRtpPassive(mediaInfo, param);  
342 - System.out.println(JSON.toJSON(param));  
343 - }else {  
344 - param.put("is_udp", is_Udp);  
345 - param.put("dst_url", sendRtpItem.getIp());  
346 - param.put("dst_port", sendRtpItem.getPort());  
347 - startSendRtpStreamResult = startSendRtpStream(mediaInfo, param);  
348 - } 332 + if (sendRtpItem.isTcpActive()) {
  333 + startSendRtpStreamResult = startSendRtpPassive(mediaInfo, param);
  334 + System.out.println(JSON.toJSON(param));
  335 + }else {
  336 + param.put("is_udp", is_Udp);
  337 + param.put("dst_url", sendRtpItem.getIp());
  338 + param.put("dst_port", sendRtpItem.getPort());
  339 + startSendRtpStreamResult = startSendRtpStream(mediaInfo, param);
349 } 340 }
350 }else { 341 }else {
351 if (sendRtpItem.isTcpActive()) { 342 if (sendRtpItem.isTcpActive()) {
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
@@ -16,14 +16,10 @@ import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; @@ -16,14 +16,10 @@ import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
16 import com.genersoft.iot.vmp.gb28181.session.AudioBroadcastManager; 16 import com.genersoft.iot.vmp.gb28181.session.AudioBroadcastManager;
17 import com.genersoft.iot.vmp.gb28181.session.SSRCFactory; 17 import com.genersoft.iot.vmp.gb28181.session.SSRCFactory;
18 import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; 18 import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
19 -import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;  
20 import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; 19 import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
21 import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; 20 import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
22 import com.genersoft.iot.vmp.gb28181.utils.SipUtils; 21 import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
23 -import com.genersoft.iot.vmp.media.zlm.AssistRESTfulUtils;  
24 -import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;  
25 -import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;  
26 -import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe; 22 +import com.genersoft.iot.vmp.media.zlm.*;
27 import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory; 23 import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory;
28 import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange; 24 import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange;
29 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; 25 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
@@ -94,7 +90,7 @@ public class PlayServiceImpl implements IPlayService { @@ -94,7 +90,7 @@ public class PlayServiceImpl implements IPlayService {
94 private IInviteStreamService inviteStreamService; 90 private IInviteStreamService inviteStreamService;
95 91
96 @Autowired 92 @Autowired
97 - private DeferredResultHolder resultHolder; 93 + private SendRtpPortManager sendRtpPortManager;
98 94
99 @Autowired 95 @Autowired
100 private ZLMRESTfulUtils zlmresTfulUtils; 96 private ZLMRESTfulUtils zlmresTfulUtils;
@@ -235,9 +231,7 @@ public class PlayServiceImpl implements IPlayService { @@ -235,9 +231,7 @@ public class PlayServiceImpl implements IPlayService {
235 sendRtpItem.setReceiveStream(stream + "_talk"); 231 sendRtpItem.setReceiveStream(stream + "_talk");
236 232
237 String callId = SipUtils.getNewCallId(); 233 String callId = SipUtils.getNewCallId();
238 - int port = zlmrtpServerFactory.keepPort(mediaServerItem, playSsrc, 0, ssrcFromCallback ->{  
239 - return redisCatchStorage.querySendRTPServer(device.getDeviceId(), channelId, null, callId) != null;  
240 - }); 234 + int port = sendRtpPortManager.getNextPort(mediaServerItem.getId());
241 //端口获取失败的ssrcInfo 没有必要发送点播指令 235 //端口获取失败的ssrcInfo 没有必要发送点播指令
242 if (port <= 0) { 236 if (port <= 0) {
243 logger.info("[语音对讲] 端口分配异常,deviceId={},channelId={}", device.getDeviceId(), channelId); 237 logger.info("[语音对讲] 端口分配异常,deviceId={},channelId={}", device.getDeviceId(), channelId);
@@ -265,9 +259,6 @@ public class PlayServiceImpl implements IPlayService { @@ -265,9 +259,6 @@ public class PlayServiceImpl implements IPlayService {
265 } 259 }
266 }, userSetting.getPlayTimeout()); 260 }, userSetting.getPlayTimeout());
267 261
268 -  
269 -  
270 - zlmrtpServerFactory.releasePort(mediaServerItem, playSsrc);  
271 Map<String, Object> param = new HashMap<>(12); 262 Map<String, Object> param = new HashMap<>(12);
272 param.put("vhost","__defaultVhost__"); 263 param.put("vhost","__defaultVhost__");
273 param.put("app", sendRtpItem.getApp()); 264 param.put("app", sendRtpItem.getApp());
@@ -1467,18 +1458,13 @@ public class PlayServiceImpl implements IPlayService { @@ -1467,18 +1458,13 @@ public class PlayServiceImpl implements IPlayService {
1467 // 如果是严格模式,需要关闭端口占用 1458 // 如果是严格模式,需要关闭端口占用
1468 JSONObject startSendRtpStreamResult = null; 1459 JSONObject startSendRtpStreamResult = null;
1469 if (sendRtpItem.getLocalPort() != 0) { 1460 if (sendRtpItem.getLocalPort() != 0) {
1470 - if (zlmrtpServerFactory.releasePort(mediaInfo, sendRtpItem.getSsrc())) {  
1471 - if (sendRtpItem.isTcpActive()) {  
1472 - startSendRtpStreamResult = zlmrtpServerFactory.startSendRtpPassive(mediaInfo, param);  
1473 - } else {  
1474 - param.put("dst_url", sendRtpItem.getIp());  
1475 - param.put("dst_port", sendRtpItem.getPort());  
1476 - startSendRtpStreamResult = zlmrtpServerFactory.startSendRtpStream(mediaInfo, param);  
1477 - }  
1478 - }else {  
1479 - // TODO 释放失败的处理 1461 + if (sendRtpItem.isTcpActive()) {
  1462 + startSendRtpStreamResult = zlmrtpServerFactory.startSendRtpPassive(mediaInfo, param);
  1463 + } else {
  1464 + param.put("dst_url", sendRtpItem.getIp());
  1465 + param.put("dst_port", sendRtpItem.getPort());
  1466 + startSendRtpStreamResult = zlmrtpServerFactory.startSendRtpStream(mediaInfo, param);
1480 } 1467 }
1481 -  
1482 } else { 1468 } else {
1483 if (sendRtpItem.isTcpActive()) { 1469 if (sendRtpItem.isTcpActive()) {
1484 startSendRtpStreamResult = zlmrtpServerFactory.startSendRtpPassive(mediaInfo, param); 1470 startSendRtpStreamResult = zlmrtpServerFactory.startSendRtpPassive(mediaInfo, param);