| | |
| | | // 非严格模式端口不统一, 增加兼容性,修改为一个不为0的端口 |
| | | localPort = new Random().nextInt(65535) + 1; |
| | | } |
| | | content.append("m=video " + localPort + " RTP/AVP 96\r\n"); |
| | | if (sendRtpItem.isTcp()) { |
| | | content.append("m=video " + localPort + " TCP/RTP/AVP 96\r\n"); |
| | | if (!sendRtpItem.isTcpActive()) { |
| | | content.append("a=setup:active\r\n"); |
| | | } else { |
| | | content.append("a=setup:passive\r\n"); |
| | | } |
| | | }else { |
| | | content.append("m=video " + localPort + " RTP/AVP 96\r\n"); |
| | | } |
| | | content.append("a=sendonly\r\n"); |
| | | content.append("a=rtpmap:96 PS/90000\r\n"); |
| | | content.append("y=" + sendRtpItem.getSsrc() + "\r\n"); |
| | |
| | | } |
| | | }); |
| | | } else { |
| | | |
| | | sendRtpItem.setPlayType(InviteStreamType.PLAY); |
| | | String streamId = String.format("%s_%s", device.getDeviceId(), channelId); |
| | | sendRtpItem.setStreamId(streamId); |
| | | redisCatchStorage.updateSendRTPSever(sendRtpItem); |
| | | SSRCInfo ssrcInfo = playService.play(mediaServerItem, device.getDeviceId(), channelId, ssrc, ((code, msg, data) -> { |
| | | if (code == InviteErrorCode.SUCCESS.getCode()) { |
| | | hookEvent.run(code, msg, data); |
| | |
| | | errorEvent.run(code, msg, data); |
| | | } |
| | | })); |
| | | sendRtpItem.setPlayType(InviteStreamType.PLAY); |
| | | String streamId = String.format("%s_%s", device.getDeviceId(), channelId); |
| | | sendRtpItem.setStreamId(streamId); |
| | | sendRtpItem.setSsrc(ssrcInfo.getSsrc()); |
| | | redisCatchStorage.updateSendRTPSever(sendRtpItem); |
| | | |