| | |
| | | private double latitude; |
| | | |
| | | /** |
| | | * 经度 |
| | | */ |
| | | @Schema(description = "自定义经度") |
| | | private double customLongitude; |
| | | |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | @Schema(description = "自定义纬度") |
| | | private double customLatitude; |
| | | |
| | | /** |
| | | * 经度 GCJ02 |
| | | */ |
| | | @Schema(description = "GCJ02坐标系经度") |
| | |
| | | public void setStreamIdentification(String streamIdentification) { |
| | | this.streamIdentification = streamIdentification; |
| | | } |
| | | |
| | | public double getCustomLongitude() { |
| | | return customLongitude; |
| | | } |
| | | |
| | | public void setCustomLongitude(double customLongitude) { |
| | | this.customLongitude = customLongitude; |
| | | } |
| | | |
| | | public double getCustomLatitude() { |
| | | return customLatitude; |
| | | } |
| | | |
| | | public void setCustomLatitude(double customLatitude) { |
| | | this.customLatitude = customLatitude; |
| | | } |
| | | } |
| | |
| | | if (parentPlatform != null) { |
| | | Map<String, Object> param = getSendRtpParam(sendRtpItem); |
| | | if (!userSetting.getServerId().equals(sendRtpItem.getServerId())) { |
| | | // redisCatchStorage.sendStartSendRtp(sendRtpItem); |
| | | WVPResult wvpResult = redisRpcService.startSendRtp(sendRtpItem); |
| | | if (wvpResult.getCode() == 0) { |
| | | MessageForPushChannel messageForPushChannel = MessageForPushChannel.getInstance(0, sendRtpItem.getApp(), sendRtpItem.getStream(), |
| | |
| | | redisCatchStorage.sendPlatformStopPlayMsg(sendRtpItem, platform); |
| | | if (!userSetting.getServerId().equals(sendRtpItem.getServerId())) { |
| | | redisRpcService.stopSendRtp(sendRtpItem); |
| | | redisCatchStorage.deleteSendRTPServer(null, null, sendRtpItem.getCallId(), null); |
| | | }else { |
| | | MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); |
| | | redisCatchStorage.deleteSendRTPServer(sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(), |
| | | callIdHeader.getCallId(), null); |
| | | redisCatchStorage.deleteSendRTPServer(null, null, callIdHeader.getCallId(), null); |
| | | zlmServerFactory.stopSendRtpStream(mediaInfo, param); |
| | | if (userSetting.getUseCustomSsrcForParentInvite()) { |
| | | mediaServerService.releaseSsrc(mediaInfo.getId(), sendRtpItem.getSsrc()); |
| | |
| | | redisRpcService.waitePushStreamOnline(sendRtpItem, (sendRtpItemFromRedis) -> { |
| | | dynamicTask.stop(sendRtpItem.getCallId()); |
| | | if (sendRtpItemFromRedis.getServerId().equals(userSetting.getServerId())) { |
| | | |
| | | logger.info("[级联点播] 等待的推流在本平台上线 {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | int localPort = sendRtpPortManager.getNextPort(mediaServerItem); |
| | | if (localPort == 0) { |
| | | logger.warn("上级点时创建sendRTPItem失败,可能是服务器端口资源不足"); |
| | |
| | | * 来自其他wvp的推流 |
| | | */ |
| | | private void otherWvpPushStream(SendRtpItem sendRtpItem, SIPRequest request, ParentPlatform platform) { |
| | | logger.info("[级联点播]直播流来自其他平台,发送redis消息"); |
| | | logger.info("[级联点播] 来自其他wvp的推流 {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | sendRtpItem = redisRpcService.getSendRtpItem(sendRtpItem); |
| | | // 写入redis, 超时时回复 |
| | | sendRtpItem.setStatus(1); |
| | |
| | | logger.warn("[mobilePosition移动位置Notify] 未找到通道{}所属的设备", channelId); |
| | | return; |
| | | } |
| | | // 兼容设备部分设备上报是通道编号与设备编号一致的情况 |
| | | if(deviceId.equals(channelId)) { |
| | | List<DeviceChannel> deviceChannels = deviceChannelService.queryChaneListByDeviceId(deviceId); |
| | | if (deviceChannels.size() == 1) { |
| | | channelId = deviceChannels.get(0).getChannelId(); |
| | | } |
| | | } |
| | | if (!ObjectUtils.isEmpty(device.getName())) { |
| | | mobilePosition.setDeviceName(device.getName()); |
| | | } |
| | |
| | | */ |
| | | public RedisRpcResponse getSendRtpItem(RedisRpcRequest request) { |
| | | SendRtpItem sendRtpItem = JSON.parseObject(request.getParam().toString(), SendRtpItem.class); |
| | | logger.info("[redis-rpc] 获取发流的信息: {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream() ); |
| | | logger.info("[redis-rpc] 获取发流的信息: {}/{}, 目标地址: {}:{}", sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort()); |
| | | // 查询本级是否有这个流 |
| | | MediaServerItem mediaServerItem = mediaServerService.getMediaServerByAppAndStream(sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | if (mediaServerItem == null) { |
| | |
| | | */ |
| | | public RedisRpcResponse waitePushStreamOnline(RedisRpcRequest request) { |
| | | SendRtpItem sendRtpItem = JSON.parseObject(request.getParam().toString(), SendRtpItem.class); |
| | | logger.info("[redis-rpc] 监听流上线: {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream() ); |
| | | logger.info("[redis-rpc] 监听流上线: {}/{}, 目标地址: {}:{}", sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort()); |
| | | // 查询本级是否有这个流 |
| | | MediaServerItem mediaServerItem = mediaServerService.getMediaServerByAppAndStream(sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | if (mediaServerItem != null) { |
| | | logger.info("[redis-rpc] 监听流上线时发现流已存在直接返回: {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream() ); |
| | | logger.info("[redis-rpc] 监听流上线时发现流已存在直接返回: {}/{}, 目标地址: {}:{}", sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort() ); |
| | | RedisRpcResponse response = request.getResponse(); |
| | | response.setBody(sendRtpItem); |
| | | response.setStatusCode(200); |
| | |
| | | sendRtpItem.getApp(), sendRtpItem.getStream(), true, "rtsp", null); |
| | | |
| | | hookSubscribe.addSubscribe(hook, (MediaServerItem mediaServerItemInUse, HookParam hookParam) -> { |
| | | logger.info("[redis-rpc] 监听流上线,流已上线: {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream() ); |
| | | logger.info("[redis-rpc] 监听流上线,流已上线: {}/{}, 目标地址: {}:{}", sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort()); |
| | | // 读取redis中的上级点播信息,生成sendRtpItm发送出去 |
| | | if (sendRtpItem.getSsrc() == null) { |
| | | // 上级平台点播时不使用上级平台指定的ssrc,使用自定义的ssrc,参考国标文档-点播外域设备媒体流SSRC处理方式 |
| | |
| | | sendRtpItem.setMediaServerId(mediaServerItemInUse.getId()); |
| | | sendRtpItem.setLocalIp(mediaServerItemInUse.getSdpIp()); |
| | | sendRtpItem.setServerId(userSetting.getServerId()); |
| | | |
| | | RedisRpcResponse response = request.getResponse(); |
| | | response.setBody(sendRtpItem); |
| | | response.setStatusCode(200); |
| | |
| | | */ |
| | | public RedisRpcResponse stopWaitePushStreamOnline(RedisRpcRequest request) { |
| | | SendRtpItem sendRtpItem = JSON.parseObject(request.getParam().toString(), SendRtpItem.class); |
| | | logger.info("[redis-rpc] 停止监听流上线: {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream() ); |
| | | logger.info("[redis-rpc] 停止监听流上线: {}/{}, 目标地址: {}:{}", sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort() ); |
| | | |
| | | // 监听流上线。 流上线直接发送sendRtpItem消息给实际的信令处理者 |
| | | HookSubscribeForStreamChange hook = HookSubscribeFactory.on_stream_changed( |
| | |
| | | */ |
| | | public RedisRpcResponse startSendRtp(RedisRpcRequest request) { |
| | | SendRtpItem sendRtpItem = JSON.parseObject(request.getParam().toString(), SendRtpItem.class); |
| | | logger.info("[redis-rpc] 开始发流: {}/{}, 目标地址: {}:{}", sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort()); |
| | | MediaServerItem mediaServerItem = mediaServerService.getOne(sendRtpItem.getMediaServerId()); |
| | | if (mediaServerItem == null) { |
| | | logger.info("[redis-rpc] startSendRtp->未找到MediaServer: {}", sendRtpItem.getMediaServerId() ); |
| | |
| | | RedisRpcResponse response = request.getResponse(); |
| | | response.setStatusCode(200); |
| | | if (jsonObject.getInteger("code") == 0) { |
| | | logger.info("[redis-rpc] 发流成功: {}/{}, 目标地址: {}:{}", sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort()); |
| | | WVPResult wvpResult = WVPResult.success(); |
| | | response.setBody(wvpResult); |
| | | }else { |
| | | logger.info("[redis-rpc] 发流失败: {}/{}, 目标地址: {}:{}, {}", sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort(), jsonObject); |
| | | WVPResult wvpResult = WVPResult.fail(jsonObject.getInteger("code"), jsonObject.getString("msg")); |
| | | response.setBody(wvpResult); |
| | | } |
| | |
| | | */ |
| | | public RedisRpcResponse stopSendRtp(RedisRpcRequest request) { |
| | | SendRtpItem sendRtpItem = JSON.parseObject(request.getParam().toString(), SendRtpItem.class); |
| | | logger.info("[redis-rpc] 停止推流: {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream() ); |
| | | logger.info("[redis-rpc] 停止推流: {}/{}, 目标地址: {}:{}", sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort() ); |
| | | MediaServerItem mediaServerItem = mediaServerService.getOne(sendRtpItem.getMediaServerId()); |
| | | if (mediaServerItem == null) { |
| | | logger.info("[redis-rpc] stopSendRtp->未找到MediaServer: {}", sendRtpItem.getMediaServerId() ); |
| | |
| | | RedisRpcResponse response = request.getResponse(); |
| | | response.setStatusCode(200); |
| | | if (jsonObject.getInteger("code") == 0) { |
| | | logger.info("[redis-rpc] 停止推流成功: {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream() ); |
| | | logger.info("[redis-rpc] 停止推流成功: {}/{}, 目标地址: {}:{}", sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort() ); |
| | | WVPResult wvpResult = WVPResult.success(); |
| | | response.setBody(wvpResult); |
| | | }else { |
| | | int code = jsonObject.getInteger("code"); |
| | | String msg = jsonObject.getString("msg"); |
| | | logger.info("[redis-rpc] 停止推流失败: {}/{}, code: {}, msg: {}", sendRtpItem.getApp(), sendRtpItem.getStream(),code, msg ); |
| | | logger.info("[redis-rpc] 停止推流失败: {}/{}, 目标地址: {}:{}, code: {}, msg: {}", sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort(), code, msg ); |
| | | WVPResult wvpResult = WVPResult.fail(code, msg); |
| | | response.setBody(wvpResult); |
| | | } |
| | |
| | | */ |
| | | public RedisRpcResponse rtpSendStopped(RedisRpcRequest request) { |
| | | SendRtpItem sendRtpItem = JSON.parseObject(request.getParam().toString(), SendRtpItem.class); |
| | | logger.info("[redis-rpc] 推流已经停止: {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream() ); |
| | | logger.info("[redis-rpc] 推流已经停止: {}/{}, 目标地址: {}:{}", sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort() ); |
| | | SendRtpItem sendRtpItemInCatch = redisCatchStorage.querySendRTPServer(sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(), sendRtpItem.getStream(), sendRtpItem.getCallId()); |
| | | RedisRpcResponse response = request.getResponse(); |
| | | response.setStatusCode(200); |
| | |
| | | import com.genersoft.iot.vmp.media.zlm.dto.hook.HookParam; |
| | | import com.genersoft.iot.vmp.service.redisMsg.IRedisRpcService; |
| | | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class RedisRpcServiceImpl implements IRedisRpcService { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(RedisRpcServiceImpl.class); |
| | | |
| | | @Autowired |
| | | private RedisRpcConfig redisRpcConfig; |
| | |
| | | |
| | | @Override |
| | | public WVPResult startSendRtp(SendRtpItem sendRtpItem) { |
| | | logger.info("[请求其他WVP] 开始推流,wvp:{}, {}/{}", sendRtpItem.getServerId(), sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | RedisRpcRequest request = buildRequest("startSendRtp", sendRtpItem); |
| | | request.setToId(sendRtpItem.getServerId()); |
| | | RedisRpcResponse response = redisRpcConfig.request(request, 10); |
| | |
| | | |
| | | @Override |
| | | public void waitePushStreamOnline(SendRtpItem sendRtpItem, CommonCallback<SendRtpItem> callback) { |
| | | logger.info("[请求所有WVP监听流上线] {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | // 监听流上线。 流上线直接发送sendRtpItem消息给实际的信令处理者 |
| | | HookSubscribeForStreamChange hook = HookSubscribeFactory.on_stream_changed( |
| | | sendRtpItem.getApp(), sendRtpItem.getStream(), true, "rtsp", null); |
| | |
| | | request.setToId(sendRtpItem.getServerId()); |
| | | redisRpcConfig.request(request, response -> { |
| | | SendRtpItem sendRtpItemFromOther = JSON.parseObject(response.getBody().toString(), SendRtpItem.class); |
| | | logger.info("[请求所有WVP监听流上线] 流上线 {}/{}->{}", sendRtpItemFromOther.getApp(), sendRtpItemFromOther.getStream(), sendRtpItemFromOther); |
| | | if (callback != null) { |
| | | callback.run(sendRtpItemFromOther); |
| | | } |
| | |
| | | "<if test='status != null'>, status=#{status}</if>" + |
| | | "<if test='streamId != null'>, stream_id=#{streamId}</if>" + |
| | | "<if test='hasAudio != null'>, has_audio=#{hasAudio}</if>" + |
| | | ", custom_longitude=#{longitude}" + |
| | | ", custom_latitude=#{latitude}" + |
| | | "<if test='customLongitude != null'>, custom_longitude=#{customLongitude}</if>" + |
| | | "<if test='customLatitude != null'>, custom_latitude=#{customLatitude}</if>" + |
| | | "<if test='longitudeGcj02 != null'>, longitude_gcj02=#{longitudeGcj02}</if>" + |
| | | "<if test='latitudeGcj02 != null'>, latitude_gcj02=#{latitudeGcj02}</if>" + |
| | | "<if test='longitudeWgs84 != null'>, longitude_wgs84=#{longitudeWgs84}</if>" + |
| | |
| | | "dc.password, " + |
| | | "COALESCE(dc.custom_ptz_type, dc.ptz_type) AS ptz_type, " + |
| | | "dc.status, " + |
| | | "COALESCE(dc.custom_longitude, dc.longitude) AS longitude, " + |
| | | "COALESCE(dc.custom_latitude, dc.latitude) AS latitude, " + |
| | | "dc.longitude, " + |
| | | "dc.latitude, " + |
| | | "dc.custom_longitude, " + |
| | | "dc.custom_latitude, " + |
| | | "dc.stream_id, " + |
| | | "dc.device_id, " + |
| | | "dc.parental, " + |
| | |
| | | "<if test='item.hasAudio != null'>, has_audio=#{item.hasAudio}</if>" + |
| | | "<if test='item.longitude != null'>, longitude=#{item.longitude}</if>" + |
| | | "<if test='item.latitude != null'>, latitude=#{item.latitude}</if>" + |
| | | "<if test='customLongitude != null'>, custom_longitude=#{item.customLongitude}</if>" + |
| | | "<if test='custom_latitude != null'>, custom_latitude=#{item.customLatitude}</if>" + |
| | | "<if test='item.longitudeGcj02 != null'>, longitude_gcj02=#{item.longitudeGcj02}</if>" + |
| | | "<if test='item.latitudeGcj02 != null'>, latitude_gcj02=#{item.latitudeGcj02}</if>" + |
| | | "<if test='item.longitudeWgs84 != null'>, longitude_wgs84=#{item.longitudeWgs84}</if>" + |
| | |
| | | application: |
| | | name: wvp |
| | | profiles: |
| | | active: local2 |
| | | active: local |
| | |
| | | e.ptzType = e.ptzType + ""; |
| | | that.$set(e, "edit", false); |
| | | that.$set(e, "location", ""); |
| | | if (e.longitude && e.latitude) { |
| | | if (e.customLongitude && e.customLatitude) { |
| | | that.$set(e, "location", e.customLongitude + "," + e.customLatitude); |
| | | }else if (e.longitude && e.latitude) { |
| | | that.$set(e, "location", e.longitude + "," + e.latitude); |
| | | } |
| | | }); |
| | |
| | | e.ptzType = e.ptzType + ""; |
| | | this.$set(e, "edit", false); |
| | | this.$set(e, "location", ""); |
| | | if (e.longitude && e.latitude) { |
| | | if (e.customLongitude && e.customLatitude) { |
| | | this.$set(e, "location", e.customLongitude + "," + e.customLatitude); |
| | | }else if (e.longitude && e.latitude) { |
| | | this.$set(e, "location", e.longitude + "," + e.latitude); |
| | | } |
| | | }); |
| | |
| | | this.$message.warning("位置信息格式有误,例:117.234,36.378"); |
| | | return; |
| | | } else { |
| | | row.longitude = parseFloat(segements[0]); |
| | | row.latitude = parseFloat(segements[1]); |
| | | row.customLongitude = parseFloat(segements[0]); |
| | | row.custom_latitude = parseFloat(segements[1]); |
| | | if (!(row.longitude && row.latitude)) { |
| | | this.$message.warning("位置信息格式有误,例:117.234,36.378"); |
| | | return; |