16个文件已修改
1 文件已复制
3 文件已重命名
3个文件已删除
| | |
| | | |
| | | <groupId>com.genersoft</groupId> |
| | | <artifactId>wvp-pro</artifactId> |
| | | <version>2.7.0</version> |
| | | <version>2.7.1</version> |
| | | <name>web video platform</name> |
| | | <description>彿 28181è§é¢å¹³å°</description> |
| | | <packaging>${project.packaging}</packaging> |
| | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.genersoft.iot.vmp.conf.DynamicTask; |
| | | import com.genersoft.iot.vmp.conf.UserSetting; |
| | | import com.genersoft.iot.vmp.conf.exception.ControllerException; |
| | | import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException; |
| | | import com.genersoft.iot.vmp.gb28181.bean.AudioBroadcastCatch; |
| | | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| | | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| | | import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.sip.InvalidArgumentException; |
| | | import javax.sip.RequestEvent; |
| | | import javax.sip.SipException; |
| | | import javax.sip.address.SipURI; |
| | | import javax.sip.header.CallIdHeader; |
| | | import javax.sip.header.FromHeader; |
| | | import javax.sip.header.HeaderAddress; |
| | | import javax.sip.header.ToHeader; |
| | | import java.text.ParseException; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | |
| | | ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(fromUserId); |
| | | |
| | | if (parentPlatform != null) { |
| | | Map<String, Object> param = getSendRtpParam(sendRtpItem); |
| | | if (!userSetting.getServerId().equals(sendRtpItem.getServerId())) { |
| | | RequestPushStreamMsg requestPushStreamMsg = RequestPushStreamMsg.getInstance( |
| | | sendRtpItem.getMediaServerId(), sendRtpItem.getApp(), sendRtpItem.getStream(), |
| | | sendRtpItem.getIp(), sendRtpItem.getPort(), sendRtpItem.getSsrc(), sendRtpItem.isTcp(), |
| | | sendRtpItem.getLocalPort(), sendRtpItem.getPt(), sendRtpItem.isUsePs(), sendRtpItem.isOnlyAudio()); |
| | | redisGbPlayMsgListener.sendMsgForStartSendRtpStream(sendRtpItem.getServerId(), requestPushStreamMsg, json -> { |
| | | playService.startSendRtpStreamHand(sendRtpItem, parentPlatform, json, param, callIdHeader); |
| | | playService.startSendRtpStreamFailHand(sendRtpItem, parentPlatform, callIdHeader); |
| | | }); |
| | | } else { |
| | | JSONObject startSendRtpStreamResult = sendRtp(sendRtpItem, mediaInfo, param); |
| | | if (startSendRtpStreamResult != null) { |
| | | playService.startSendRtpStreamHand(sendRtpItem, parentPlatform, startSendRtpStreamResult, param, callIdHeader); |
| | | try { |
| | | if (sendRtpItem.isTcpActive()) { |
| | | mediaServerService.startSendRtpPassive(mediaInfo, parentPlatform, sendRtpItem, null); |
| | | } else { |
| | | mediaServerService.startSendRtpStream(mediaInfo, parentPlatform, sendRtpItem); |
| | | } |
| | | }catch (ControllerException e) { |
| | | logger.error("RTPæ¨æµå¤±è´¥: {}", e.getMessage()); |
| | | playService.startSendRtpStreamFailHand(sendRtpItem, parentPlatform, callIdHeader); |
| | | } |
| | | } |
| | | }else { |
| | |
| | | logger.warn("[æ¶å°ACK]ï¼æ¥èª{}ï¼ç®æ 为({})çæ¨æµä¿¡æ¯ä¸ºæ¾å°æµä½æå¡[{}]ä¿¡æ¯",fromUserId, toUserId, sendRtpItem.getMediaServerId()); |
| | | return; |
| | | } |
| | | Map<String, Object> param = getSendRtpParam(sendRtpItem); |
| | | JSONObject startSendRtpStreamResult = sendRtp(sendRtpItem, mediaInfo, param); |
| | | if (startSendRtpStreamResult != null) { |
| | | playService.startSendRtpStreamHand(sendRtpItem, device, startSendRtpStreamResult, param, callIdHeader); |
| | | try { |
| | | if (sendRtpItem.isTcpActive()) { |
| | | mediaServerService.startSendRtpPassive(mediaInfo, null, sendRtpItem, null); |
| | | } else { |
| | | mediaServerService.startSendRtpStream(mediaInfo, null, sendRtpItem); |
| | | } |
| | | }catch (ControllerException e) { |
| | | logger.error("RTPæ¨æµå¤±è´¥: {}", e.getMessage()); |
| | | playService.startSendRtpStreamFailHand(sendRtpItem, null, callIdHeader); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private Map<String, Object> getSendRtpParam(SendRtpItem sendRtpItem) { |
| | | String isUdp = sendRtpItem.isTcp() ? "0" : "1"; |
| | | Map<String, Object> param = new HashMap<>(12); |
| | | param.put("vhost","__defaultVhost__"); |
| | | param.put("app",sendRtpItem.getApp()); |
| | | param.put("stream",sendRtpItem.getStream()); |
| | | param.put("ssrc", sendRtpItem.getSsrc()); |
| | | param.put("dst_url",sendRtpItem.getIp()); |
| | | param.put("dst_port", sendRtpItem.getPort()); |
| | | param.put("src_port", sendRtpItem.getLocalPort()); |
| | | param.put("pt", sendRtpItem.getPt()); |
| | | param.put("use_ps", sendRtpItem.isUsePs() ? "1" : "0"); |
| | | param.put("only_audio", sendRtpItem.isOnlyAudio() ? "1" : "0"); |
| | | param.put("is_udp", isUdp); |
| | | if (!sendRtpItem.isTcp()) { |
| | | // udp模å¼ä¸å¼å¯rtcpä¿æ´» |
| | | param.put("udp_rtcp_timeout", sendRtpItem.isRtcp()? "1":"0"); |
| | | } |
| | | return param; |
| | | } |
| | | |
| | | private JSONObject sendRtp(SendRtpItem sendRtpItem, MediaServer mediaInfo, Map<String, Object> param){ |
| | | JSONObject startSendRtpStreamResult = null; |
| | | if (sendRtpItem.getLocalPort() != 0) { |
| | | if (sendRtpItem.isTcpActive()) { |
| | | startSendRtpStreamResult = zlmServerFactory.startSendRtpPassive(mediaInfo, param); |
| | | }else { |
| | | param.put("dst_url", sendRtpItem.getIp()); |
| | | param.put("dst_port", sendRtpItem.getPort()); |
| | | startSendRtpStreamResult = zlmServerFactory.startSendRtpStream(mediaInfo, param); |
| | | } |
| | | }else { |
| | | if (sendRtpItem.isTcpActive()) { |
| | | startSendRtpStreamResult = zlmServerFactory.startSendRtpPassive(mediaInfo, param); |
| | | }else { |
| | | param.put("dst_url", sendRtpItem.getIp()); |
| | | param.put("dst_port", sendRtpItem.getPort()); |
| | | startSendRtpStreamResult = zlmServerFactory.startSendRtpStream(mediaInfo, param); |
| | | } |
| | | } |
| | | return startSendRtpStreamResult; |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | CallIdHeader callIdHeader, MediaServer mediaServerItem, |
| | | int port, Boolean tcpActive, boolean mediaTransmissionTCP, |
| | | String channelId, String addressStr, String ssrc, String requesterId) { |
| | | Boolean streamReady = zlmServerFactory.isStreamReady(mediaServerItem, gbStream.getApp(), gbStream.getStream()); |
| | | Boolean streamReady = mediaServerService.isStreamReady(mediaServerItem, gbStream.getApp(), gbStream.getStream()); |
| | | if (streamReady != null && streamReady) { |
| | | // èªå¹³å°å
容 |
| | | SendRtpItem sendRtpItem = zlmServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId, |
| | |
| | | String channelId, String addressStr, String ssrc, String requesterId) { |
| | | // æ¨æµ |
| | | if (streamPushItem.isSelf()) { |
| | | Boolean streamReady = zlmServerFactory.isStreamReady(mediaServerItem, gbStream.getApp(), gbStream.getStream()); |
| | | Boolean streamReady = mediaServerService.isStreamReady(mediaServerItem, gbStream.getApp(), gbStream.getStream()); |
| | | if (streamReady != null && streamReady) { |
| | | // èªå¹³å°å
容 |
| | | SendRtpItem sendRtpItem = zlmServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId, |
| | |
| | | |
| | | redisCatchStorage.updateSendRTPSever(sendRtpItem); |
| | | |
| | | Boolean streamReady = zlmServerFactory.isStreamReady(mediaServerItem, broadcastCatch.getApp(), broadcastCatch.getStream()); |
| | | Boolean streamReady = mediaServerService.isStreamReady(mediaServerItem, broadcastCatch.getApp(), broadcastCatch.getStream()); |
| | | if (streamReady) { |
| | | sendOk(device, sendRtpItem, sdp, request, mediaServerItem, mediaTransmissionTCP, gb28181Sdp.getSsrc()); |
| | | } else { |
| | |
| | | |
| | | import com.genersoft.iot.vmp.common.CommonCallback; |
| | | import com.genersoft.iot.vmp.common.StreamInfo; |
| | | import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; |
| | | import com.genersoft.iot.vmp.media.bean.MediaInfo; |
| | | import com.genersoft.iot.vmp.media.bean.MediaServer; |
| | | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| | |
| | | Boolean delStreamProxy(MediaServer mediaServer, String streamKey); |
| | | |
| | | Map<String, String> getFFmpegCMDs(MediaServer mediaServer); |
| | | |
| | | void startSendRtpPassive(MediaServer mediaServer, SendRtpItem sendRtpItem, Integer timeout); |
| | | |
| | | void startSendRtpStream(MediaServer mediaServer, SendRtpItem sendRtpItem); |
| | | } |
| | |
| | | |
| | | import com.genersoft.iot.vmp.common.CommonCallback; |
| | | import com.genersoft.iot.vmp.common.StreamInfo; |
| | | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| | | import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; |
| | | import com.genersoft.iot.vmp.media.bean.MediaInfo; |
| | | import com.genersoft.iot.vmp.media.bean.MediaServer; |
| | | import com.genersoft.iot.vmp.service.bean.MediaServerLoad; |
| | |
| | | * @param stream |
| | | * @return |
| | | */ |
| | | StreamInfo getStreamInfoByAppAndStream(MediaServer mediaServerItem, String app, String stream, MediaInfo mediaInfo, String addr, String callId, boolean isPlay); |
| | | StreamInfo getStreamInfoByAppAndStream(MediaServer mediaServer, String app, String stream, MediaInfo mediaInfo, String addr, String callId, boolean isPlay); |
| | | |
| | | Boolean isStreamReady(MediaServer mediaServer, String rtp, String streamId); |
| | | |
| | | void startSendRtpPassive(MediaServer mediaServer, ParentPlatform platform, SendRtpItem sendRtpItem, Integer timeout); |
| | | |
| | | void startSendRtpStream(MediaServer mediaServer, ParentPlatform platform, SendRtpItem sendRtpItem); |
| | | } |
| | |
| | | import com.genersoft.iot.vmp.conf.MediaConfig; |
| | | import com.genersoft.iot.vmp.conf.UserSetting; |
| | | import com.genersoft.iot.vmp.conf.exception.ControllerException; |
| | | import com.genersoft.iot.vmp.gb28181.bean.InviteStreamType; |
| | | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| | | import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; |
| | | import com.genersoft.iot.vmp.gb28181.session.SSRCFactory; |
| | | import com.genersoft.iot.vmp.media.bean.MediaInfo; |
| | | import com.genersoft.iot.vmp.media.event.media.MediaArrivalEvent; |
| | |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo; |
| | | import com.genersoft.iot.vmp.service.IInviteStreamService; |
| | | import com.genersoft.iot.vmp.service.bean.MediaServerLoad; |
| | | import com.genersoft.iot.vmp.service.bean.MessageForPushChannel; |
| | | import com.genersoft.iot.vmp.service.bean.SSRCInfo; |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.storager.dao.MediaServerMapper; |
| | |
| | | streamInfoResult.setMediaInfo(mediaInfo); |
| | | return streamInfoResult; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean isStreamReady(MediaServer mediaServer, String rtp, String streamId) { |
| | | IMediaNodeServerService mediaNodeServerService = nodeServerServiceMap.get(mediaServer.getType()); |
| | | if (mediaNodeServerService == null) { |
| | | logger.info("[isStreamReady] 失败, mediaServerçç±»åï¼ {}ï¼æªæ¾å°å¯¹åºçå®ç°ç±»", mediaServer.getType()); |
| | | return false; |
| | | } |
| | | MediaInfo mediaInfo = mediaNodeServerService.getMediaInfo(mediaServer, rtp, streamId); |
| | | return mediaInfo != null; |
| | | } |
| | | |
| | | @Override |
| | | public void startSendRtpPassive(MediaServer mediaServer, ParentPlatform platform, SendRtpItem sendRtpItem, Integer timeout) { |
| | | IMediaNodeServerService mediaNodeServerService = nodeServerServiceMap.get(mediaServer.getType()); |
| | | if (mediaNodeServerService == null) { |
| | | logger.info("[startSendRtpPassive] 失败, mediaServerçç±»åï¼ {}ï¼æªæ¾å°å¯¹åºçå®ç°ç±»", mediaServer.getType()); |
| | | throw new ControllerException(ErrorCode.ERROR100.getCode(), "æªæ¾å°mediaServer对åºçå®ç°ç±»"); |
| | | } |
| | | mediaNodeServerService.startSendRtpPassive(mediaServer, sendRtpItem, timeout); |
| | | sendPlatformStartPlayMsg(platform, sendRtpItem); |
| | | } |
| | | |
| | | @Override |
| | | public void startSendRtpStream(MediaServer mediaServer, ParentPlatform platform, SendRtpItem sendRtpItem) { |
| | | IMediaNodeServerService mediaNodeServerService = nodeServerServiceMap.get(mediaServer.getType()); |
| | | if (mediaNodeServerService == null) { |
| | | logger.info("[startSendRtpStream] 失败, mediaServerçç±»åï¼ {}ï¼æªæ¾å°å¯¹åºçå®ç°ç±»", mediaServer.getType()); |
| | | throw new ControllerException(ErrorCode.ERROR100.getCode(), "æªæ¾å°mediaServer对åºçå®ç°ç±»"); |
| | | } |
| | | logger.info("[å¼å§æ¨æµ] rtp/{}, ç®æ ={}:{}ï¼SSRC={}, RTCP={}", sendRtpItem.getStream(), |
| | | sendRtpItem.getIp(), sendRtpItem.getPort(), sendRtpItem.getSsrc(), sendRtpItem.isRtcp()); |
| | | mediaNodeServerService.startSendRtpStream(mediaServer, sendRtpItem); |
| | | sendPlatformStartPlayMsg(platform, sendRtpItem); |
| | | |
| | | } |
| | | |
| | | private void sendPlatformStartPlayMsg(ParentPlatform platform, SendRtpItem sendRtpItem) { |
| | | if (sendRtpItem.getPlayType() == InviteStreamType.PUSH && platform != null) { |
| | | MessageForPushChannel messageForPushChannel = MessageForPushChannel.getInstance(0, sendRtpItem.getApp(), sendRtpItem.getStream(), |
| | | sendRtpItem.getChannelId(), platform.getServerGBId(), platform.getName(), userSetting.getServerId(), |
| | | sendRtpItem.getMediaServerId()); |
| | | messageForPushChannel.setPlatFormIndex(platform.getId()); |
| | | redisCatchStorage.sendPlatformStartPlayMsg(messageForPushChannel); |
| | | } |
| | | } |
| | | } |
| | |
| | | public void sendStreamEvent(String app, String stream, String mediaServerId) { |
| | | MediaServer mediaServerItem = mediaServerService.getOne(mediaServerId); |
| | | // æ¥çæ¨æµç¶æ |
| | | Boolean streamReady = zlmServerFactory.isStreamReady(mediaServerItem, app, stream); |
| | | Boolean streamReady = mediaServerService.isStreamReady(mediaServerItem, app, stream); |
| | | if (streamReady != null && streamReady) { |
| | | ChannelOnlineEvent channelOnlineEventLister = getChannelOnlineEventLister(app, stream); |
| | | if (channelOnlineEventLister != null) { |
| | |
| | | import com.genersoft.iot.vmp.common.CommonCallback; |
| | | import com.genersoft.iot.vmp.common.StreamInfo; |
| | | import com.genersoft.iot.vmp.conf.exception.ControllerException; |
| | | import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; |
| | | import com.genersoft.iot.vmp.media.bean.MediaInfo; |
| | | import com.genersoft.iot.vmp.media.service.IMediaNodeServerService; |
| | | import com.genersoft.iot.vmp.media.bean.MediaServer; |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public void startSendRtpPassive(MediaServer mediaServer, SendRtpItem sendRtpItem, Integer timeout) { |
| | | Map<String, Object> param = new HashMap<>(12); |
| | | param.put("vhost","__defaultVhost__"); |
| | | param.put("app", sendRtpItem.getApp()); |
| | | param.put("stream", sendRtpItem.getStream()); |
| | | param.put("ssrc", sendRtpItem.getSsrc()); |
| | | param.put("src_port", sendRtpItem.getLocalPort()); |
| | | param.put("pt", sendRtpItem.getPt()); |
| | | param.put("use_ps", sendRtpItem.isUsePs() ? "1" : "0"); |
| | | param.put("only_audio", sendRtpItem.isOnlyAudio() ? "1" : "0"); |
| | | param.put("is_udp", sendRtpItem.isTcp() ? "0" : "1"); |
| | | param.put("recv_stream_id", sendRtpItem.getReceiveStream()); |
| | | if (timeout != null) { |
| | | param.put("close_delay_ms", timeout); |
| | | } |
| | | |
| | | JSONObject jsonObject = zlmServerFactory.startSendRtpPassive(mediaServer, param, null); |
| | | if (jsonObject == null || jsonObject.getInteger("code") != 0 ) { |
| | | throw new ControllerException(jsonObject.getInteger("code"), jsonObject.getString("msg")); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void startSendRtpStream(MediaServer mediaServer, SendRtpItem sendRtpItem) { |
| | | Map<String, Object> param = new HashMap<>(12); |
| | | param.put("vhost", "__defaultVhost__"); |
| | | param.put("app", sendRtpItem.getApp()); |
| | | param.put("stream", sendRtpItem.getStream()); |
| | | param.put("ssrc", sendRtpItem.getSsrc()); |
| | | param.put("src_port", sendRtpItem.getLocalPort()); |
| | | param.put("pt", sendRtpItem.getPt()); |
| | | param.put("use_ps", sendRtpItem.isUsePs() ? "1" : "0"); |
| | | param.put("only_audio", sendRtpItem.isOnlyAudio() ? "1" : "0"); |
| | | param.put("is_udp", sendRtpItem.isTcp() ? "0" : "1"); |
| | | if (!sendRtpItem.isTcp()) { |
| | | // udp模å¼ä¸å¼å¯rtcpä¿æ´» |
| | | param.put("udp_rtcp_timeout", sendRtpItem.isRtcp() ? "1" : "0"); |
| | | } |
| | | param.put("dst_url", sendRtpItem.getIp()); |
| | | param.put("dst_port", sendRtpItem.getPort()); |
| | | JSONObject jsonObject = zlmServerFactory.startSendRtpStream(mediaServer, param); |
| | | if (jsonObject == null || jsonObject.getInteger("code") != 0 ) { |
| | | throw new ControllerException(jsonObject.getInteger("code"), jsonObject.getString("msg")); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | void startPushStream(SendRtpItem sendRtpItem, SIPResponse sipResponse, ParentPlatform platform, CallIdHeader callIdHeader); |
| | | |
| | | void startSendRtpStreamHand(SendRtpItem sendRtpItem, Object correlationInfo, |
| | | JSONObject jsonObject, Map<String, Object> param, CallIdHeader callIdHeader); |
| | | void startSendRtpStreamFailHand(SendRtpItem sendRtpItem,ParentPlatform platform, CallIdHeader callIdHeader); |
| | | |
| | | void talkCmd(Device device, String channelId, MediaServer mediaServerItem, String stream, AudioBroadcastEvent event); |
| | | |
| | |
| | | // 妿zlmä¸åå¨è¿ä¸ªæµï¼åå 餿°æ®å³å¯ |
| | | MediaServer mediaServerItemForStreamInfo = mediaServerService.getOne(inviteInfoForOld.getStreamInfo().getMediaServerId()); |
| | | if (mediaServerItemForStreamInfo != null) { |
| | | Boolean ready = zlmServerFactory.isStreamReady(mediaServerItemForStreamInfo, inviteInfoForOld.getStreamInfo().getApp(), inviteInfoForOld.getStreamInfo().getStream()); |
| | | Boolean ready = mediaServerService.isStreamReady(mediaServerItemForStreamInfo, inviteInfoForOld.getStreamInfo().getApp(), inviteInfoForOld.getStreamInfo().getStream()); |
| | | if (!ready) { |
| | | // é误åå¨äºredisä¸çæ°æ® |
| | | inviteStreamService.removeInviteInfo(inviteInfoForOld); |
| | |
| | | private IRedisCatchStorage redisCatchStorage; |
| | | |
| | | @Autowired |
| | | private ZLMServerFactory zlmServerFactory; |
| | | |
| | | @Autowired |
| | | private IInviteStreamService inviteStreamService; |
| | | |
| | | @Autowired |
| | |
| | | } |
| | | String mediaServerId = streamInfo.getMediaServerId(); |
| | | MediaServer mediaInfo = mediaServerService.getOne(mediaServerId); |
| | | |
| | | Boolean ready = zlmServerFactory.isStreamReady(mediaInfo, "rtp", streamId); |
| | | Boolean ready = mediaServerService.isStreamReady(mediaInfo, "rtp", streamId); |
| | | if (ready != null && ready) { |
| | | callback.run(InviteErrorCode.SUCCESS.getCode(), InviteErrorCode.SUCCESS.getMsg(), streamInfo); |
| | | inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channelId, null, |
| | |
| | | } |
| | | }, userSetting.getPlayTimeout()); |
| | | |
| | | Map<String, Object> param = new HashMap<>(12); |
| | | param.put("vhost","__defaultVhost__"); |
| | | param.put("app", sendRtpItem.getApp()); |
| | | param.put("stream", sendRtpItem.getStream()); |
| | | param.put("ssrc", sendRtpItem.getSsrc()); |
| | | param.put("src_port", sendRtpItem.getLocalPort()); |
| | | param.put("pt", sendRtpItem.getPt()); |
| | | param.put("use_ps", sendRtpItem.isUsePs() ? "1" : "0"); |
| | | param.put("only_audio", sendRtpItem.isOnlyAudio() ? "1" : "0"); |
| | | param.put("is_udp", sendRtpItem.isTcp() ? "0" : "1"); |
| | | param.put("recv_stream_id", sendRtpItem.getReceiveStream()); |
| | | param.put("close_delay_ms", userSetting.getPlayTimeout() * 1000); |
| | | |
| | | zlmServerFactory.startSendRtpPassive(mediaServerItem, param, jsonObject -> { |
| | | if (jsonObject == null || jsonObject.getInteger("code") != 0 ) { |
| | | mediaServerService.releaseSsrc(mediaServerItem.getId(), sendRtpItem.getSsrc()); |
| | | logger.info("[è¯é³å¯¹è®²]失败 deviceId: {}, channelId: {}", device.getDeviceId(), channelId); |
| | | audioEvent.call("失败, " + jsonObject.getString("msg")); |
| | | // æ¥çæ¯å¦å·²ç»å»ºç«äºééï¼åå¨ååébye |
| | | stopTalk(device, channelId); |
| | | } |
| | | }); |
| | | try { |
| | | mediaServerService.startSendRtpPassive(mediaServerItem, null, sendRtpItem, userSetting.getPlayTimeout() * 1000); |
| | | }catch (ControllerException e) { |
| | | mediaServerService.releaseSsrc(mediaServerItem.getId(), sendRtpItem.getSsrc()); |
| | | logger.info("[è¯é³å¯¹è®²]失败 deviceId: {}, channelId: {}", device.getDeviceId(), channelId); |
| | | audioEvent.call("失败, " + e.getMessage()); |
| | | // æ¥çæ¯å¦å·²ç»å»ºç«äºééï¼åå¨ååébye |
| | | stopTalk(device, channelId); |
| | | } |
| | | |
| | | |
| | | // æ¥çè®¾å¤æ¯å¦å·²ç»å¨æ¨æµ |
| | |
| | | SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(device.getDeviceId(), channelId, null, null); |
| | | if (sendRtpItem != null && sendRtpItem.isOnlyAudio()) { |
| | | // æ¥è¯¢æµæ¯å¦åå¨ï¼ä¸åå¨å认为æ¯å¼å¸¸ç¶æ |
| | | Boolean streamReady = zlmServerFactory.isStreamReady(mediaServerItem, sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | Boolean streamReady = mediaServerService.isStreamReady(mediaServerItem, sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | if (streamReady) { |
| | | logger.warn("è¯é³å¹¿æå·²ç»å¼å¯ï¼ {}", channelId); |
| | | event.call("è¯é³å¹¿æå·²ç»å¼å¯"); |
| | |
| | | } |
| | | } |
| | | } |
| | | // SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(device.getDeviceId(), channelId, null, null); |
| | | // if (sendRtpItem != null) { |
| | | // MediaServerItem mediaServer = mediaServerService.getOne(sendRtpItem.getMediaServerId()); |
| | | // Boolean streamReady = zlmServerFactory.isStreamReady(mediaServer, sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | // if (streamReady) { |
| | | // logger.warn("[è¯é³å¯¹è®²] è¿è¡ä¸ï¼ {}", channelId); |
| | | // event.call("è¯é³å¯¹è®²è¿è¡ä¸"); |
| | | // return false; |
| | | // } else { |
| | | // stopTalk(device, channelId); |
| | | // } |
| | | // } |
| | | |
| | | // åééç¥ |
| | | cmder.audioBroadcastCmd(device, channelId, eventResultForOk -> { |
| | |
| | | if (sendRtpItem != null && sendRtpItem.isOnlyAudio()) { |
| | | // æ¥è¯¢æµæ¯å¦åå¨ï¼ä¸åå¨å认为æ¯å¼å¸¸ç¶æ |
| | | MediaServer mediaServerServiceOne = mediaServerService.getOne(sendRtpItem.getMediaServerId()); |
| | | Boolean streamReady = zlmServerFactory.isStreamReady(mediaServerServiceOne, sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | Boolean streamReady = mediaServerService.isStreamReady(mediaServerServiceOne, sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | if (streamReady) { |
| | | logger.warn("è¯é³å¹¿æéé使ç¨ä¸ï¼ {}", channelId); |
| | | return true; |
| | |
| | | @Override |
| | | public void startPushStream(SendRtpItem sendRtpItem, SIPResponse sipResponse, ParentPlatform platform, CallIdHeader callIdHeader) { |
| | | // å¼å§åæµ |
| | | String is_Udp = sendRtpItem.isTcp() ? "0" : "1"; |
| | | MediaServer mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); |
| | | logger.info("[å¼å§æ¨æµ] rtp/{}, ç®æ ={}:{}ï¼SSRC={}, RTCP={}", sendRtpItem.getStream(), |
| | | sendRtpItem.getIp(), sendRtpItem.getPort(), sendRtpItem.getSsrc(), sendRtpItem.isRtcp()); |
| | | Map<String, Object> param = new HashMap<>(12); |
| | | param.put("vhost", "__defaultVhost__"); |
| | | param.put("app", sendRtpItem.getApp()); |
| | | param.put("stream", sendRtpItem.getStream()); |
| | | param.put("ssrc", sendRtpItem.getSsrc()); |
| | | param.put("src_port", sendRtpItem.getLocalPort()); |
| | | param.put("pt", sendRtpItem.getPt()); |
| | | param.put("use_ps", sendRtpItem.isUsePs() ? "1" : "0"); |
| | | param.put("only_audio", sendRtpItem.isOnlyAudio() ? "1" : "0"); |
| | | param.put("is_udp", is_Udp); |
| | | if (!sendRtpItem.isTcp()) { |
| | | // udp模å¼ä¸å¼å¯rtcpä¿æ´» |
| | | param.put("udp_rtcp_timeout", sendRtpItem.isRtcp() ? "1" : "0"); |
| | | } |
| | | |
| | | if (mediaInfo == null) { |
| | | RequestPushStreamMsg requestPushStreamMsg = RequestPushStreamMsg.getInstance( |
| | |
| | | sendRtpItem.getIp(), sendRtpItem.getPort(), sendRtpItem.getSsrc(), sendRtpItem.isTcp(), |
| | | sendRtpItem.getLocalPort(), sendRtpItem.getPt(), sendRtpItem.isUsePs(), sendRtpItem.isOnlyAudio()); |
| | | redisGbPlayMsgListener.sendMsgForStartSendRtpStream(sendRtpItem.getServerId(), requestPushStreamMsg, json -> { |
| | | startSendRtpStreamHand(sendRtpItem, platform, json, param, callIdHeader); |
| | | startSendRtpStreamFailHand(sendRtpItem, platform, callIdHeader); |
| | | }); |
| | | } else { |
| | | // 妿æ¯ä¸¥æ ¼æ¨¡å¼ï¼éè¦å
³é端å£å ç¨ |
| | | JSONObject startSendRtpStreamResult = null; |
| | | if (sendRtpItem.getLocalPort() != 0) { |
| | | try { |
| | | if (sendRtpItem.isTcpActive()) { |
| | | startSendRtpStreamResult = zlmServerFactory.startSendRtpPassive(mediaInfo, param); |
| | | mediaServerService.startSendRtpPassive(mediaInfo, platform, sendRtpItem, null); |
| | | } else { |
| | | param.put("dst_url", sendRtpItem.getIp()); |
| | | param.put("dst_port", sendRtpItem.getPort()); |
| | | startSendRtpStreamResult = zlmServerFactory.startSendRtpStream(mediaInfo, param); |
| | | mediaServerService.startSendRtpStream(mediaInfo, platform, sendRtpItem); |
| | | } |
| | | } else { |
| | | if (sendRtpItem.isTcpActive()) { |
| | | startSendRtpStreamResult = zlmServerFactory.startSendRtpPassive(mediaInfo, param); |
| | | } else { |
| | | param.put("dst_url", sendRtpItem.getIp()); |
| | | param.put("dst_port", sendRtpItem.getPort()); |
| | | startSendRtpStreamResult = zlmServerFactory.startSendRtpStream(mediaInfo, param); |
| | | } |
| | | }catch (ControllerException e) { |
| | | logger.error("RTPæ¨æµå¤±è´¥: {}", e.getMessage()); |
| | | startSendRtpStreamFailHand(sendRtpItem, platform, callIdHeader); |
| | | return; |
| | | } |
| | | if (startSendRtpStreamResult != null) { |
| | | startSendRtpStreamHand(sendRtpItem, platform, startSendRtpStreamResult, param, callIdHeader); |
| | | } |
| | | |
| | | logger.info("RTPæ¨æµæå[ {}/{} ]ï¼{}, ", sendRtpItem.getApp(), sendRtpItem.getStream(), |
| | | sendRtpItem.isTcpActive()?"被å¨åæµ": sendRtpItem.getIp() + ":" + sendRtpItem.getPort()); |
| | | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void startSendRtpStreamHand(SendRtpItem sendRtpItem, Object correlationInfo, |
| | | JSONObject jsonObject, Map<String, Object> param, CallIdHeader callIdHeader) { |
| | | if (jsonObject == null) { |
| | | logger.error("RTPæ¨æµå¤±è´¥: è¯·æ£æ¥ZLMæå¡"); |
| | | } else if (jsonObject.getInteger("code") == 0) { |
| | | logger.info("è°ç¨ZLMæ¨æµæ¥å£, ç»æï¼ {}", jsonObject); |
| | | logger.info("RTPæ¨æµæå[ {}/{} ]ï¼{}->{}, ", param.get("app"), param.get("stream"), jsonObject.getString("local_port"), |
| | | sendRtpItem.isTcpActive()?"被å¨åæµ": param.get("dst_url") + ":" + param.get("dst_port")); |
| | | if (sendRtpItem.getPlayType() == InviteStreamType.PUSH && correlationInfo instanceof ParentPlatform) { |
| | | ParentPlatform platform = (ParentPlatform)correlationInfo; |
| | | MessageForPushChannel messageForPushChannel = MessageForPushChannel.getInstance(0, sendRtpItem.getApp(), sendRtpItem.getStream(), |
| | | sendRtpItem.getChannelId(), platform.getServerGBId(), platform.getName(), userSetting.getServerId(), |
| | | sendRtpItem.getMediaServerId()); |
| | | messageForPushChannel.setPlatFormIndex(platform.getId()); |
| | | redisCatchStorage.sendPlatformStartPlayMsg(messageForPushChannel); |
| | | public void startSendRtpStreamFailHand(SendRtpItem sendRtpItem, ParentPlatform platform, CallIdHeader callIdHeader) { |
| | | if (sendRtpItem.isOnlyAudio()) { |
| | | Device device = deviceService.getDevice(sendRtpItem.getDeviceId()); |
| | | AudioBroadcastCatch audioBroadcastCatch = audioBroadcastManager.get(sendRtpItem.getDeviceId(), sendRtpItem.getChannelId()); |
| | | if (audioBroadcastCatch != null) { |
| | | try { |
| | | cmder.streamByeCmd(device, sendRtpItem.getChannelId(), audioBroadcastCatch.getSipTransactionInfo(), null); |
| | | } catch (SipException | ParseException | InvalidArgumentException | |
| | | SsrcTransactionNotFoundException exception) { |
| | | logger.error("[å½ä»¤åé失败] 忢è¯é³å¯¹è®²: {}", exception.getMessage()); |
| | | } |
| | | } |
| | | } else { |
| | | logger.error("RTPæ¨æµå¤±è´¥: {}, åæ°ï¼{}", jsonObject.getString("msg"), JSONObject.toJSONString(param)); |
| | | if (sendRtpItem.isOnlyAudio()) { |
| | | Device device = deviceService.getDevice(sendRtpItem.getDeviceId()); |
| | | AudioBroadcastCatch audioBroadcastCatch = audioBroadcastManager.get(sendRtpItem.getDeviceId(), sendRtpItem.getChannelId()); |
| | | if (audioBroadcastCatch != null) { |
| | | try { |
| | | cmder.streamByeCmd(device, sendRtpItem.getChannelId(), audioBroadcastCatch.getSipTransactionInfo(), null); |
| | | } catch (SipException | ParseException | InvalidArgumentException | |
| | | SsrcTransactionNotFoundException e) { |
| | | logger.error("[å½ä»¤åé失败] 忢è¯é³å¯¹è®²: {}", e.getMessage()); |
| | | } |
| | | } |
| | | } else { |
| | | if (platform != null) { |
| | | // åä¸çº§å¹³å° |
| | | if (correlationInfo instanceof ParentPlatform) { |
| | | try { |
| | | ParentPlatform parentPlatform = (ParentPlatform)correlationInfo; |
| | | commanderForPlatform.streamByeCmd(parentPlatform, callIdHeader.getCallId()); |
| | | } catch (SipException | InvalidArgumentException | ParseException e) { |
| | | logger.error("[å½ä»¤åé失败] 彿 级è åéBYE: {}", e.getMessage()); |
| | | } |
| | | try { |
| | | commanderForPlatform.streamByeCmd(platform, callIdHeader.getCallId()); |
| | | } catch (SipException | InvalidArgumentException | ParseException e) { |
| | | logger.error("[å½ä»¤åé失败] 彿 级è åéBYE: {}", e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | if (sendRtpItem != null && sendRtpItem.isOnlyAudio()) { |
| | | // æ¥è¯¢æµæ¯å¦åå¨ï¼ä¸åå¨å认为æ¯å¼å¸¸ç¶æ |
| | | MediaServer mediaServer = mediaServerService.getOne(sendRtpItem.getMediaServerId()); |
| | | Boolean streamReady = zlmServerFactory.isStreamReady(mediaServer, sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | Boolean streamReady = mediaServerService.isStreamReady(mediaServer, sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | if (streamReady) { |
| | | logger.warn("[è¯é³å¯¹è®²] æ£å¨è¯é³å¹¿æï¼æ æ³å¼å¯è¯é³éè¯ï¼ {}", channelId); |
| | | event.call("æ£å¨è¯é³å¹¿æ"); |
| | |
| | | SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(device.getDeviceId(), channelId, stream, null); |
| | | if (sendRtpItem != null) { |
| | | MediaServer mediaServer = mediaServerService.getOne(sendRtpItem.getMediaServerId()); |
| | | Boolean streamReady = zlmServerFactory.isStreamReady(mediaServer, "rtp", sendRtpItem.getReceiveStream()); |
| | | Boolean streamReady = mediaServerService.isStreamReady(mediaServer, "rtp", sendRtpItem.getReceiveStream()); |
| | | if (streamReady) { |
| | | logger.warn("[è¯é³å¯¹è®²] è¿è¡ä¸ï¼ {}", channelId); |
| | | event.call("è¯é³å¯¹è®²è¿è¡ä¸"); |
| | |
| | | MediaServer mediaServer = mediaServerService.getOne(mediaServerId); |
| | | |
| | | if (streamIsReady == null || streamIsReady) { |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("vhost", "__defaultVhost__"); |
| | | param.put("app", sendRtpItem.getApp()); |
| | | param.put("stream", sendRtpItem.getStream()); |
| | | param.put("ssrc", sendRtpItem.getSsrc()); |
| | | zlmServerFactory.stopSendRtpStream(mediaServer, param); |
| | | mediaServerService.stopSendRtp(mediaServer, sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getSsrc()); |
| | | } |
| | | |
| | | ssrcFactory.releaseSsrc(mediaServerId, sendRtpItem.getSsrc()); |
| | |
| | | if (mediaServer == null) { |
| | | return null; |
| | | } |
| | | if (zlmServerFactory.isStreamReady(mediaServer, param.getApp(), param.getStream())) { |
| | | if (mediaServerService.isStreamReady(mediaServer, param.getApp(), param.getStream())) { |
| | | mediaServerService.closeStreams(mediaServer, param.getApp(), param.getStream()); |
| | | } |
| | | String msgResult; |
| | |
| | | return; |
| | | } |
| | | // ç¡®å®æµæ¯å¦å¨çº¿ |
| | | Boolean streamReady = zlmServerFactory.isStreamReady(mediaServerItem, content.getApp(), content.getStream()); |
| | | Boolean streamReady = mediaServerService.isStreamReady(mediaServerItem, content.getApp(), content.getStream()); |
| | | if (streamReady != null && streamReady) { |
| | | logger.info("[å夿¨æµä¿¡æ¯] {}/{}", content.getApp(), content.getStream()); |
| | | responseSendItem(mediaServerItem, content, toId, serial); |
| | |
| | | param.put("src_port", sendInfo.getSendLocalPort()); |
| | | |
| | | |
| | | Boolean streamReady = zlmServerFactory.isStreamReady(mediaServerItem, app, stream); |
| | | Boolean streamReady = mediaServerService.isStreamReady(mediaServerItem, app, stream); |
| | | if (streamReady) { |
| | | JSONObject jsonObject = zlmServerFactory.startSendRtpStream(mediaServerItem, param); |
| | | if (jsonObject.getInteger("code") == 0) { |
| | |
| | | paramForVideo = null; |
| | | } |
| | | |
| | | Boolean streamReady = zlmServerFactory.isStreamReady(mediaServer, app, stream); |
| | | Boolean streamReady = mediaServerService.isStreamReady(mediaServer, app, stream); |
| | | if (streamReady) { |
| | | if (paramForVideo != null) { |
| | | JSONObject jsonObject = zlmServerFactory.startSendRtpStream(mediaServer, paramForVideo); |
| | |
| | | application: |
| | | name: wvp |
| | | profiles: |
| | | active: local |
| | | active: abl |
File was renamed from Êý¾Ý¿â/abl/³õʼ»¯-mysql-2.7.0.sql |
| | |
| | | update_time character varying(50), |
| | | as_message_channel bool default false, |
| | | auto_push_channel bool default false, |
| | | send_stream_ip character varying(50), |
| | | constraint uk_platform_unique_server_gb_id unique (server_gb_id) |
| | | ); |
| | | |
File was renamed from Êý¾Ý¿â/abl/³õʼ»¯-postgresql-kingbase-2.7.0.sql |
| | |
| | | update_time character varying(50), |
| | | as_message_channel bool default false, |
| | | auto_push_channel bool default false, |
| | | send_stream_ip character varying(50), |
| | | constraint uk_platform_unique_server_gb_id unique (server_gb_id) |
| | | ); |
| | | |
copy from "\346\225\260\346\215\256\345\272\223/abl/\346\233\264\346\226\260-postgresql-kingbase-2.7.0.sql"
copy to "\346\225\260\346\215\256\345\272\223/2.7.1/\346\233\264\346\226\260-mysql-2.7.0.sql"