| | |
| | | import com.genersoft.iot.vmp.media.service.IMediaServerService; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| | | import com.genersoft.iot.vmp.service.IInviteStreamService; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam; |
| | | 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.media.zlm.SendRtpPortManager; |
| | | import com.genersoft.iot.vmp.service.redisMsg.IRedisRpcService; |
| | | import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.*; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam; |
| | | 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; |
| | |
| | | return; |
| | | } |
| | | String username = sdp.getOrigin().getUsername(); |
| | | String addressStr = sdp.getConnection().getAddress(); |
| | | |
| | | String addressStr; |
| | | if(StringUtils.isEmpty(platform.getSendStreamIp())){ |
| | | addressStr = sdp.getConnection().getAddress(); |
| | | }else { |
| | | addressStr = platform.getSendStreamIp(); |
| | | } |
| | | |
| | | Device device = null; |
| | | // 通过 channel 和 gbStream 是否为null 值判断来源是直播流合适国标 |
| | |
| | | if (sendRtpItem.isTcpActive()) { |
| | | MediaServer mediaServer = mediaServerService.getOne(sendRtpItem.getMediaServerId()); |
| | | try { |
| | | mediaServerService.startSendRtpPassive(mediaServer, platform, sendRtpItem, 5); |
| | | mediaServerService.startSendRtpPassive(mediaServer, sendRtpItem, 5); |
| | | redisCatchStorage.sendPlatformStartPlayMsg(sendRtpItem, platform); |
| | | }catch (ControllerException e) {} |
| | | } |
| | | } catch (SipException | InvalidArgumentException | ParseException e) { |
| | |
| | | sendRtpItem.setPlayType(InviteStreamType.PUSH); |
| | | if (streamPushItem != null) { |
| | | // 从redis查询是否正在接收这个推流 |
| | | StreamPushItem pushListItem = redisCatchStorage.getPushListItem(gbStream.getApp(), gbStream.getStream()); |
| | | OnStreamChangedHookParam pushListItem = redisCatchStorage.getPushListItem(gbStream.getApp(), gbStream.getStream()); |
| | | if (pushListItem != null) { |
| | | sendRtpItem.setServerId(pushListItem.getServerId()); |
| | | sendRtpItem.setServerId(pushListItem.getSeverId()); |
| | | sendRtpItem.setMediaServerId(pushListItem.getMediaServerId()); |
| | | |
| | | StreamPushItem transform = streamPushService.transform(pushListItem); |
| | | transform.setSelf(userSetting.getServerId().equals(pushListItem.getServerId())); |
| | | redisCatchStorage.updateSendRTPSever(sendRtpItem); |
| | | // 开始推流 |
| | | sendPushStream(sendRtpItem, mediaServerItem, platform, request); |
| | |
| | | } |
| | | } else if ("proxy".equals(gbStream.getStreamType())) { |
| | | if (null != proxyByAppAndStream) { |
| | | sendRtpItem.setServerId(userSetting.getServerId()); |
| | | if (sendRtpItem.getSsrc() == null) { |
| | | // 上级平台点播时不使用上级平台指定的ssrc,使用自定义的ssrc,参考国标文档-点播外域设备媒体流SSRC处理方式 |
| | | String ssrc = "Play".equalsIgnoreCase(sessionName) ? ssrcFactory.getPlaySsrc(mediaServerItem.getId()) : ssrcFactory.getPlayBackSsrc(mediaServerItem.getId()); |
| | | sendRtpItem.setSsrc(ssrc); |
| | | } |
| | | if (proxyByAppAndStream.isStatus()) { |
| | | MediaInfo mediaInfo = redisCatchStorage.getProxyStream(gbStream.getApp(), gbStream.getStream()); |
| | | if (mediaInfo != null) { |
| | | sendProxyStream(sendRtpItem, mediaServerItem, platform, request); |
| | | } else { |
| | | //开启代理拉流 |
| | |
| | | sendRtpItem.setStatus(1); |
| | | sendRtpItem.setLocalIp(mediaServerItem.getSdpIp()); |
| | | |
| | | SIPResponse response = sendStreamAck(mediaServerItem, request, sendRtpItem, platform); |
| | | SIPResponse response = sendStreamAck(request, sendRtpItem, platform); |
| | | if (response != null) { |
| | | sendRtpItem.setToTag(response.getToTag()); |
| | | } |
| | |
| | | } |
| | | // 写入redis, 超时时回复 |
| | | sendRtpItem.setStatus(1); |
| | | SIPResponse response = sendStreamAck(mediaServerItem, request, sendRtpItem, platform); |
| | | SIPResponse response = sendStreamAck(request, sendRtpItem, platform); |
| | | if (response != null) { |
| | | sendRtpItem.setToTag(response.getToTag()); |
| | | } |
| | |
| | | redisCatchStorage.updateSendRTPSever(sendRtpItem); |
| | | } |
| | | |
| | | public SIPResponse sendStreamAck(MediaServer mediaServerItem, SIPRequest request, SendRtpItem sendRtpItem, ParentPlatform platform) { |
| | | public SIPResponse sendStreamAck(SIPRequest request, SendRtpItem sendRtpItem, ParentPlatform platform) { |
| | | |
| | | String sdpIp = sendRtpItem.getLocalIp(); |
| | | if (!ObjectUtils.isEmpty(platform.getSendStreamIp())) { |
| | |
| | | logger.info("设备{}请求语音流,地址:{}:{},ssrc:{}, {}", requesterId, addressStr, port, gb28181Sdp.getSsrc(), |
| | | mediaTransmissionTCP ? (tcpActive ? "TCP主动" : "TCP被动") : "UDP"); |
| | | |
| | | MediaServer mediaServerItem = broadcastCatch.getMediaServer(); |
| | | MediaServer mediaServerItem = broadcastCatch.getMediaServerItem(); |
| | | if (mediaServerItem == null) { |
| | | logger.warn("未找到语音喊话使用的zlm"); |
| | | try { |