Commit 4a0f5cf76dac6d82a7c6c576012c37db203308ff
1 parent
6e48dd3f
去除调试内容
Showing
2 changed files
with
12 additions
and
7 deletions
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 | 96 | param.put("src_port", sendRtpItem.getLocalPort()); |
| 97 | 97 | param.put("pt", sendRtpItem.getPt()); |
| 98 | 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 | 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 | 671 | sendRtpItem.setStatus(1); |
| 672 | 672 | sendRtpItem.setApp(app); |
| 673 | 673 | sendRtpItem.setStreamId(stream); |
| 674 | + sendRtpItem.setPt(8); | |
| 675 | + sendRtpItem.setUsePs(false); | |
| 676 | + sendRtpItem.setOnlyAudio(true); | |
| 674 | 677 | redisCatchStorage.updateSendRTPSever(sendRtpItem); |
| 675 | 678 | |
| 676 | 679 | // hook监听等待设备推流上来 |
| ... | ... | @@ -683,6 +686,8 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements |
| 683 | 686 | subscribeKey.put("mediaServerId", mediaServerItem.getId()); |
| 684 | 687 | String finalSsrc = ssrc; |
| 685 | 688 | String waiteStreamTimeoutTaskKey = "waite-stream-" + device.getDeviceId() + channelId; |
| 689 | + | |
| 690 | + // 流已经存在时直接推流 | |
| 686 | 691 | if (zlmrtpServerFactory.isStreamReady(mediaServerItem, app, stream)) { |
| 687 | 692 | logger.info("发现已经在推流"); |
| 688 | 693 | dynamicTask.stop(waiteStreamTimeoutTaskKey); |
| ... | ... | @@ -714,12 +719,12 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements |
| 714 | 719 | throw new RuntimeException(e); |
| 715 | 720 | } |
| 716 | 721 | }else { |
| 722 | + // 流不存在时监听流上线 | |
| 717 | 723 | // 设置等待推流的超时; 默认20s |
| 718 | - String finalChannelId = channelId; | |
| 719 | 724 | dynamicTask.startDelay(waiteStreamTimeoutTaskKey, ()->{ |
| 720 | 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 | 728 | }else { |
| 724 | 729 | // 兼容海康使用了错误的通道ID的情况 |
| 725 | 730 | audioBroadcastManager.delByDeviceId(device.getDeviceId()); |
| ... | ... | @@ -741,7 +746,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements |
| 741 | 746 | redisCatchStorage.updateSendRTPSever(sendRtpItem); |
| 742 | 747 | StringBuffer content = new StringBuffer(200); |
| 743 | 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 | 750 | content.append("s=Play\r\n"); |
| 746 | 751 | content.append("c=IN IP4 "+mediaServerItem.getSdpIp()+"\r\n"); |
| 747 | 752 | content.append("t=0 0\r\n"); | ... | ... |