From 7b46769a1674a59d4e243c1f3b6d8b481099b645 Mon Sep 17 00:00:00 2001 From: panlinlin <648540858@qq.com> Date: Thu, 13 Jun 2024 23:15:51 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=BD=E6=A0=87?= =?UTF-8?q?=E5=BD=95=E5=83=8F=E4=B8=8B=E8=BD=BD=E5=90=8E=E8=B4=9F=E8=BD=BD?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E6=9C=AA=E6=B8=85=E9=99=A4=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/genersoft/iot/vmp/conf/MediaConfig.java | 14 +++++++++++--- .../iot/vmp/service/IInviteStreamService.java | 2 ++ .../service/impl/InviteStreamServiceImpl.java | 16 ++++++++++++++-- .../iot/vmp/service/impl/PlayServiceImpl.java | 3 ++- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/conf/MediaConfig.java b/src/main/java/com/genersoft/iot/vmp/conf/MediaConfig.java index 0770172d..a9ea67f7 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/MediaConfig.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/MediaConfig.java @@ -27,7 +27,7 @@ public class MediaConfig{ @Value("${media.ip}") private String ip; - @Value("${media.wan_ip}") + @Value("${media.wan_ip:}") private String wanIp; @Value("${media.hook-ip:127.0.0.1}") @@ -36,10 +36,10 @@ public class MediaConfig{ @Value("${sip.domain}") private String sipDomain; - @Value("${media.sdp-ip:${media.wan_ip}}") + @Value("${media.sdp-ip:${media.wan_ip:}}") private String sdpIp; - @Value("${media.stream-ip:${media.wan_ip}}") + @Value("${media.stream-ip:${media.wan_ip:}}") private String streamIp; @Value("${media.http-port:0}") @@ -283,4 +283,12 @@ public class MediaConfig{ } return false; } + + public String getWanIp() { + return wanIp; + } + + public void setWanIp(String wanIp) { + this.wanIp = wanIp; + } } diff --git a/src/main/java/com/genersoft/iot/vmp/service/IInviteStreamService.java b/src/main/java/com/genersoft/iot/vmp/service/IInviteStreamService.java index c06400dc..e54fa92a 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/IInviteStreamService.java +++ b/src/main/java/com/genersoft/iot/vmp/service/IInviteStreamService.java @@ -14,6 +14,8 @@ public interface IInviteStreamService { */ void updateInviteInfo(InviteInfo inviteInfo); + void updateInviteInfo(InviteInfo inviteInfo, Long time); + InviteInfo updateInviteInfoForStream(InviteInfo inviteInfo, String stream); /** diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/InviteStreamServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/InviteStreamServiceImpl.java index 6e009609..e5847f69 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/InviteStreamServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/InviteStreamServiceImpl.java @@ -24,6 +24,7 @@ import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.TimeUnit; @Service @DS("master") @@ -64,9 +65,13 @@ public class InviteStreamServiceImpl implements IInviteStreamService { } } } - @Override public void updateInviteInfo(InviteInfo inviteInfo) { + updateInviteInfo(inviteInfo, null); + } + + @Override + public void updateInviteInfo(InviteInfo inviteInfo, Long time) { if (inviteInfo == null || (inviteInfo.getDeviceId() == null || inviteInfo.getChannelId() == null)) { logger.warn("[更新Invite信息],参数不全: {}", JSON.toJSON(inviteInfo)); return; @@ -118,7 +123,11 @@ public class InviteStreamServiceImpl implements IInviteStreamService { ":" + inviteInfoForUpdate.getChannelId() + ":" + inviteInfoForUpdate.getStream()+ ":" + inviteInfoForUpdate.getSsrcInfo().getSsrc(); - redisTemplate.opsForValue().set(key, inviteInfoForUpdate); + if (time != null && time > 0) { + redisTemplate.opsForValue().set(key, inviteInfoForUpdate, time, TimeUnit.SECONDS); + }else { + redisTemplate.opsForValue().set(key, inviteInfoForUpdate); + } } @Override @@ -243,6 +252,9 @@ public class InviteStreamServiceImpl implements IInviteStreamService { String keyStr = (String) keyObj; InviteInfo inviteInfo = (InviteInfo) redisTemplate.opsForValue().get(keyStr); if (inviteInfo != null && inviteInfo.getStreamInfo() != null && inviteInfo.getStreamInfo().getMediaServerId().equals(mediaServerId)) { + if (inviteInfo.getType().equals(InviteSessionType.DOWNLOAD) && inviteInfo.getStreamInfo().getProgress() == 1) { + continue; + } count++; } } diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java index bc85ecf9..39c67c26 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java @@ -1038,7 +1038,8 @@ public class PlayServiceImpl implements IPlayService { InviteInfo inviteInfoForNew = inviteStreamService.getInviteInfo(inviteInfo.getType(), inviteInfo.getDeviceId() , inviteInfo.getChannelId(), inviteInfo.getStream()); inviteInfoForNew.getStreamInfo().setDownLoadFilePath(downloadFileInfo); - inviteStreamService.updateInviteInfo(inviteInfoForNew); + // 不可以马上移除会导致后续接口拿不到下载地址 + inviteStreamService.updateInviteInfo(inviteInfoForNew, 60*15L); }; Hook hook = Hook.getInstance(HookType.on_record_mp4, "rtp", ssrcInfo.getStream(), mediaServerItem.getId()); // 设置过期时间,下载失败时自动处理订阅数据 From 317c5455c6eeb7084460000055fa9d1dc6cecf4a Mon Sep 17 00:00:00 2001 From: panlinlin <648540858@qq.com> Date: Thu, 13 Jun 2024 23:19:26 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E4=BF=9D=E5=AD=98=E5=A4=B1=E8=B4=A5=E7=9A=84?= =?UTF-8?q?BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web_src/src/components/channelList.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web_src/src/components/channelList.vue b/web_src/src/components/channelList.vue index ef492050..ff1d7842 100755 --- a/web_src/src/components/channelList.vue +++ b/web_src/src/components/channelList.vue @@ -604,12 +604,13 @@ export default { if (row.location) { const segements = row.location.split(","); if (segements.length !== 2) { + console.log(1) this.$message.warning("位置信息格式有误,例:117.234,36.378"); return; } else { row.customLongitude = parseFloat(segements[0]); - row.custom_latitude = parseFloat(segements[1]); - if (!(row.longitude && row.latitude)) { + row.customLatitude = parseFloat(segements[1]); + if (!(row.customLongitude && row.customLatitude)) { this.$message.warning("位置信息格式有误,例:117.234,36.378"); return; } From 70e6d919e9011688653627fdffa64c94d6109341 Mon Sep 17 00:00:00 2001 From: panlinlin <648540858@qq.com> Date: Thu, 13 Jun 2024 23:40:32 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E6=B3=A8=E5=86=8C=E7=BD=91=E5=8D=A1=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=8F=98=E5=8C=96=E6=97=B6=EF=BC=8C=E6=9B=B4=E6=96=B0=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java | 2 +- .../impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java b/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java index 13735306..55070447 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java @@ -60,7 +60,7 @@ public class SipLayer implements CommandLineRunner { if (nif.getName().startsWith("docker")) { continue; } - logger.error("[自动配置SIP监听网卡] 网卡接口地址: {}", addr.getHostAddress());// 只关心 IPv4 地址 + logger.info("[自动配置SIP监听网卡] 网卡接口地址: {}", addr.getHostAddress());// 只关心 IPv4 地址 monitorIps.add(addr.getHostAddress()); } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java index bfc42f5a..85f2da74 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java @@ -78,11 +78,12 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp } RemoteAddressInfo remoteAddressInfo = SipUtils.getRemoteAddressFromRequest(request, userSetting.getSipUseSourceIpAsRemoteAddress()); - if (!device.getIp().equalsIgnoreCase(remoteAddressInfo.getIp()) || device.getPort() != remoteAddressInfo.getPort()) { + if (!device.getIp().equalsIgnoreCase(remoteAddressInfo.getIp()) || device.getPort() != remoteAddressInfo.getPort() || !request.getRemoteAddress().getHostAddress().equals(device.getLocalIp())) { logger.info("[收到心跳] 设备{}地址变化, 远程地址为: {}:{}", device.getDeviceId(), remoteAddressInfo.getIp(), remoteAddressInfo.getPort()); device.setPort(remoteAddressInfo.getPort()); device.setHostAddress(remoteAddressInfo.getIp().concat(":").concat(String.valueOf(remoteAddressInfo.getPort()))); device.setIp(remoteAddressInfo.getIp()); + device.setLocalIp(request.getRemoteAddress().getHostAddress()); // 设备地址变化会引起目录订阅任务失效,需要重新添加 if (device.getSubscribeCycleForCatalog() > 0) { deviceService.removeCatalogSubscribe(device, result->{