From fc7f1b3459d9c65a37cae25bc254a6a3d62cc6db Mon Sep 17 00:00:00 2001 From: xubinbin <1323875150@qq.com> Date: 星期五, 23 九月 2022 10:55:42 +0800 Subject: [PATCH] 处理上级平台发送的invite请求不携带“y=”sdp信息时,使用默认“y=0000000000”视频无法播放的问题。 --- src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java | 49 ++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 42 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java index 708d693..3c5644b 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java @@ -1,17 +1,17 @@ package com.genersoft.iot.vmp.service.impl; import com.genersoft.iot.vmp.conf.DynamicTask; -import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; -import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch; -import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; -import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder; +import com.genersoft.iot.vmp.conf.UserSetting; +import com.genersoft.iot.vmp.gb28181.bean.*; import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; import com.genersoft.iot.vmp.service.IMediaServerService; import com.genersoft.iot.vmp.service.IPlatformService; +import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; +import com.genersoft.iot.vmp.storager.dao.GbStreamMapper; import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -56,6 +56,12 @@ @Autowired private SubscribeHolder subscribeHolder; + + @Autowired + private GbStreamMapper gbStreamMapper; + + @Autowired + private UserSetting userSetting; @@ -125,7 +131,7 @@ dynamicTask.startDelay(registerTaskKey, // 娉ㄥ唽澶辫触锛堟敞鍐屾垚鍔熸椂鐢辩▼搴忕洿鎺ヨ皟鐢ㄤ簡online鏂规硶锛� ()->commanderForPlatform.register(parentPlatform, eventResult -> offline(parentPlatform),null), - parentPlatform.getExpires()*1000); + (parentPlatform.getExpires() - 10) *1000); final String keepaliveTaskKey = KEEPALIVE_KEY_PREFIX + parentPlatform.getServerGBId(); if (!dynamicTask.contains(keepaliveTaskKey)) { @@ -164,7 +170,7 @@ redisCatchStorage.updatePlatformCatchInfo(platformCatch); } }), - parentPlatform.getExpires()*1000); + (parentPlatform.getKeepTimeout() - 10)*1000); } } @@ -213,7 +219,6 @@ param.put("stream", sendRtpItem.getStreamId()); zlmrtpServerFactory.stopSendRtpStream(mediaInfo, param); } - } } @@ -229,4 +234,34 @@ 60*1000); }, null); } + + @Override + public void sendNotifyMobilePosition(String platformId) { + ParentPlatform platform = platformMapper.getParentPlatByServerGBId(platformId); + if (platform == null) { + return; + } + SubscribeInfo subscribe = subscribeHolder.getMobilePositionSubscribe(platform.getServerGBId()); + if (subscribe != null) { + + // TODO 鏆傛椂鍙鐞嗚棰戞祦鐨勫洖澶�,鍚庣画澧炲姞瀵瑰浗鏍囪澶囩殑鏀寔 + List<DeviceChannel> gbStreams = gbStreamMapper.queryGbStreamListInPlatform(platform.getServerGBId(), userSetting.isUsePushingAsStatus()); + if (gbStreams.size() == 0) { + return; + } + for (DeviceChannel deviceChannel : gbStreams) { + String gbId = deviceChannel.getChannelId(); + GPSMsgInfo gpsMsgInfo = redisCatchStorage.getGpsMsgInfo(gbId); + // 鏃犳渶鏂颁綅缃笉鍙戦�� + if (gpsMsgInfo != null) { + // 缁忕含搴﹂兘涓�0涓嶅彂閫� + if (gpsMsgInfo.getLng() == 0 && gpsMsgInfo.getLat() == 0) { + continue; + } + // 鍙戦�丟PS娑堟伅 + commanderForPlatform.sendNotifyMobilePosition(platform, gpsMsgInfo, subscribe); + } + } + } + } } -- Gitblit v1.8.0