Commit 4a0f5cf76dac6d82a7c6c576012c37db203308ff

Authored by 648540858
1 parent 6e48dd3f

去除调试内容

src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java
@@ -96,9 +96,9 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In @@ -96,9 +96,9 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In
96 param.put("src_port", sendRtpItem.getLocalPort()); 96 param.put("src_port", sendRtpItem.getLocalPort());
97 param.put("pt", sendRtpItem.getPt()); 97 param.put("pt", sendRtpItem.getPt());
98 param.put("use_ps", sendRtpItem.isUsePs() ? "1" : "0"); 98 param.put("use_ps", sendRtpItem.isUsePs() ? "1" : "0");
99 - param.put("only_audio", sendRtpItem.isOnlyAudio());  
100 - zlmrtpServerFactory.startSendRtpStream(mediaInfo, param);  
101 - 99 + param.put("only_audio", sendRtpItem.isOnlyAudio() ? "1" : "0");
  100 + JSONObject jsonObject = zlmrtpServerFactory.startSendRtpStream(mediaInfo, param);
  101 + System.out.println(jsonObject);
102 102
103 103
104 // if (streamInfo == null) { // 流还没上来,对方就回复ack 104 // if (streamInfo == null) { // 流还没上来,对方就回复ack
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
@@ -671,6 +671,9 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements @@ -671,6 +671,9 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
671 sendRtpItem.setStatus(1); 671 sendRtpItem.setStatus(1);
672 sendRtpItem.setApp(app); 672 sendRtpItem.setApp(app);
673 sendRtpItem.setStreamId(stream); 673 sendRtpItem.setStreamId(stream);
  674 + sendRtpItem.setPt(8);
  675 + sendRtpItem.setUsePs(false);
  676 + sendRtpItem.setOnlyAudio(true);
674 redisCatchStorage.updateSendRTPSever(sendRtpItem); 677 redisCatchStorage.updateSendRTPSever(sendRtpItem);
675 678
676 // hook监听等待设备推流上来 679 // hook监听等待设备推流上来
@@ -683,6 +686,8 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements @@ -683,6 +686,8 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
683 subscribeKey.put("mediaServerId", mediaServerItem.getId()); 686 subscribeKey.put("mediaServerId", mediaServerItem.getId());
684 String finalSsrc = ssrc; 687 String finalSsrc = ssrc;
685 String waiteStreamTimeoutTaskKey = "waite-stream-" + device.getDeviceId() + channelId; 688 String waiteStreamTimeoutTaskKey = "waite-stream-" + device.getDeviceId() + channelId;
  689 +
  690 + // 流已经存在时直接推流
686 if (zlmrtpServerFactory.isStreamReady(mediaServerItem, app, stream)) { 691 if (zlmrtpServerFactory.isStreamReady(mediaServerItem, app, stream)) {
687 logger.info("发现已经在推流"); 692 logger.info("发现已经在推流");
688 dynamicTask.stop(waiteStreamTimeoutTaskKey); 693 dynamicTask.stop(waiteStreamTimeoutTaskKey);
@@ -714,12 +719,12 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements @@ -714,12 +719,12 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
714 throw new RuntimeException(e); 719 throw new RuntimeException(e);
715 } 720 }
716 }else { 721 }else {
  722 + // 流不存在时监听流上线
717 // 设置等待推流的超时; 默认20s 723 // 设置等待推流的超时; 默认20s
718 - String finalChannelId = channelId;  
719 dynamicTask.startDelay(waiteStreamTimeoutTaskKey, ()->{ 724 dynamicTask.startDelay(waiteStreamTimeoutTaskKey, ()->{
720 logger.info("等待推流超时: {}/{}", app, stream); 725 logger.info("等待推流超时: {}/{}", app, stream);
721 - if (audioBroadcastManager.exit(device.getDeviceId(), finalChannelId)) {  
722 - audioBroadcastManager.del(device.getDeviceId(), finalChannelId); 726 + if (audioBroadcastManager.exit(device.getDeviceId(), channelId)) {
  727 + audioBroadcastManager.del(device.getDeviceId(), channelId);
723 }else { 728 }else {
724 // 兼容海康使用了错误的通道ID的情况 729 // 兼容海康使用了错误的通道ID的情况
725 audioBroadcastManager.delByDeviceId(device.getDeviceId()); 730 audioBroadcastManager.delByDeviceId(device.getDeviceId());
@@ -741,7 +746,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements @@ -741,7 +746,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
741 redisCatchStorage.updateSendRTPSever(sendRtpItem); 746 redisCatchStorage.updateSendRTPSever(sendRtpItem);
742 StringBuffer content = new StringBuffer(200); 747 StringBuffer content = new StringBuffer(200);
743 content.append("v=0\r\n"); 748 content.append("v=0\r\n");
744 - content.append("o="+ finalChannelId +" 0 0 IN IP4 "+mediaServerItem.getSdpIp()+"\r\n"); 749 + content.append("o="+ channelId +" 0 0 IN IP4 "+mediaServerItem.getSdpIp()+"\r\n");
745 content.append("s=Play\r\n"); 750 content.append("s=Play\r\n");
746 content.append("c=IN IP4 "+mediaServerItem.getSdpIp()+"\r\n"); 751 content.append("c=IN IP4 "+mediaServerItem.getSdpIp()+"\r\n");
747 content.append("t=0 0\r\n"); 752 content.append("t=0 0\r\n");