| | |
| | | }, userSetting.getPlayTimeout()); |
| | | |
| | | try { |
| | | mediaServerService.startSendRtpPassive(mediaServerItem, null, sendRtpItem, userSetting.getPlayTimeout() * 1000); |
| | | mediaServerService.startSendRtpPassive(mediaServerItem, sendRtpItem, userSetting.getPlayTimeout() * 1000); |
| | | }catch (ControllerException e) { |
| | | mediaServerService.releaseSsrc(mediaServerItem.getId(), sendRtpItem.getSsrc()); |
| | | logger.info("[语音对讲]失败 deviceId: {}, channelId: {}", device.getDeviceId(), channelId); |
| | |
| | | dynamicTask.stop(downLoadTimeOutTaskKey); |
| | | callback.run(InviteErrorCode.ERROR_FOR_SIGNALLING_TIMEOUT.getCode(), |
| | | String.format("录像下载失败, 错误码: %s, %s", event.statusCode, event.msg), null); |
| | | mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc()); |
| | | streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream()); |
| | | inviteStreamService.removeInviteInfo(inviteInfo); |
| | | }; |
| | |
| | | InviteInfo inviteInfoForNew = inviteStreamService.getInviteInfo(inviteInfo.getType(), inviteInfo.getDeviceId() |
| | | , inviteInfo.getChannelId(), inviteInfo.getStream()); |
| | | inviteInfoForNew.getStreamInfo().setDownLoadFilePath(downloadFileInfo); |
| | | inviteStreamService.updateInviteInfo(inviteInfoForNew); |
| | | // 不可以马上移除会导致后续接口拿不到下载地址 |
| | | inviteStreamService.updateInviteInfo(inviteInfoForNew, 60*15L); |
| | | }; |
| | | Hook hook = Hook.getInstance(HookType.on_record_mp4, "rtp", ssrcInfo.getStream(), mediaServerItem.getId()); |
| | | // 设置过期时间,下载失败时自动处理订阅数据 |
| | |
| | | return null; |
| | | } |
| | | String app = "rtp"; |
| | | MediaInfo mediaInfo = mediaServerService.getMediaInfo(mediaServerItem, app, stream); |
| | | if (mediaInfo == null) { |
| | | logger.warn("[获取下载进度] 查询进度失败, 节点Id: {}, {}/{}", mediaServerId, app, stream); |
| | | return null; |
| | | } |
| | | if (mediaInfo.getDuration() == 0) { |
| | | Long duration = mediaServerService.updateDownloadProcess(mediaServerItem, app, stream); |
| | | if (duration == null || duration == 0) { |
| | | inviteInfo.getStreamInfo().setProgress(0); |
| | | } else { |
| | | String startTime = inviteInfo.getStreamInfo().getStartTime(); |
| | |
| | | long start = DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime); |
| | | long end = DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime); |
| | | |
| | | BigDecimal currentCount = new BigDecimal(mediaInfo.getDuration()); |
| | | BigDecimal currentCount = new BigDecimal(duration); |
| | | BigDecimal totalCount = new BigDecimal((end - start) * 1000); |
| | | BigDecimal divide = currentCount.divide(totalCount, 2, RoundingMode.HALF_UP); |
| | | double process = divide.doubleValue(); |
| | |
| | | // 开始发流 |
| | | MediaServer mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); |
| | | |
| | | if (mediaInfo == null) { |
| | | RequestPushStreamMsg requestPushStreamMsg = RequestPushStreamMsg.getInstance(sendRtpItem); |
| | | redisGbPlayMsgListener.sendMsgForStartSendRtpStream(sendRtpItem.getServerId(), requestPushStreamMsg, () -> { |
| | | startSendRtpStreamFailHand(sendRtpItem, platform, callIdHeader); |
| | | }); |
| | | } else { |
| | | if (mediaInfo != null) { |
| | | try { |
| | | if (sendRtpItem.isTcpActive()) { |
| | | mediaServerService.startSendRtpPassive(mediaInfo, platform, sendRtpItem, null); |
| | | mediaServerService.startSendRtpPassive(mediaInfo, sendRtpItem, null); |
| | | } else { |
| | | mediaServerService.startSendRtp(mediaInfo, platform, sendRtpItem); |
| | | mediaServerService.startSendRtp(mediaInfo, sendRtpItem); |
| | | } |
| | | redisCatchStorage.sendPlatformStartPlayMsg(sendRtpItem, platform); |
| | | }catch (ControllerException e) { |
| | | logger.error("RTP推流失败: {}", e.getMessage()); |
| | | startSendRtpStreamFailHand(sendRtpItem, platform, callIdHeader); |