| | |
| | | List<SsrcTransaction> ssrcTransactionForAll = sessionManager.getSsrcTransactionForAll(null, null, null, param.getStream()); |
| | | if (ssrcTransactionForAll != null && ssrcTransactionForAll.size() == 1) { |
| | | |
| | | // 为录制国标模拟一个鉴权信息 |
| | | // 为录制国标模拟一个鉴权信息, 方便后续写入录像文件时使用 |
| | | StreamAuthorityInfo streamAuthorityInfo = StreamAuthorityInfo.getInstanceByHook(param); |
| | | streamAuthorityInfo.setApp(param.getApp()); |
| | | streamAuthorityInfo.setStream(ssrcTransactionForAll.get(0).getStream()); |
| | |
| | | } |
| | | // 如果是录像下载就设置视频间隔十秒 |
| | | if (ssrcTransactionForAll.get(0).getType() == InviteSessionType.DOWNLOAD) { |
| | | result.setMp4_max_second(10); |
| | | result.setEnable_mp4(true); |
| | | } |
| | | } |
| | | if (mediaInfo.getRecordAssistPort() > 0 && userSetting.getRecordPath() == null) { |
| | | logger.info("推流时发现尚未设置录像路径,从assist服务中读取"); |
| | | JSONObject info = assistRESTfulUtils.getInfo(mediaInfo, null); |
| | | if (info != null && info.getInteger("code") != null && info.getInteger("code") == 0 ) { |
| | | JSONObject dataJson = info.getJSONObject("data"); |
| | | if (dataJson != null) { |
| | | String recordPath = dataJson.getString("record"); |
| | | userSetting.setRecordPath(recordPath); |
| | | result.setMp4_save_path(recordPath); |
| | | // 修改zlm中的录像路径 |
| | | if (mediaInfo.isAutoConfig()) { |
| | | taskExecutor.execute(() -> { |
| | | mediaServerService.setZLMConfig(mediaInfo, false); |
| | | }); |
| | | } |
| | | // 获取录像的总时长,然后设置为这个视频的时长 |
| | | InviteInfo inviteInfo = inviteStreamService.getInviteInfo(InviteSessionType.DOWNLOAD, deviceId, channelId, param.getStream()); |
| | | if (inviteInfo.getStreamInfo() != null ) { |
| | | String startTime = inviteInfo.getStreamInfo().getStartTime(); |
| | | String endTime = inviteInfo.getStreamInfo().getEndTime(); |
| | | long difference = DateUtil.getDifference(startTime, endTime)/1000; |
| | | result.setMp4_max_second((int)difference); |
| | | result.setEnable_mp4(true); |
| | | // 设置为2保证得到的mp4的时长是正常的 |
| | | result.setModify_stamp(2); |
| | | } |
| | | |
| | | } |
| | | } |
| | | if (param.getApp().equalsIgnoreCase("rtp")) { |
| | |
| | | || param.getOriginType() == OriginType.RTC_PUSH.ordinal()) { |
| | | param.setSeverId(userSetting.getServerId()); |
| | | zlmMediaListManager.addPush(param); |
| | | |
| | | // 冗余数据,自己系统中自用 |
| | | redisCatchStorage.addPushListItem(param.getApp(), param.getStream(), param); |
| | | } |
| | | } else { |
| | | // 兼容流注销时类型从redis记录获取 |
| | |
| | | if (onStreamChangedHookParam != null) { |
| | | type = OriginType.values()[onStreamChangedHookParam.getOriginType()].getType(); |
| | | redisCatchStorage.removeStream(mediaInfo.getId(), type, param.getApp(), param.getStream()); |
| | | if ("PUSH".equalsIgnoreCase(type)) { |
| | | // 冗余数据,自己系统中自用 |
| | | redisCatchStorage.removePushListItem(param.getApp(), param.getStream(), param.getMediaServerId()); |
| | | } |
| | | } |
| | | GbStream gbStream = storager.getGbStream(param.getApp(), param.getStream()); |
| | | if (gbStream != null) { |