|  |  |  | 
|---|
|  |  |  | import com.genersoft.iot.vmp.conf.exception.ControllerException; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.session.SSRCFactory; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.media.zlm.AssistRESTfulUtils; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.media.zlm.*; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.media.zlm.dto.ServerKeepaliveData; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.service.IInviteStreamService; | 
|---|
|  |  |  | 
|---|
|  |  |  | private UserSetting userSetting; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SendRtpPortManager sendRtpPortManager; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private AssistRESTfulUtils assistRESTfulUtils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ZLMRTPServerFactory zlmrtpServerFactory; | 
|---|
|  |  |  | private ZLMServerFactory zlmServerFactory; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private EventPublisher publisher; | 
|---|
|  |  |  | 
|---|
|  |  |  | if (hasKey != null && ! hasKey) { | 
|---|
|  |  |  | redisTemplate.opsForValue().set(key, mediaServerItem); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | if (streamId == null) { | 
|---|
|  |  |  | streamId = String.format("%08x", Integer.parseInt(ssrc)).toUpperCase(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | int ssrcCheckParam = 0; | 
|---|
|  |  |  | if (ssrcCheck && tcpMode > 1) { | 
|---|
|  |  |  | // 目前zlm不支持 tcp模式更新ssrc,暂时关闭ssrc校验 | 
|---|
|  |  |  | logger.warn("[openRTPServer] TCP被动/TCP主动收流时,默认关闭ssrc检验"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | int rtpServerPort; | 
|---|
|  |  |  | if (mediaServerItem.isRtpEnable()) { | 
|---|
|  |  |  | rtpServerPort = zlmrtpServerFactory.createRTPServer(mediaServerItem, streamId, ssrcCheck?Integer.parseInt(ssrc):0, port, reUsePort, tcpMode); | 
|---|
|  |  |  | rtpServerPort = zlmServerFactory.createRTPServer(mediaServerItem, streamId, (ssrcCheck && tcpMode == 0)?Integer.parseInt(ssrc):0, port, reUsePort, tcpMode); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | rtpServerPort = mediaServerItem.getRtpProxyPort(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | if (mediaServerItem == null) { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | zlmrtpServerFactory.closeRtpServer(mediaServerItem, streamId); | 
|---|
|  |  |  | zlmServerFactory.closeRtpServer(mediaServerItem, streamId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 
|---|
|  |  |  | callback.run(false); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | zlmrtpServerFactory.closeRtpServer(mediaServerItem, streamId, callback); | 
|---|
|  |  |  | zlmServerFactory.closeRtpServer(mediaServerItem, streamId, callback); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Boolean updateRtpServerSSRC(MediaServerItem mediaServerItem, String streamId, String ssrc) { | 
|---|
|  |  |  | return zlmrtpServerFactory.updateRtpServerSSRC(mediaServerItem, streamId, ssrc); | 
|---|
|  |  |  | return zlmServerFactory.updateRtpServerSSRC(mediaServerItem, streamId, ssrc); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|