old mode 100644
new mode 100755
 |  |  | 
 |  |  | import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe; | 
 |  |  | import com.genersoft.iot.vmp.media.zlm.dto.*; | 
 |  |  | import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam; | 
 |  |  | import com.genersoft.iot.vmp.service.IMediaServerService; | 
 |  |  | import com.genersoft.iot.vmp.service.IPlayService; | 
 |  |  | import com.genersoft.iot.vmp.service.IStreamProxyService; | 
 |  |  | import com.genersoft.iot.vmp.service.IStreamPushService; | 
 |  |  | import com.genersoft.iot.vmp.service.*; | 
 |  |  | import com.genersoft.iot.vmp.service.bean.ErrorCallback; | 
 |  |  | import com.genersoft.iot.vmp.service.bean.InviteErrorCode; | 
 |  |  | import com.genersoft.iot.vmp.service.bean.MessageForPushChannel; | 
 |  |  | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private IRedisCatchStorage redisCatchStorage; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private IInviteStreamService inviteStreamService; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private SSRCFactory ssrcFactory; | 
 |  |  | 
 |  |  |                     sendRtpItem.setApp("rtp"); | 
 |  |  |                     if ("Playback".equalsIgnoreCase(sessionName)) { | 
 |  |  |                         sendRtpItem.setPlayType(InviteStreamType.PLAYBACK); | 
 |  |  |                         SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, null, null, device.isSsrcCheck(), true, 0, false, device.getStreamModeForParam()); | 
 |  |  |                         String startTimeStr = DateUtil.urlFormatter.format(start); | 
 |  |  |                         String endTimeStr = DateUtil.urlFormatter.format(end); | 
 |  |  |                         String stream = device.getDeviceId() + "_" + channelId + "_" + startTimeStr + "_" + endTimeStr; | 
 |  |  |                         SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, stream, null, device.isSsrcCheck(), true, 0, false, device.getStreamModeForParam()); | 
 |  |  |                         sendRtpItem.setStreamId(ssrcInfo.getStream()); | 
 |  |  |                         // 写入redis, 超时时回复 | 
 |  |  |                         redisCatchStorage.updateSendRTPSever(sendRtpItem); | 
 |  |  | 
 |  |  |                                         errorEvent.run(code, msg, data); | 
 |  |  |                                     } | 
 |  |  |                                 }); | 
 |  |  |                     }else if ("Download".equalsIgnoreCase(sessionName)) { | 
 |  |  |                     } else if ("Download".equalsIgnoreCase(sessionName)) { | 
 |  |  |                         // 获取指定的下载速度 | 
 |  |  |                         Vector sdpMediaDescriptions = sdp.getMediaDescriptions(true); | 
 |  |  |                         MediaDescription mediaDescription = null; | 
 |  |  |                         String downloadSpeed = "1"; | 
 |  |  |                         if (sdpMediaDescriptions.size() > 0) { | 
 |  |  |                             mediaDescription = (MediaDescription)sdpMediaDescriptions.get(0); | 
 |  |  |                             mediaDescription = (MediaDescription) sdpMediaDescriptions.get(0); | 
 |  |  |                         } | 
 |  |  |                         if (mediaDescription != null) { | 
 |  |  |                             downloadSpeed = mediaDescription.getAttribute("downloadspeed"); | 
 |  |  | 
 |  |  |                         playService.download(mediaServerItem, ssrcInfo, device.getDeviceId(), channelId, DateUtil.formatter.format(start), | 
 |  |  |                                 DateUtil.formatter.format(end), Integer.parseInt(downloadSpeed), | 
 |  |  |                                 (code, msg, data) -> { | 
 |  |  |                                     if (code == InviteErrorCode.SUCCESS.getCode()){ | 
 |  |  |                                     if (code == InviteErrorCode.SUCCESS.getCode()) { | 
 |  |  |                                         hookEvent.run(code, msg, data); | 
 |  |  |                                     }else if (code == InviteErrorCode.ERROR_FOR_SIGNALLING_TIMEOUT.getCode() || code == InviteErrorCode.ERROR_FOR_STREAM_TIMEOUT.getCode()){ | 
 |  |  |                                     } else if (code == InviteErrorCode.ERROR_FOR_SIGNALLING_TIMEOUT.getCode() || code == InviteErrorCode.ERROR_FOR_STREAM_TIMEOUT.getCode()) { | 
 |  |  |                                         logger.info("[录像下载]超时, 用户:{}, 通道:{}", username, channelId); | 
 |  |  |                                         redisCatchStorage.deleteSendRTPServer(platform.getServerGBId(), channelId, callIdHeader.getCallId(), null); | 
 |  |  |                                         errorEvent.run(code, msg, data); | 
 |  |  |                                     }else { | 
 |  |  |                                     } else { | 
 |  |  |                                         errorEvent.run(code, msg, data); | 
 |  |  |                                     } | 
 |  |  |                                 }); | 
 |  |  |                     }else { | 
 |  |  |                     } else { | 
 |  |  |  | 
 |  |  |                         SSRCInfo ssrcInfo = playService.play(mediaServerItem, device.getDeviceId(), channelId, ssrc, ((code, msg, data) -> { | 
 |  |  |                             if (code == InviteErrorCode.SUCCESS.getCode()){ | 
 |  |  |                             if (code == InviteErrorCode.SUCCESS.getCode()) { | 
 |  |  |                                 hookEvent.run(code, msg, data); | 
 |  |  |                             }else if (code == InviteErrorCode.ERROR_FOR_SIGNALLING_TIMEOUT.getCode() || code == InviteErrorCode.ERROR_FOR_STREAM_TIMEOUT.getCode()){ | 
 |  |  |                             } else if (code == InviteErrorCode.ERROR_FOR_SIGNALLING_TIMEOUT.getCode() || code == InviteErrorCode.ERROR_FOR_STREAM_TIMEOUT.getCode()) { | 
 |  |  |                                 logger.info("[上级点播]超时, 用户:{}, 通道:{}", username, channelId); | 
 |  |  |                                 redisCatchStorage.deleteSendRTPServer(platform.getServerGBId(), channelId, callIdHeader.getCallId(), null); | 
 |  |  |                                 errorEvent.run(code, msg, data); | 
 |  |  |                             }else { | 
 |  |  |                             } else { | 
 |  |  |                                 errorEvent.run(code, msg, data); | 
 |  |  |                             } | 
 |  |  |                         })); | 
 |  |  |                         sendRtpItem.setPlayType(InviteStreamType.PLAY); | 
 |  |  |                         String streamId = null; | 
 |  |  |                         if (mediaServerItem.isRtpEnable()) { | 
 |  |  |                             streamId = String.format("%s_%s", device.getDeviceId(), channelId); | 
 |  |  |                         }else { | 
 |  |  |                             streamId = String.format("%08x", Integer.parseInt(ssrcInfo.getSsrc())).toUpperCase(); | 
 |  |  |                         } | 
 |  |  |                         String streamId = String.format("%s_%s", device.getDeviceId(), channelId); | 
 |  |  |                         sendRtpItem.setStreamId(streamId); | 
 |  |  |                         sendRtpItem.setSsrc(ssrcInfo.getSsrc()); | 
 |  |  |                         redisCatchStorage.updateSendRTPSever(sendRtpItem); |