Commit c0b79878f4ce282673ab9ac82d16397223a21a56
1 parent
67d1ff0d
合并主线
Showing
1 changed file
with
27 additions
and
27 deletions
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
| @@ -275,37 +275,37 @@ public class ZLMHttpHookListener { | @@ -275,37 +275,37 @@ public class ZLMHttpHookListener { | ||
| 275 | } | 275 | } |
| 276 | 276 | ||
| 277 | // 设置音频信息及录制信息 | 277 | // 设置音频信息及录制信息 |
| 278 | - List<SsrcTransaction> ssrcTransactionForAll = sessionManager.getSsrcTransactionForAll(null, null, null, param.getStream()); | ||
| 279 | - if (ssrcTransactionForAll != null && ssrcTransactionForAll.size() == 1) { | 278 | + List<SsrcTransaction> ssrcTransactionForAll = sessionManager.getSsrcTransactionForAll(null, null, null, param.getStream()); |
| 279 | + if (ssrcTransactionForAll != null && ssrcTransactionForAll.size() == 1) { | ||
| 280 | 280 | ||
| 281 | - // 为录制国标模拟一个鉴权信息, 方便后续写入录像文件时使用 | ||
| 282 | - StreamAuthorityInfo streamAuthorityInfo = StreamAuthorityInfo.getInstanceByHook(param); | ||
| 283 | - streamAuthorityInfo.setApp(param.getApp()); | ||
| 284 | - streamAuthorityInfo.setStream(ssrcTransactionForAll.get(0).getStream()); | ||
| 285 | - streamAuthorityInfo.setCallId(ssrcTransactionForAll.get(0).getSipTransactionInfo().getCallId()); | 281 | + // 为录制国标模拟一个鉴权信息, 方便后续写入录像文件时使用 |
| 282 | + StreamAuthorityInfo streamAuthorityInfo = StreamAuthorityInfo.getInstanceByHook(param); | ||
| 283 | + streamAuthorityInfo.setApp(param.getApp()); | ||
| 284 | + streamAuthorityInfo.setStream(ssrcTransactionForAll.get(0).getStream()); | ||
| 285 | + streamAuthorityInfo.setCallId(ssrcTransactionForAll.get(0).getSipTransactionInfo().getCallId()); | ||
| 286 | 286 | ||
| 287 | - redisCatchStorage.updateStreamAuthorityInfo(param.getApp(), ssrcTransactionForAll.get(0).getStream(), streamAuthorityInfo); | 287 | + redisCatchStorage.updateStreamAuthorityInfo(param.getApp(), ssrcTransactionForAll.get(0).getStream(), streamAuthorityInfo); |
| 288 | 288 | ||
| 289 | - String deviceId = ssrcTransactionForAll.get(0).getDeviceId(); | ||
| 290 | - String channelId = ssrcTransactionForAll.get(0).getChannelId(); | ||
| 291 | - DeviceChannel deviceChannel = storager.queryChannel(deviceId, channelId); | ||
| 292 | - if (deviceChannel != null) { | ||
| 293 | - result.setEnable_audio(deviceChannel.isHasAudio()); | ||
| 294 | - } | ||
| 295 | - // 如果是录像下载就设置视频间隔十秒 | ||
| 296 | - if (ssrcTransactionForAll.get(0).getType() == InviteSessionType.DOWNLOAD) { | ||
| 297 | - // 获取录像的总时长,然后设置为这个视频的时长 | ||
| 298 | - InviteInfo inviteInfoForDownload = inviteStreamService.getInviteInfo(InviteSessionType.DOWNLOAD, deviceId, channelId, param.getStream()); | ||
| 299 | - if (inviteInfoForDownload != null && inviteInfoForDownload.getStreamInfo() != null ) { | ||
| 300 | - String startTime = inviteInfoForDownload.getStreamInfo().getStartTime(); | ||
| 301 | - String endTime = inviteInfoForDownload.getStreamInfo().getEndTime(); | ||
| 302 | - long difference = DateUtil.getDifference(startTime, endTime)/1000; | ||
| 303 | - result.setMp4_max_second((int)difference); | ||
| 304 | - result.setEnable_mp4(true); | ||
| 305 | - // 设置为2保证得到的mp4的时长是正常的 | ||
| 306 | - result.setModify_stamp(2); | 289 | + String deviceId = ssrcTransactionForAll.get(0).getDeviceId(); |
| 290 | + String channelId = ssrcTransactionForAll.get(0).getChannelId(); | ||
| 291 | + DeviceChannel deviceChannel = storager.queryChannel(deviceId, channelId); | ||
| 292 | + if (deviceChannel != null) { | ||
| 293 | + result.setEnable_audio(deviceChannel.isHasAudio()); | ||
| 294 | + } | ||
| 295 | + // 如果是录像下载就设置视频间隔十秒 | ||
| 296 | + if (ssrcTransactionForAll.get(0).getType() == InviteSessionType.DOWNLOAD) { | ||
| 297 | + // 获取录像的总时长,然后设置为这个视频的时长 | ||
| 298 | + InviteInfo inviteInfoForDownload = inviteStreamService.getInviteInfo(InviteSessionType.DOWNLOAD, deviceId, channelId, param.getStream()); | ||
| 299 | + if (inviteInfoForDownload != null && inviteInfoForDownload.getStreamInfo() != null) { | ||
| 300 | + String startTime = inviteInfoForDownload.getStreamInfo().getStartTime(); | ||
| 301 | + String endTime = inviteInfoForDownload.getStreamInfo().getEndTime(); | ||
| 302 | + long difference = DateUtil.getDifference(startTime, endTime) / 1000; | ||
| 303 | + result.setMp4_max_second((int) difference); | ||
| 304 | + result.setEnable_mp4(true); | ||
| 305 | + // 设置为2保证得到的mp4的时长是正常的 | ||
| 306 | + result.setModify_stamp(2); | ||
| 307 | + } | ||
| 307 | } | 308 | } |
| 308 | - | ||
| 309 | } | 309 | } |
| 310 | } | 310 | } |
| 311 | if (param.getApp().equalsIgnoreCase("rtp")) { | 311 | if (param.getApp().equalsIgnoreCase("rtp")) { |