| | |
| | | * @param requestEvent RequestEvent事件 |
| | | */ |
| | | @Override |
| | | @Async |
| | | @Async("taskExecutor") |
| | | public void processRequest(RequestEvent requestEvent) { |
| | | String method = requestEvent.getRequest().getMethod(); |
| | | if ("NOTIFY".equalsIgnoreCase(requestEvent.getRequest().getMethod())) { |
| | |
| | | * @param responseEvent responseEvent事件 |
| | | */ |
| | | @Override |
| | | @Async |
| | | @Async("taskExecutor") |
| | | public void processResponse(ResponseEvent responseEvent) { |
| | | Response response = responseEvent.getResponse(); |
| | | int status = response.getStatusCode(); |
| | |
| | | SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(platformGbId, channelId, null, callIdHeader.getCallId()); |
| | | String is_Udp = sendRtpItem.isTcp() ? "0" : "1"; |
| | | MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); |
| | | logger.info("收到ACK,开始向上级推流 rtp/{}", sendRtpItem.getStreamId()); |
| | | logger.info("收到ACK,rtp/{}开始向上级推流, 目标 {}:{},SSRC={}", sendRtpItem.getStreamId(), sendRtpItem.getIp(), sendRtpItem.getPort(), sendRtpItem.getSsrc()); |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("vhost","__defaultVhost__"); |
| | | param.put("app",sendRtpItem.getApp()); |
| | |
| | | result = rtpInfo.getInteger("local_port"); |
| | | if (result == 0) { |
| | | // 此时说明rtpServer已经创建但是流还没有推上来 |
| | | |
| | | // 此时重新打开rtpServer |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("stream_id", streamId); |
| | | JSONObject jsonObject = zlmresTfulUtils.closeRtpServer(mediaServerItem, param); |
| | | if (jsonObject != null ) { |
| | | System.out.println(jsonObject); |
| | | if (jsonObject.getInteger("code") == 0) { |
| | | return createRTPServer(mediaServerItem, streamId, ssrc, port); |
| | | }else { |
| | | logger.warn("[开启rtpServer], 重启RtpServer错误"); |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | |
| | | }, 60 * 1000 ); |
| | | } |
| | | |
| | | @Async |
| | | @Async("taskExecutor") |
| | | public void connectZlmServer(MediaServerItem mediaServerItem){ |
| | | String connectZlmServerTaskKey = "connect-zlm-" + mediaServerItem.getId(); |
| | | ZLMServerConfig zlmServerConfigFirst = getMediaServerConfig(mediaServerItem); |
| | |
| | | @Autowired |
| | | private IPlayService playService; |
| | | |
| | | @Async |
| | | @Async("taskExecutor") |
| | | @EventListener |
| | | public void onApplicationEvent(ZLMOnlineEvent event) { |
| | | logger.info("[ZLM] 上线 ID:" + event.getMediaServerId()); |
| | |
| | | playService.zlmServerOnline(event.getMediaServerId()); |
| | | } |
| | | |
| | | @Async |
| | | @Async("taskExecutor") |
| | | @EventListener |
| | | public void onApplicationEvent(ZLMOfflineEvent event) { |
| | | |
| | |
| | | if (ssrcInfo == null) { |
| | | ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId, device.isSsrcCheck(), false); |
| | | } |
| | | logger.info("[点播开始] deviceId: {}, channelId: {}, SSRC: {}", device.getDeviceId(), channelId, ssrcInfo.getSsrc() ); |
| | | logger.info("[点播开始] deviceId: {}, channelId: {},收流端口: {}, 收流模式:{}, SSRC: {}, SSRC校验:{}", device.getDeviceId(), channelId, ssrcInfo.getPort(), device.getStreamMode(), ssrcInfo.getSsrc(), device.isSsrcCheck() ); |
| | | // 超时处理 |
| | | String timeOutTaskKey = UUID.randomUUID().toString(); |
| | | SSRCInfo finalSsrcInfo = ssrcInfo; |
| | |
| | | |
| | | SIPDialog dialog = streamSession.getDialogByStream(device.getDeviceId(), channelId, finalSsrcInfo.getStream()); |
| | | if (dialog != null) { |
| | | logger.info("[点播超时] 收流超时 deviceId: {}, channelId: {}", device.getDeviceId(), channelId); |
| | | logger.info("[点播超时] 收流超时 deviceId: {}, channelId: {},端口:{}, SSRC: {}", device.getDeviceId(), channelId, finalSsrcInfo.getPort(), finalSsrcInfo.getSsrc()); |
| | | timeoutCallback.run(1, "收流超时"); |
| | | // 点播超时回复BYE 同时释放ssrc以及此次点播的资源 |
| | | cmder.streamByeCmd(device.getDeviceId(), channelId, finalSsrcInfo.getStream(), null); |
| | | }else { |
| | | logger.info("[点播超时] 消息未响应 deviceId: {}, channelId: {}", device.getDeviceId(), channelId); |
| | | logger.info("[点播超时] 消息未响应 deviceId: {}, channelId: {},端口:{}, SSRC: {}", device.getDeviceId(), channelId, finalSsrcInfo.getPort(), finalSsrcInfo.getSsrc()); |
| | | timeoutCallback.run(0, "点播超时"); |
| | | mediaServerService.releaseSsrc(mediaServerItem.getId(), finalSsrcInfo.getSsrc()); |
| | | mediaServerService.closeRTPServer(mediaServerItem, finalSsrcInfo.getStream()); |
| | |
| | | console.log(this.videoUrl) |
| | | }, |
| | | openDialog: function (tab, deviceId, channelId, param) { |
| | | if (this.showVideoDialog) { |
| | | return; |
| | | } |
| | | this.tabActiveName = tab; |
| | | this.channelId = channelId; |
| | | this.deviceId = deviceId; |