From 49101a37e0f71f22fee25b811a54895f2f6f3e82 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Fri, 17 May 2024 16:32:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9zlm-pro=E8=BD=AC=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NotifyRequestForMobilePositionProcessor.java | 4 ++-- .../genersoft/iot/vmp/media/zlm/ZLMServerConfig.java | 11 +++++++++++ .../iot/vmp/media/zlm/dto/MediaServerItem.java | 12 ++++++++++++ .../iot/vmp/service/impl/MediaServerServiceImpl.java | 2 +- .../iot/vmp/service/impl/MediaServiceImpl.java | 5 ++++- .../iot/vmp/storager/dao/MediaServerMapper.java | 4 ++++ .../iot/vmp/storager/impl/RedisCatchStorageImpl.java | 2 +- 数据库/2.7.1/更新-mysql-2.7.1.sql | 2 ++ 数据库/2.7.1/更新-postgresql-kingbase-2.7.1.sql | 2 ++ 9 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 数据库/2.7.1/更新-mysql-2.7.1.sql create mode 100644 数据库/2.7.1/更新-postgresql-kingbase-2.7.1.sql diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestForMobilePositionProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestForMobilePositionProcessor.java index 96e4ecac..c8111778 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestForMobilePositionProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestForMobilePositionProcessor.java @@ -143,8 +143,8 @@ public class NotifyRequestForMobilePositionProcessor extends SIPRequestProcessor } } -// logger.info("[收到移动位置订阅通知]:{}/{}->{}.{}, 时间: {}", mobilePosition.getDeviceId(), mobilePosition.getChannelId(), -// mobilePosition.getLongitude(), mobilePosition.getLatitude(), System.currentTimeMillis() - startTime); + logger.debug("[收到移动位置订阅通知]:{}/{}->{}.{}, 时间: {}", mobilePosition.getDeviceId(), mobilePosition.getChannelId(), + mobilePosition.getLongitude(), mobilePosition.getLatitude(), System.currentTimeMillis() - startTime); mobilePosition.setReportSource("Mobile Position"); mobilePositionService.add(mobilePosition); diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerConfig.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerConfig.java index 80910c02..6d6dcf6a 100755 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerConfig.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerConfig.java @@ -331,6 +331,9 @@ public class ZLMServerConfig extends HookParam { @JSONField(name = "shell.shell") private String shellPhell; + @JSONField(name = "transcode.suffix") + private String transcodeSuffix; + public String getHookIp() { return hookIp; @@ -1211,4 +1214,12 @@ public class ZLMServerConfig extends HookParam { public void setHookOnRtpServerTimeout(String hookOnRtpServerTimeout) { this.hookOnRtpServerTimeout = hookOnRtpServerTimeout; } + + public String getTranscodeSuffix() { + return transcodeSuffix; + } + + public void setTranscodeSuffix(String transcodeSuffix) { + this.transcodeSuffix = transcodeSuffix; + } } diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/MediaServerItem.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/MediaServerItem.java index cebfec3b..d5a0f7fa 100755 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/MediaServerItem.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/MediaServerItem.java @@ -86,6 +86,9 @@ public class MediaServerItem{ @Schema(description = "录像存储路径") private String recordPath; + @Schema(description = "转码的前缀") + private String transcodeSuffix; + public MediaServerItem() { } @@ -108,6 +111,7 @@ public class MediaServerItem{ rtpEnable = false; // 默认使用单端口;直到用户自己设置开启多端口 rtpPortRange = zlmServerConfig.getPortRange().replace("_",","); // 默认使用30000,30500作为级联时发送流的端口号 recordAssistPort = 0; // 默认关闭 + transcodeSuffix = zlmServerConfig.getTranscodeSuffix(); } @@ -318,4 +322,12 @@ public class MediaServerItem{ public void setRecordPath(String recordPath) { this.recordPath = recordPath; } + + public String getTranscodeSuffix() { + return transcodeSuffix; + } + + public void setTranscodeSuffix(String transcodeSuffix) { + this.transcodeSuffix = transcodeSuffix; + } } diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java index aeb0dc80..7620baad 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java @@ -410,6 +410,7 @@ public class MediaServerServiceImpl implements IMediaServerService { if (serverItem.getRtpProxyPort() == 0) { serverItem.setRtpProxyPort(zlmServerConfig.getRtpProxyPort()); } + serverItem.setTranscodeSuffix(zlmServerConfig.getTranscodeSuffix()); serverItem.setStatus(true); if (ObjectUtils.isEmpty(serverItem.getId())) { @@ -424,7 +425,6 @@ public class MediaServerServiceImpl implements IMediaServerService { redisTemplate.opsForValue().set(key, serverItem); resetOnlineServerItem(serverItem); - if (serverItem.isAutoConfig()) { setZLMConfig(serverItem, "0".equals(zlmServerConfig.getHookEnable())); } diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java index 784f43f3..f2eb754b 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java @@ -1,6 +1,5 @@ package com.genersoft.iot.vmp.service.impl; -import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; import com.genersoft.iot.vmp.common.StreamInfo; @@ -91,6 +90,10 @@ public class MediaServiceImpl implements IMediaService { if (addr == null) { addr = mediaInfo.getStreamIp(); } + if (!"broadcast".equalsIgnoreCase(app) && !ObjectUtils.isEmpty(mediaInfo.getTranscodeSuffix()) && !"null".equalsIgnoreCase(mediaInfo.getTranscodeSuffix())) { + stream = stream + "_" + mediaInfo.getTranscodeSuffix(); + streamInfoResult.setStream(stream); + } streamInfoResult.setIp(addr); streamInfoResult.setMediaServerId(mediaInfo.getId()); diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java index 46785911..da712128 100755 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java @@ -36,6 +36,7 @@ public interface MediaServerMapper { "default_server,"+ "create_time,"+ "update_time,"+ + "transcode_suffix,"+ "hook_alive_interval"+ ") VALUES " + "(" + @@ -62,6 +63,7 @@ public interface MediaServerMapper { "#{defaultServer}, " + "#{createTime}, " + "#{updateTime}, " + + "#{transcodeSuffix}, " + "#{hookAliveInterval})") int add(MediaServerItem mediaServerItem); @@ -88,6 +90,7 @@ public interface MediaServerMapper { ", hook_alive_interval=#{hookAliveInterval}" + ", record_day=#{recordDay}" + ", record_path=#{recordPath}" + + ", transcode_suffix=#{transcodeSuffix}" + "WHERE id=#{id}"+ " "}) int update(MediaServerItem mediaServerItem); @@ -113,6 +116,7 @@ public interface MediaServerMapper { ", record_assist_port=#{recordAssistPort}" + ", record_day=#{recordDay}" + ", record_path=#{recordPath}" + + ", transcode_suffix=#{transcodeSuffix}" + ", hook_alive_interval=#{hookAliveInterval}" + "WHERE ip=#{ip} and http_port=#{httpPort}"+ " "}) diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java index e42ea68b..9a18c9ae 100755 --- a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java @@ -570,7 +570,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { @Override public void sendMobilePositionMsg(JSONObject jsonObject) { String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_MOBILE_POSITION; - logger.info("[redis发送通知] 发送 移动位置 {}: {}", key, jsonObject.toString()); + logger.debug("[redis发送通知] 发送 移动位置 {}: {}", key, jsonObject.toString()); redisTemplate.convertAndSend(key, jsonObject); } diff --git a/数据库/2.7.1/更新-mysql-2.7.1.sql b/数据库/2.7.1/更新-mysql-2.7.1.sql new file mode 100644 index 00000000..86e8d0de --- /dev/null +++ b/数据库/2.7.1/更新-mysql-2.7.1.sql @@ -0,0 +1,2 @@ +alter table wvp_media_server + add transcode_suffix character varying(255); \ No newline at end of file diff --git a/数据库/2.7.1/更新-postgresql-kingbase-2.7.1.sql b/数据库/2.7.1/更新-postgresql-kingbase-2.7.1.sql new file mode 100644 index 00000000..86e8d0de --- /dev/null +++ b/数据库/2.7.1/更新-postgresql-kingbase-2.7.1.sql @@ -0,0 +1,2 @@ +alter table wvp_media_server + add transcode_suffix character varying(255); \ No newline at end of file